1 介绍

1.1 定义

01.技术概述
    a.基本定义
        Micronaut是一个现代化的、基于JVM的全栈框架,专为构建模块化、易测试的微服务和无服务器应用而设计。它由OCI团队开发,于2018年首次发布,核心特点是采用编译时依赖注入和AOP代理,避免运行时反射带来的性能开销。
    b.技术定位
        a.云原生框架
            Micronaut从设计之初就以云原生为目标,优化了启动时间、内存占用和吞吐量,特别适合容器化部署和函数计算场景。
        b.编译时处理
            通过注解处理器在编译期生成依赖注入和AOP代理代码,消除了运行时反射的性能损耗,实现了快速启动和低内存占用。
        c.多语言支持
            原生支持Java、Kotlin和Groovy三种JVM语言,开发者可以根据项目需求选择合适的编程语言。

02.核心理念
    a.编译优于反射
        a.设计思想
            Micronaut将传统运行时框架在启动时执行的工作前移至编译期,通过注解处理器生成必要的元数据和代理类,避免运行时的类扫描、反射调用和动态代理生成。
        b.性能优势
            ---
            // 传统Spring框架启动过程(运行时反射)
            // 1. 类路径扫描
            // 2. 反射读取注解
            // 3. 动态代理生成
            // 4. Bean实例化
            // 启动时间: 3-5秒,内存占用: 200MB+

            // Micronaut启动过程(编译时处理)
            // 1. 编译期生成依赖注入代码
            // 2. 编译期生成AOP代理类
            // 3. 运行时直接加载生成的类
            // 启动时间: <1秒,内存占用: 20MB+

            import io.micronaut.runtime.Micronaut;

            public class Application {
                public static void main(String[] args) {
                    // Micronaut应用启动,无需类扫描和反射
                    Micronaut.run(Application.class, args);
                }
            }
            ---
    b.响应式优先
        a.响应式编程模型
            Micronaut内置支持响应式编程,HTTP客户端和服务器默认基于Netty实现,支持Reactive Streams、RxJava、Reactor等响应式库。
        b.非阻塞IO
            ---
            // 响应式HTTP客户端示例
            import io.micronaut.http.client.annotation.Client;
            import io.micronaut.http.annotation.Get;
            import io.reactivex.Single;

            @Client("https://api.example.com")
            public interface ExternalApiClient {
                // 返回响应式类型,支持非阻塞调用
                @Get("/users/{id}")
                Single<User> getUser(Long id);
            }
            ---
    c.低内存占用
        a.优化策略
            通过编译时处理、避免反射、减少运行时元数据,Micronaut应用的内存占用远低于传统框架,特别适合容器化和函数计算场景。
        b.内存对比
            ---
            // 内存占用对比(Hello World应用)
            // Spring Boot 2.x:     堆内存 150-200MB
            // Micronaut 3.x:       堆内存 20-30MB
            // Micronaut + GraalVM: RSS内存 15-20MB

            // 容器资源配置示例
            // Docker限制:Micronaut应用可以在64MB内存限制下运行
            docker run -m 64m micronaut-app
            ---

03.技术背景
    a.诞生原因
        a.Spring框架的局限
            Spring框架虽然功能强大,但在微服务和云原生场景下暴露出启动慢、内存占用高、不适合函数计算等问题,这些问题根源于运行时反射机制。
        b.云原生需求
            容器编排、函数计算、边缘计算等新兴场景对框架提出了快速启动、低内存占用、小体积镜像的严格要求。
    b.技术演进
        a.版本历史
            Micronaut 1.0于2018年发布,随后快速迭代,3.x版本(2021年)引入了重大改进,包括更好的GraalVM支持、增强的数据访问能力和完善的云原生集成。
        b.社区生态
            ---
            // Micronaut生态组件
            // - Micronaut Data: 编译时数据访问框架
            // - Micronaut Security: 安全认证框架
            // - Micronaut Kafka: Kafka集成
            // - Micronaut gRPC: gRPC支持
            // - Micronaut AWS: AWS Lambda和服务集成

            // Maven依赖示例
            <dependency>
                <groupId>io.micronaut</groupId>
                <artifactId>micronaut-runtime</artifactId>
                <version>3.8.0</version>
            </dependency>
            ---

1.2 核心概念

01.依赖注入
    a.编译时注入原理
        a.注解处理器机制
            Micronaut使用Java注解处理器(Annotation Processor)在编译期分析代码中的依赖注入注解,生成BeanDefinition类和依赖关系元数据,运行时直接加载这些预生成的类,无需反射扫描。
        b.代码生成过程
            ---
            // 源代码:定义一个服务类
            import jakarta.inject.Singleton;

            @Singleton
            public class UserService {
                private final UserRepository repository;

                public UserService(UserRepository repository) {
                    this.repository = repository;
                }
            }

            // 编译时生成的BeanDefinition类(简化版)
            // $UserService$Definition.java
            public class $UserService$Definition
                extends AbstractInitializableBeanDefinition<UserService> {

                @Override
                protected UserService instantiate(BeanContext context) {
                    // 直接调用构造器,无需反射
                    UserRepository repo = context.getBean(UserRepository.class);
                    return new UserService(repo);
                }
            }
            ---
    b.JSR-330标准支持
        a.标准注解
            Micronaut完全支持JSR-330依赖注入标准,使用jakarta.inject包下的标准注解,如@Inject、@Singleton、@Named等,保证代码的可移植性。
        b.注解对比
            ---
            // JSR-330标准注解
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;
            import jakarta.inject.Named;

            @Singleton
            public class OrderService {
                @Inject
                @Named("primary")
                private DataSource dataSource;
            }

            // Micronaut扩展注解
            import io.micronaut.context.annotation.Primary;
            import io.micronaut.context.annotation.Requires;

            @Singleton
            @Primary  // Micronaut注解,标记为首选Bean
            @Requires(property = "datasource.enabled", value = "true")
            public class PrimaryDataSource implements DataSource {
                // 实现细节
            }
            ---

02.AOP面向切面编程
    a.编译时AOP实现
        a.代理生成机制
            Micronaut在编译期生成AOP代理类,避免了运行时动态代理的性能开销。支持方法拦截器(MethodInterceptor)和引入通知(Introduction Advice)。
        b.拦截器示例
            ---
            // 定义一个方法拦截器
            import io.micronaut.aop.MethodInterceptor;
            import io.micronaut.aop.MethodInvocationContext;
            import jakarta.inject.Singleton;

            @Singleton
            public class LoggingInterceptor implements MethodInterceptor<Object, Object> {
                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    String methodName = context.getMethodName();
                    System.out.println("Before: " + methodName);

                    Object result = context.proceed();

                    System.out.println("After: " + methodName);
                    return result;
                }
            }

            // 使用注解标记需要拦截的方法
            import io.micronaut.aop.Around;
            import java.lang.annotation.*;

            @Around  // 声明为环绕通知
            @Type(LoggingInterceptor.class)  // 指定拦截器类
            @Retention(RetentionPolicy.RUNTIME)
            @Target({ElementType.METHOD, ElementType.TYPE})
            public @interface Logged {
            }

            // 应用到业务类
            @Singleton
            public class ProductService {
                @Logged  // 该方法会被LoggingInterceptor拦截
                public Product findById(Long id) {
                    return productRepository.findById(id);
                }
            }
            ---
    b.内置AOP支持
        a.事务管理
            Micronaut提供@Transactional注解实现声明式事务管理,通过AOP拦截器自动处理事务的开启、提交和回滚。
        b.缓存抽象
            ---
            // 缓存注解示例
            import io.micronaut.cache.annotation.Cacheable;
            import io.micronaut.cache.annotation.CacheInvalidate;

            @Singleton
            public class UserService {
                // 方法结果会被缓存,缓存键为userId
                @Cacheable("users")
                public User findById(Long userId) {
                    return userRepository.findById(userId);
                }

                // 更新用户时使缓存失效
                @CacheInvalidate("users")
                public void updateUser(User user) {
                    userRepository.update(user);
                }
            }
            ---

03.HTTP服务器与客户端
    a.基于Netty的HTTP服务器
        a.非阻塞架构
            Micronaut内置的HTTP服务器基于Netty实现,采用事件驱动的非阻塞IO模型,可以高效处理大量并发连接。
        b.服务器配置
            ---
            // application.yml配置
            // micronaut:
            //   server:
            //     port: 8080
            //     netty:
            //       max-header-size: 16KB
            //       worker:
            //         threads: 8  # 工作线程数

            // 定义HTTP控制器
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.annotation.Get;

            @Controller("/api")
            public class ApiController {
                @Get("/hello")
                public String hello() {
                    return "Hello Micronaut";
                }
            }
            ---
    b.声明式HTTP客户端
        a.客户端定义
            Micronaut提供声明式HTTP客户端,通过接口和注解定义,编译期生成客户端实现代码,支持同步、异步和响应式调用。
        b.客户端示例
            ---
            // 定义HTTP客户端接口
            import io.micronaut.http.client.annotation.Client;
            import io.micronaut.http.annotation.*;
            import io.reactivex.Single;

            @Client("https://api.github.com")
            public interface GithubClient {
                // 同步调用
                @Get("/users/{username}")
                User getUser(String username);

                // 异步调用(返回CompletableFuture)
                @Get("/repos/{owner}/{repo}")
                CompletableFuture<Repository> getRepositoryAsync(
                    String owner, String repo);

                // 响应式调用(返回Single)
                @Get("/users/{username}/repos")
                Single<List<Repository>> getUserRepos(String username);

                // POST请求
                @Post("/repos/{owner}/{repo}/issues")
                Issue createIssue(String owner, String repo, @Body IssueRequest issue);
            }

            // 注入并使用客户端
            @Singleton
            public class GithubService {
                private final GithubClient githubClient;

                public GithubService(GithubClient githubClient) {
                    this.githubClient = githubClient;
                }

                public User getUserInfo(String username) {
                    return githubClient.getUser(username);
                }
            }
            ---

04.配置管理
    a.多源配置支持
        a.配置来源
            Micronaut支持从多种来源加载配置,包括application.yml、环境变量、系统属性、配置中心等,并按优先级合并配置。
        b.配置示例
            ---
            // application.yml
            // datasource:
            //   url: jdbc:mysql://localhost:3306/mydb
            //   username: root
            //   password: secret
            //   pool:
            //     max-size: 10

            // 通过@ConfigurationProperties绑定配置
            import io.micronaut.context.annotation.ConfigurationProperties;

            @ConfigurationProperties("datasource")
            public class DataSourceConfig {
                private String url;
                private String username;
                private String password;
                private PoolConfig pool;

                // getter和setter省略

                @ConfigurationProperties("pool")
                public static class PoolConfig {
                    private int maxSize;
                    // getter和setter省略
                }
            }

            // 注入配置类
            @Singleton
            public class DatabaseService {
                private final DataSourceConfig config;

                public DatabaseService(DataSourceConfig config) {
                    this.config = config;
                    System.out.println("DB URL: " + config.getUrl());
                    System.out.println("Pool Size: " + config.getPool().getMaxSize());
                }
            }
            ---
    b.环境配置
        a.多环境支持
            Micronaut支持通过application-{env}.yml定义不同环境的配置,启动时通过micronaut.environments指定激活的环境。
        b.环境切换
            ---
            // application.yml(默认配置)
            // app:
            //   name: my-service
            //   version: 1.0

            // application-dev.yml(开发环境)
            // datasource:
            //   url: jdbc:h2:mem:devdb

            // application-prod.yml(生产环境)
            // datasource:
            //   url: jdbc:mysql://prod-server:3306/proddb

            // 启动时指定环境
            // java -Dmicronaut.environments=dev -jar app.jar
            // java -Dmicronaut.environments=prod -jar app.jar

            // 代码中获取当前环境
            import io.micronaut.context.env.Environment;

            @Singleton
            public class EnvironmentService {
                private final Environment environment;

                public EnvironmentService(Environment environment) {
                    this.environment = environment;
                }

                public void printActiveEnvironments() {
                    Set<String> activeNames = environment.getActiveNames();
                    System.out.println("Active environments: " + activeNames);
                }
            }
            ---

1.3 优缺点

01.优势
    a.启动速度快
        a.编译时优化
            通过编译时依赖注入和AOP代理生成,Micronaut消除了启动时的类扫描、反射分析和动态代理生成,启动速度比Spring Boot快5-10倍。
        b.性能测试
            ---
            // 启动时间对比测试(Hello World应用)
            // 测试环境:MacBook Pro M1, 16GB RAM, JDK 17

            // Spring Boot 2.7
            // 启动时间:2.5-3.5秒
            // 加载Bean数:150+

            // Micronaut 3.8
            // 启动时间:0.5-0.8秒
            // 加载Bean数:20+

            // 性能测试代码
            import io.micronaut.runtime.Micronaut;

            public class Application {
                public static void main(String[] args) {
                    long start = System.currentTimeMillis();
                    Micronaut.run(Application.class, args);
                    long end = System.currentTimeMillis();
                    System.out.println("启动耗时: " + (end - start) + "ms");
                }
            }
            ---
    b.内存占用低
        a.运行时内存优化
            Micronaut应用的堆内存占用通常只有Spring Boot应用的20-30%,这得益于编译时处理、避免反射和减少运行时元数据。
        b.内存监控
            ---
            // 内存占用监控代码
            import io.micronaut.scheduling.annotation.Scheduled;
            import jakarta.inject.Singleton;
            import java.lang.management.ManagementFactory;
            import java.lang.management.MemoryMXBean;

            @Singleton
            public class MemoryMonitor {
                private final MemoryMXBean memoryBean =
                    ManagementFactory.getMemoryMXBean();

                @Scheduled(fixedRate = "30s")
                public void printMemoryUsage() {
                    long heapUsed = memoryBean.getHeapMemoryUsage().getUsed() / 1024 / 1024;
                    long heapMax = memoryBean.getHeapMemoryUsage().getMax() / 1024 / 1024;
                    System.out.printf("堆内存使用: %dMB / %dMB%n", heapUsed, heapMax);
                }
            }

            // 典型内存占用(运行1小时后)
            // Spring Boot应用:堆内存 150-200MB
            // Micronaut应用:堆内存 30-50MB
            // 节省内存:70-80%
            ---
    c.GraalVM原生镜像支持
        a.原生编译优势
            Micronaut对GraalVM原生镜像提供一流支持,编译时处理的架构使得生成原生镜像更加容易,原生镜像启动时间可达毫秒级,内存占用进一步降低。
        b.原生镜像构建
            ---
            // Maven配置(pom.xml片段)
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
                <version>0.9.20</version>
                <configuration>
                    <imageName>micronaut-app</imageName>
                    <mainClass>com.example.Application</mainClass>
                    <buildArgs>
                        <arg>--no-fallback</arg>
                        <arg>--enable-http</arg>
                        <arg>--enable-https</arg>
                    </buildArgs>
                </configuration>
            </plugin>

            // 构建原生镜像
            // mvn clean package -Dpackaging=native-image

            // 原生镜像性能
            // 启动时间:20-50毫秒
            // RSS内存:15-25MB
            // 可执行文件大小:30-50MB
            // 适用场景:函数计算、容器化部署、边缘计算

            // Docker镜像大小对比
            // JVM应用 + OpenJDK:200-300MB
            // 原生镜像 + Alpine:50-80MB
            ---
    d.云原生设计
        a.服务发现与配置
            Micronaut内置支持Consul、Eureka等服务发现,以及多种配置中心,无需额外依赖即可实现微服务治理。
        b.分布式追踪
            ---
            // 集成Zipkin分布式追踪
            // application.yml
            // tracing:
            //   zipkin:
            //     enabled: true
            //     http:
            //       url: http://localhost:9411

            // 自动生成追踪数据,无需修改业务代码
            import io.micronaut.http.annotation.*;
            import jakarta.inject.Singleton;

            @Controller("/orders")
            public class OrderController {
                private final OrderService orderService;
                private final PaymentClient paymentClient;

                public OrderController(OrderService orderService,
                                     PaymentClient paymentClient) {
                    this.orderService = orderService;
                    this.paymentClient = paymentClient;
                }

                @Post
                public Order createOrder(@Body OrderRequest request) {
                    // 自动记录追踪信息,包括跨服务调用
                    Order order = orderService.create(request);
                    paymentClient.process(order.getId());
                    return order;
                }
            }
            ---

02.缺点
    a.生态不如Spring成熟
        a.社区规模
            Micronaut相对年轻(2018年发布),社区规模和第三方库数量远少于Spring生态,某些特定场景可能缺少现成的解决方案。
        b.学习资源
            官方文档完善,但中文资料、书籍和培训课程较少,遇到问题时可参考的案例有限。
    b.编译时间增加
        a.注解处理开销
            编译时依赖注入需要运行注解处理器,对于大型项目,首次编译和全量编译时间会明显增加。
        b.编译优化
            ---
            // Maven编译配置优化
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <source>17</source>
                            <target>17</target>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>io.micronaut</groupId>
                                    <artifactId>micronaut-inject-java</artifactId>
                                    <version>3.8.0</version>
                                </path>
                            </annotationProcessorPaths>
                            <compilerArgs>
                                <arg>-Amicronaut.processing.incremental=true</arg>
                                <arg>-Amicronaut.processing.annotations=com.example.*</arg>
                            </compilerArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

            // 增量编译可减少重复编译时间
            // 限制注解处理范围可加快编译速度
            ---
    c.动态特性受限
        a.反射限制
            由于编译时处理的特性,Micronaut对动态反射、动态类加载的支持有限,某些依赖反射的框架可能无法集成。
        b.GraalVM限制
            原生镜像编译对反射、动态代理、JNI有严格限制,需要提前配置reflection-config.json等元数据文件。
    d.学习曲线
        a.概念差异
            对于熟悉Spring的开发者,需要理解Micronaut编译时处理的思想,转变运行时反射的开发习惯。
        b.调试复杂度
            编译时生成的代码不直观,调试时需要查看生成的BeanDefinition类,增加了问题排查的难度。

1.4 使用场景

01.微服务架构
    a.服务间通信
        a.HTTP微服务
            Micronaut的快速启动和低内存占用特别适合微服务架构,每个服务可以独立部署、快速扩缩容,降低容器编排的资源开销。
        b.服务实现示例
            ---
            // 用户服务
            import io.micronaut.http.annotation.*;
            import jakarta.inject.Singleton;

            @Controller("/users")
            public class UserController {
                private final UserService userService;

                public UserController(UserService userService) {
                    this.userService = userService;
                }

                @Get("/{id}")
                public User getUser(Long id) {
                    return userService.findById(id);
                }

                @Post
                public User createUser(@Body UserRequest request) {
                    return userService.create(request);
                }
            }

            // 订单服务调用用户服务
            import io.micronaut.http.client.annotation.Client;

            @Client("user-service")  // 服务名称,通过服务发现解析
            public interface UserClient {
                @Get("/users/{id}")
                User getUser(Long id);
            }

            @Singleton
            public class OrderService {
                private final UserClient userClient;

                public OrderService(UserClient userClient) {
                    this.userClient = userClient;
                }

                public Order createOrder(Long userId, OrderRequest request) {
                    // 跨服务调用
                    User user = userClient.getUser(userId);
                    // 创建订单逻辑
                    return new Order(user, request);
                }
            }
            ---
    b.服务注册与发现
        a.Consul集成
            Micronaut原生支持Consul服务发现,服务启动时自动注册,其他服务通过服务名称进行调用。
        b.配置示例
            ---
            // application.yml
            // consul:
            //   client:
            //     registration:
            //       enabled: true
            //     defaultZone: "${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}"

            // 服务自动注册到Consul
            import io.micronaut.runtime.Micronaut;

            public class Application {
                public static void main(String[] args) {
                    // 启动时自动注册到Consul
                    Micronaut.run(Application.class, args);
                }
            }

            // 服务健康检查端点
            import io.micronaut.management.endpoint.health.HealthEndpoint;
            import io.micronaut.management.health.indicator.HealthResult;

            @Singleton
            public class CustomHealthIndicator implements HealthIndicator {
                @Override
                public Publisher<HealthResult> getResult() {
                    // 自定义健康检查逻辑
                    return Publishers.just(
                        HealthResult.builder("database").up().build()
                    );
                }
            }
            ---

02.无服务器Serverless应用
    a.AWS Lambda函数
        a.冷启动优化
            Micronaut的快速启动特性使其非常适合AWS Lambda等函数计算场景,可以将冷启动时间从数秒降低到毫秒级。
        b.Lambda函数实现
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.aws</groupId>
            //     <artifactId>micronaut-function-aws-api-proxy</artifactId>
            // </dependency>

            // Lambda处理器
            import io.micronaut.function.aws.proxy.MicronautLambdaHandler;

            public class LambdaHandler extends MicronautLambdaHandler {
                // Micronaut自动处理Lambda请求和响应
            }

            // HTTP控制器(与普通应用相同)
            @Controller("/api")
            public class ApiController {
                @Get("/hello")
                public String hello(@QueryValue String name) {
                    return "Hello " + name + " from Lambda!";
                }
            }

            // 性能指标
            // JVM模式冷启动:1-2秒
            // GraalVM原生镜像冷启动:50-200毫秒
            // 内存占用:128MB即可运行
            ---
    b.Azure Functions集成
        a.Azure Functions支持
            Micronaut提供Azure Functions适配器,可以将Micronaut应用部署为Azure Functions。
        b.实现示例
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.azure</groupId>
            //     <artifactId>micronaut-azure-function-http</artifactId>
            // </dependency>

            // Azure Functions入口
            import com.microsoft.azure.functions.*;
            import io.micronaut.azure.function.http.AzureHttpFunction;

            public class Function extends AzureHttpFunction {
                @FunctionName("hello")
                public HttpResponseMessage hello(
                    @HttpTrigger(name = "req", methods = {HttpMethod.GET},
                                 authLevel = AuthorizationLevel.ANONYMOUS)
                    HttpRequestMessage<Optional<String>> request,
                    ExecutionContext context) {
                    return super.route(request, context);
                }
            }
            ---

03.容器化与Kubernetes部署
    a.Docker容器化
        a.镜像优化
            Micronaut应用可以构建极小的Docker镜像,使用GraalVM原生镜像可以将镜像大小降低到50-80MB。
        b.Dockerfile示例
            ---
            // 多阶段构建Dockerfile
            FROM ghcr.io/graalvm/graalvm-ce:ol8-java17-22.3.0 AS builder

            WORKDIR /app
            COPY . .

            # 构建原生镜像
            RUN ./mvnw package -Dpackaging=native-image

            # 最终镜像使用Alpine Linux
            FROM alpine:3.17

            # 安装运行时依赖
            RUN apk --no-cache add ca-certificates

            WORKDIR /app
            COPY --from=builder /app/target/micronaut-app ./app

            # 暴露端口
            EXPOSE 8080

            # 启动应用
            ENTRYPOINT ["./app"]

            # 镜像大小对比
            # JVM应用 + OpenJDK:250-350MB
            # 原生镜像 + Alpine:50-80MB
            ---
    b.Kubernetes部署
        a.部署配置
            Micronaut应用的低资源占用使其可以在Kubernetes集群中高密度���署,降低基础设施成本。
        b.Kubernetes配置
            ---
            // k8s-deployment.yaml
            apiVersion: apps/v1
            kind: Deployment
            metadata:
              name: micronaut-app
            spec:
              replicas: 3
              selector:
                matchLabels:
                  app: micronaut-app
              template:
                metadata:
                  labels:
                    app: micronaut-app
                spec:
                  containers:
                  - name: app
                    image: myregistry/micronaut-app:1.0
                    ports:
                    - containerPort: 8080
                    resources:
                      requests:
                        memory: "64Mi"    # 最小64MB即可运行
                        cpu: "100m"
                      limits:
                        memory: "128Mi"
                        cpu: "500m"
                    livenessProbe:
                      httpGet:
                        path: /health
                        port: 8080
                      initialDelaySeconds: 5
                      periodSeconds: 10
                    readinessProbe:
                      httpGet:
                        path: /health/readiness
                        port: 8080
                      initialDelaySeconds: 5
                      periodSeconds: 5

            ---
            apiVersion: v1
            kind: Service
            metadata:
              name: micronaut-service
            spec:
              selector:
                app: micronaut-app
              ports:
              - protocol: TCP
                port: 80
                targetPort: 8080
              type: LoadBalancer
            ---

04.CLI工具与批处理
    a.命令行应用
        a.Picocli集成
            Micronaut集成Picocli框架,可以快速构建功能强大的命令行工具,启动速度快,适合频繁调用的脚本场景。
        b.CLI实现
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>info.picocli</groupId>
            //     <artifactId>picocli</artifactId>
            // </dependency>
            // <dependency>
            //     <groupId>io.micronaut.picocli</groupId>
            //     <artifactId>micronaut-picocli</artifactId>
            // </dependency>

            import picocli.CommandLine.*;
            import io.micronaut.configuration.picocli.PicocliRunner;

            @Command(name = "data-processor",
                     description = "处理数据文件",
                     mixinStandardHelpOptions = true)
            public class DataProcessorCommand implements Runnable {
                @Option(names = {"-i", "--input"},
                        description = "输入文件路径",
                        required = true)
                private String inputFile;

                @Option(names = {"-o", "--output"},
                        description = "输出文件路径",
                        required = true)
                private String outputFile;

                @Option(names = {"-f", "--format"},
                        description = "输出格式: JSON, XML, CSV",
                        defaultValue = "JSON")
                private String format;

                public static void main(String[] args) {
                    PicocliRunner.run(DataProcessorCommand.class, args);
                }

                @Override
                public void run() {
                    System.out.println("处理文件: " + inputFile);
                    System.out.println("输出格式: " + format);
                    // 实际处理逻辑
                }
            }

            // 使用示例
            // java -jar app.jar -i data.csv -o result.json -f JSON
            // 启动时间: 200-500ms(JVM模式)
            // 启动时间: 20-50ms(GraalVM原生镜像)
            ---
    b.定时任务
        a.调度支持
            Micronaut内置定时任务调度支持,适合批处理、数据同步等场景。
        b.定时任务示例
            ---
            import io.micronaut.scheduling.annotation.Scheduled;
            import jakarta.inject.Singleton;

            @Singleton
            public class DataSyncJob {
                private final DataService dataService;

                public DataSyncJob(DataService dataService) {
                    this.dataService = dataService;
                }

                // 每天凌晨2点执行
                @Scheduled(cron = "0 0 2 * * ?")
                public void syncData() {
                    System.out.println("开始数据同步...");
                    dataService.syncFromRemote();
                    System.out.println("数据同步完成");
                }

                // 每30秒执行一次
                @Scheduled(fixedRate = "30s")
                public void healthCheck() {
                    dataService.checkHealth();
                }

                // 初始延迟10秒,之后每1分钟执行
                @Scheduled(initialDelay = "10s", fixedDelay = "1m")
                public void cleanupCache() {
                    dataService.clearExpiredCache();
                }
            }
            ---

1.5 架构原理

01.编译时处理架构
    a.注解处理器流程
        a.编译期扫描
            Micronaut使用Java标准的注解处理器API(javax.annotation.processing),在编译期扫描源代码中的注解,生成元数据和辅助类。
        b.处理流程图
            ---
            // 编译时处理流程
            // 1. javac编译器启动
            // 2. 加载Micronaut注解处理器
            //    - BeanDefinitionInjectProcessor(处理依赖注入)
            //    - TypeElementVisitorProcessor(处理AOP)
            //    - ConfigurationMetadataProcessor(处理配置)
            // 3. 遍历源代码中的注解
            // 4. 生成BeanDefinition类
            // 5. 生成AOP代理类
            // 6. 生成配置元数据
            // 7. 输出到target/classes目录

            // 注解处理器配置(Maven)
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>io.micronaut</groupId>
                            <artifactId>micronaut-inject-java</artifactId>
                        </path>
                        <path>
                            <groupId>io.micronaut</groupId>
                            <artifactId>micronaut-validation</artifactId>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            ---
    b.BeanDefinition生成
        a.Bean元数据
            编译时为每个Bean生成一个BeanDefinition类,包含Bean的类型、作用域、依赖关系、生命周期回调等信息。
        b.生成代码示例
            ---
            // 源代码
            import jakarta.inject.Singleton;

            @Singleton
            public class EmailService {
                private final EmailConfig config;
                private final SmtpClient smtpClient;

                public EmailService(EmailConfig config, SmtpClient smtpClient) {
                    this.config = config;
                    this.smtpClient = smtpClient;
                }

                public void sendEmail(String to, String subject, String body) {
                    // 发送邮件逻辑
                }
            }

            // 编译后生成的BeanDefinition类(简化版)
            // $EmailService$Definition.java
            @Generated
            public class $EmailService$Definition
                extends AbstractInitializableBeanDefinition<EmailService>
                implements BeanFactory<EmailService> {

                // Bean的类型
                @Override
                public Class<EmailService> getBeanType() {
                    return EmailService.class;
                }

                // Bean的作用域
                @Override
                public Optional<Class<? extends Annotation>> getScope() {
                    return Optional.of(Singleton.class);
                }

                // 实例化Bean
                @Override
                public EmailService build(BeanResolutionContext context,
                                        BeanContext beanContext,
                                        BeanDefinition<EmailService> definition) {
                    // 解析依赖
                    EmailConfig config = (EmailConfig) beanContext
                        .getBean(EmailConfig.class);
                    SmtpClient smtpClient = (SmtpClient) beanContext
                        .getBean(SmtpClient.class);

                    // 直接调用构造器,无需反射
                    return new EmailService(config, smtpClient);
                }
            }
            ---

02.应用上下文初始化
    a.BeanContext加载
        a.上下文启动流程
            应用启动时,BeanContext加载所有编译期生成的BeanDefinition类,构建依赖关系图,按拓扑顺序实例化Bean。
        b.启动代码
            ---
            // Micronaut应用启动
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.runtime.Micronaut;

            public class Application {
                public static void main(String[] args) {
                    // 启动应用上下文
                    ApplicationContext context = Micronaut.run(Application.class, args);

                    // 获取Bean实例
                    EmailService emailService = context.getBean(EmailService.class);
                    emailService.sendEmail("user@example.com", "Test", "Hello");

                    // 关闭上下文
                    context.close();
                }
            }

            // 内部执行流程
            // 1. 加载配置文件(application.yml)
            // 2. 扫描并加载所有BeanDefinition类
            // 3. 解析Bean依赖关系
            // 4. 按依赖顺序实例化Bean
            // 5. 执行Bean的@PostConstruct方法
            // 6. 发布ApplicationStartedEvent事件
            ---
    b.Bean生命周期
        a.生命周期回调
            Micronaut支持JSR-250标准的@PostConstruct和@PreDestroy注解,以及Micronaut特有的生命周期接口。
        b.生命周期示例
            ---
            import jakarta.inject.Singleton;
            import jakarta.annotation.PostConstruct;
            import jakarta.annotation.PreDestroy;
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.context.event.StartupEvent;

            @Singleton
            public class DatabaseService implements
                ApplicationEventListener<StartupEvent> {

                private Connection connection;

                // 构造器注入
                public DatabaseService(DataSourceConfig config) {
                    System.out.println("1. 构造器执行");
                }

                // Bean初始化后执行
                @PostConstruct
                public void init() {
                    System.out.println("2. @PostConstruct执行");
                    connection = createConnection();
                }

                // 应用启动完成后执行
                @Override
                public void onApplicationEvent(StartupEvent event) {
                    System.out.println("3. StartupEvent触发");
                    // 执行启动后的初始化任务
                }

                // Bean销毁前执行
                @PreDestroy
                public void cleanup() {
                    System.out.println("4. @PreDestroy执行");
                    if (connection != null) {
                        connection.close();
                    }
                }

                private Connection createConnection() {
                    // 创建数据库连接
                    return null;
                }
            }
            ---

03.AOP代理实现
    a.编译时代理生成
        a.子类代理机制
            Micronaut在编译期为需要AOP的类生成子类代理,代理类重写被拦截的方法,插入拦截器调用逻辑。
        b.代理生成示例
            ---
            // 源代码:定义拦截器
            import io.micronaut.aop.MethodInterceptor;
            import io.micronaut.aop.MethodInvocationContext;

            @Singleton
            public class TimingInterceptor implements MethodInterceptor<Object, Object> {
                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    long start = System.nanoTime();
                    Object result = context.proceed();
                    long duration = System.nanoTime() - start;
                    System.out.println(context.getMethodName() + " 耗时: " +
                                     duration / 1_000_000 + "ms");
                    return result;
                }
            }

            // 定义拦截注解
            import io.micronaut.aop.Around;
            import java.lang.annotation.*;

            @Around
            @Type(TimingInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            public @interface Timed {
            }

            // 应用到服务类
            @Singleton
            public class ProductService {
                @Timed
                public Product findById(Long id) {
                    // 实际业务逻辑
                    return new Product(id, "Product " + id);
                }
            }

            // 编译后生成的代理类(简化版)
            // $ProductService$Intercepted.java
            @Generated
            public class $ProductService$Intercepted extends ProductService {
                private final ExecutableMethod<ProductService, Product> findByIdMethod;
                private final Interceptor<Product> timingInterceptor;

                @Override
                public Product findById(Long id) {
                    // 构建拦截器链
                    MethodInvocationContext<ProductService, Product> context =
                        new MethodInvocationContext<>(this, findByIdMethod,
                                                     new Object[]{id});

                    // 执行拦截器
                    return timingInterceptor.intercept(context);
                }
            }
            ---
    b.拦截器链执行
        a.拦截器顺序
            多个拦截器可以应用到同一个方法,Micronaut按照定义顺序构建拦截器链,依次执行。
        b.拦截器链示例
            ---
            // 定义多个拦截器
            @Around
            @Type(LoggingInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            public @interface Logged {
            }

            @Around
            @Type(CachingInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            public @interface Cached {
            }

            @Around
            @Type(TransactionalInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            public @interface Transactional {
            }

            // 应用多个拦截器
            @Singleton
            public class OrderService {
                @Logged         // 拦截器1:日志记录
                @Cached         // 拦截器2:缓存
                @Transactional  // 拦截器3:事务
                public Order findById(Long id) {
                    return orderRepository.findById(id);
                }
            }

            // 执行顺序
            // 1. LoggingInterceptor.before()
            // 2. CachingInterceptor.before()
            // 3. TransactionalInterceptor.before()
            // 4. 实际方法执行
            // 5. TransactionalInterceptor.after()
            // 6. CachingInterceptor.after()
            // 7. LoggingInterceptor.after()
            ---

04.模块化设计
    a.模块化架构
        a.核心模块
            Micronaut采用模块化设计,核心功能拆分为独立模块,应用可以按需引入依赖,减少不必要的代码。
        b.模块列表
            ---
            // 核心模块
            // micronaut-core:           核心依赖注入和AOP
            // micronaut-runtime:        应用运行时支持
            // micronaut-http:           HTTP服务器和客户端
            // micronaut-inject:         编译时依赖注入
            // micronaut-aop:            AOP支持

            // 数据访问模块
            // micronaut-data-jdbc:      JDBC支持
            // micronaut-data-jpa:       JPA支持
            // micronaut-data-r2dbc:     R2DBC响应式数据访问

            // 消息模块
            // micronaut-kafka:          Kafka集成
            // micronaut-rabbitmq:       RabbitMQ集成
            // micronaut-nats:           NATS集成

            // 云原生模块
            // micronaut-discovery-client: 服务发现客户端
            // micronaut-tracing:        分布式追踪
            // micronaut-metrics:        指标监控

            // Maven依赖示例(最小化应用)
            <dependencies>
                <dependency>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-runtime</artifactId>
                </dependency>
                <dependency>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-http-server-netty</artifactId>
                </dependency>
            </dependencies>
            ---
    b.扩展机制
        a.SPI机制
            Micronaut使用Java SPI(Service Provider Interface)机制实现插件式扩展,第三方库可以通过SPI注册自定义组件。
        b.自定义扩展
            ---
            // 定义扩展接口
            package io.micronaut.inject;

            public interface BeanDefinitionRegistry {
                void registerBeanDefinition(BeanDefinition<?> definition);
            }

            // 实现扩展
            package com.example.extension;

            public class CustomBeanRegistry implements BeanDefinitionRegistry {
                @Override
                public void registerBeanDefinition(BeanDefinition<?> definition) {
                    // 自定义Bean注册逻辑
                }
            }

            // SPI配置文件
            // src/main/resources/META-INF/services/io.micronaut.inject.BeanDefinitionRegistry
            // com.example.extension.CustomBeanRegistry

            // Micronaut启动时自动加载扩展
            ---

1.6 依赖注入特性

01.编译时依赖注入
    a.零反射实现
        a.编译期代码生成
            Micronaut在编译期生成所有依赖注入相关代码,运行时不需要通过反射扫描类路径、读取注解或动态创建代理对象,实现了真正的零反射依赖注入。
        b.性能对比
            ---
            // Spring Framework依赖注入(运行时反射)
            // 1. 启动时扫描类路径
            // 2. 使用反射读取@Component、@Service等注解
            // 3. 使用反射调用构造器创建Bean
            // 4. 使用反射设置字段值
            // 启动开销:2-5秒,内存开销:150-300MB

            // Micronaut依赖注入(编译时生成)
            // 1. 编译期生成BeanDefinition类
            // 2. 运行时直接加载BeanDefinition
            // 3. 直接调用构造器(无反射)
            // 4. 直接设置字段值(无反射)
            // 启动开销:0.5-1秒,内存开销:20-50MB

            // 示例:编译时生成的代码
            @Generated
            public class $UserService$Definition
                extends AbstractBeanDefinition<UserService> {

                @Override
                public UserService build(BeanContext context) {
                    // 直接调用构造器,无需反射
                    UserRepository repo = context.getBean(UserRepository.class);
                    return new UserService(repo);
                }
            }
            ---
    b.类型安全
        a.编译期类型检查
            由于依赖关系在编译期确定,编译器可以提前发现类型不匹配、循环依赖等问题,避免运行时错误。
        b.类型安全示例
            ---
            // 定义服务接口和实现
            public interface NotificationService {
                void send(String message);
            }

            @Singleton
            public class EmailNotificationService implements NotificationService {
                @Override
                public void send(String message) {
                    System.out.println("Email: " + message);
                }
            }

            @Singleton
            public class SmsNotificationService implements NotificationService {
                @Override
                public void send(String message) {
                    System.out.println("SMS: " + message);
                }
            }

            // 注入时指定类型
            @Singleton
            public class OrderService {
                private final NotificationService emailService;
                private final NotificationService smsService;

                public OrderService(
                    @Named("emailNotificationService") NotificationService emailService,
                    @Named("smsNotificationService") NotificationService smsService) {
                    this.emailService = emailService;
                    this.smsService = smsService;
                }

                public void placeOrder(Order order) {
                    emailService.send("订单已创建: " + order.getId());
                    smsService.send("订单已创建: " + order.getId());
                }
            }

            // 编译期会检查:
            // 1. NotificationService类型是否存在
            // 2. emailNotificationService和smsNotificationService是否存在
            // 3. 类型是否匹配
            // 如有错误,编译失败,避免运行时问题
            ---

02.注入方式
    a.构造器注入
        a.推荐方式
            构造器注入是Micronaut推荐的注入方式,保证了Bean的不可变性,所有依赖在对象创建时就已确定。
        b.构造器注入示例
            ---
            import jakarta.inject.Singleton;

            @Singleton
            public class PaymentService {
                private final PaymentGateway gateway;
                private final PaymentValidator validator;
                private final AuditLogger logger;

                // 构造器注入(@Inject可选,单构造器时自动注入)
                public PaymentService(PaymentGateway gateway,
                                    PaymentValidator validator,
                                    AuditLogger logger) {
                    this.gateway = gateway;
                    this.validator = validator;
                    this.logger = logger;
                }

                public PaymentResult processPayment(PaymentRequest request) {
                    logger.log("开始支付: " + request.getAmount());
                    if (!validator.validate(request)) {
                        return PaymentResult.invalid();
                    }
                    return gateway.charge(request);
                }
            }

            // 优点:
            // 1. 依赖明确,一目了然
            // 2. 字段可以声明为final,保证不可变
            // 3. 便于单元测试,直接new对象传入mock依赖
            // 4. 编译器可以检查依赖完整性
            ---
    b.字段注入
        a.字段注入语法
            Micronaut支持通过@Inject注解直接注入字段,但不推荐使用,因为会破坏封装性,且不利于测试。
        b.字段注入示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class ReportService {
                // 字段注入
                @Inject
                private ReportGenerator generator;

                @Inject
                private DataSource dataSource;

                public Report generate(String type) {
                    return generator.generate(dataSource, type);
                }
            }

            // 缺点:
            // 1. 字段不能声明为final
            // 2. 依赖不明确,需要查看字段定义
            // 3. 单元测试困难,无法直接new对象
            // 4. 可能出现NullPointerException
            ---
    c.方法注入
        a.Setter注入
            通过@Inject标记setter方法实现注入,适合可选依赖或需要重新配置的场景。
        b.方法注入示例
            ---
            import jakarta.inject.Singleton;
            import jakarta.inject.Inject;

            @Singleton
            public class CacheService {
                private final CacheStore primaryStore;
                private CacheStore secondaryStore;  // 可选依赖

                public CacheService(CacheStore primaryStore) {
                    this.primaryStore = primaryStore;
                }

                // 方法注入(可选依赖)
                @Inject
                public void setSecondaryStore(
                    @jakarta.annotation.Nullable CacheStore secondaryStore) {
                    this.secondaryStore = secondaryStore;
                }

                public void put(String key, Object value) {
                    primaryStore.put(key, value);
                    if (secondaryStore != null) {
                        secondaryStore.put(key, value);  // 双写
                    }
                }
            }
            ---

03.作用域管理
    a.Singleton单例
        a.单例作用域
            @Singleton注解标记的Bean在整个应用生命周期内只创建一次,所有注入点共享同一个实例。
        b.单例示例
            ---
            import jakarta.inject.Singleton;
            import java.util.concurrent.atomic.AtomicLong;

            @Singleton
            public class RequestCounter {
                private final AtomicLong counter = new AtomicLong(0);

                public long increment() {
                    return counter.incrementAndGet();
                }

                public long getCount() {
                    return counter.get();
                }
            }

            // 任何地方注入的都是同一个实例
            @Controller("/api")
            public class ApiController {
                private final RequestCounter counter;

                public ApiController(RequestCounter counter) {
                    this.counter = counter;
                }

                @Get("/count")
                public long getRequestCount() {
                    return counter.getCount();
                }
            }

            @Controller("/admin")
            public class AdminController {
                private final RequestCounter counter;  // 同一个实例

                public AdminController(RequestCounter counter) {
                    this.counter = counter;
                }
            }
            ---
    b.Prototype原型
        a.原型作用域
            @Prototype注解标记的Bean每次注入时都会创建新实例,适合有状态的对象。
        b.原型示例
            ---
            import io.micronaut.context.annotation.Prototype;

            @Prototype
            public class OrderProcessor {
                private Order currentOrder;
                private ProcessingState state;

                public void process(Order order) {
                    this.currentOrder = order;
                    this.state = ProcessingState.PROCESSING;
                    // 处理订单逻辑
                }

                public ProcessingState getState() {
                    return state;
                }
            }

            // 每次注入都创建新实例
            @Singleton
            public class OrderService {
                private final BeanContext beanContext;

                public OrderService(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void handleOrder(Order order) {
                    // 每次获取新实例
                    OrderProcessor processor =
                        beanContext.getBean(OrderProcessor.class);
                    processor.process(order);
                }
            }
            ---
    c.RequestScope请求作用域
        a.请求作用域
            @RequestScope注解标记的Bean在每个HTTP请求范围内是单例,请求结束后销毁。
        b.请求作用域示例
            ---
            import io.micronaut.runtime.http.scope.RequestScope;

            @RequestScope
            public class RequestContext {
                private String requestId;
                private String userId;
                private long startTime;

                public RequestContext() {
                    this.requestId = UUID.randomUUID().toString();
                    this.startTime = System.currentTimeMillis();
                }

                public String getRequestId() {
                    return requestId;
                }

                public void setUserId(String userId) {
                    this.userId = userId;
                }

                public long getElapsedTime() {
                    return System.currentTimeMillis() - startTime;
                }
            }

            // 在同一请求中共享RequestContext
            @Controller("/api")
            public class UserController {
                private final RequestContext context;

                public UserController(RequestContext context) {
                    this.context = context;
                }

                @Get("/user")
                public User getUser() {
                    System.out.println("Request ID: " + context.getRequestId());
                    return userService.findById(context.getUserId());
                }
            }
            ---

04.条件化Bean
    a.条件注入
        a.@Requires注解
            Micronaut提供@Requires注解实现条件化Bean注册,根据配置、环境、类路径等条件决定是否创建Bean。
        b.条件注入示例
            ---
            import io.micronaut.context.annotation.Requires;
            import jakarta.inject.Singleton;

            // 仅当配置属性存在且为true时创建
            @Singleton
            @Requires(property = "redis.enabled", value = "true")
            public class RedisCacheService implements CacheService {
                @Override
                public void put(String key, Object value) {
                    // Redis缓存实现
                }
            }

            // 仅当Redis不启用时创建
            @Singleton
            @Requires(property = "redis.enabled", value = "false", defaultValue = "false")
            public class InMemoryCacheService implements CacheService {
                @Override
                public void put(String key, Object value) {
                    // 内存缓存实现
                }
            }

            // 仅当类路径存在指定类时创建
            @Singleton
            @Requires(classes = com.mysql.cj.jdbc.Driver.class)
            public class MySQLDataSource implements DataSource {
                // MySQL数据源实现
            }

            // 仅在特定环境下创建
            @Singleton
            @Requires(env = "dev")
            public class MockPaymentGateway implements PaymentGateway {
                @Override
                public PaymentResult charge(PaymentRequest request) {
                    return PaymentResult.success();  // Mock实现
                }
            }
            ---
    b.Primary与Replaces
        a.Primary首选Bean
            @Primary注解标记首选Bean,当有多个同类型Bean时优先注入标记为Primary的。
        b.Primary示例
            ---
            import io.micronaut.context.annotation.Primary;

            public interface MessageSender {
                void send(String message);
            }

            @Singleton
            @Primary  // 标记为首选
            public class EmailSender implements MessageSender {
                @Override
                public void send(String message) {
                    System.out.println("Email: " + message);
                }
            }

            @Singleton
            public class SmsSender implements MessageSender {
                @Override
                public void send(String message) {
                    System.out.println("SMS: " + message);
                }
            }

            // 不指定名称时注入Primary Bean
            @Singleton
            public class NotificationService {
                private final MessageSender sender;  // 注入EmailSender

                public NotificationService(MessageSender sender) {
                    this.sender = sender;
                }
            }

            // Replaces注解替换Bean定义
            @Singleton
            @Replaces(EmailSender.class)  // 替换EmailSender
            public class MockEmailSender implements MessageSender {
                @Override
                public void send(String message) {
                    System.out.println("Mock Email: " + message);
                }
            }
            ---

1.7 编译时优化

01.性能优化策略
    a.消除反射开销
        a.反射性能损耗
            Java反射机制虽然灵活,但存在显著的性能开销,包括类型检查、安全检查、参数装箱拆箱等,Micronaut通过编译时代码生成完全避免了这些开销。
        b.性能对比测试
            ---
            // 性能测试代码
            import org.openjdk.jmh.annotations.*;
            import java.util.concurrent.TimeUnit;

            @BenchmarkMode(Mode.AverageTime)
            @OutputTimeUnit(TimeUnit.NANOSECONDS)
            @Warmup(iterations = 5, time = 1)
            @Measurement(iterations = 10, time = 1)
            @Fork(1)
            @State(Scope.Benchmark)
            public class InjectionBenchmark {

                // 反射方式创建对象
                @Benchmark
                public Object reflectionInjection() throws Exception {
                    Class<?> clazz = UserService.class;
                    Constructor<?> constructor = clazz.getConstructor(UserRepository.class);
                    UserRepository repo = new UserRepositoryImpl();
                    return constructor.newInstance(repo);
                }

                // 直接调用构造器
                @Benchmark
                public Object directInjection() {
                    UserRepository repo = new UserRepositoryImpl();
                    return new UserService(repo);
                }

                // Micronaut方式(编译时生成)
                @Benchmark
                public Object micronautInjection() {
                    BeanContext context = BeanContext.run();
                    return context.getBean(UserService.class);
                }
            }

            // 测试结果(纳秒级)
            // reflectionInjection:   5000-8000 ns/op
            // directInjection:       10-20 ns/op
            // micronautInjection:    15-30 ns/op
            // Micronaut性能接近直接调用,比反射快200-400倍
            ---
    b.启动时间优化
        a.启动流程简化
            Micronaut启动时无需扫描类路径、解析注解、构建依赖图,所有元数据在编译期已生成,启动流程大幅简化。
        b.启动时间分析
            ---
            // 启动时间监控
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.context.event.StartupEvent;
            import io.micronaut.runtime.event.ApplicationStartupEvent;
            import jakarta.inject.Singleton;

            @Singleton
            public class StartupTimer implements
                ApplicationEventListener<ApplicationStartupEvent> {

                private long startTime;

                public StartupTimer() {
                    this.startTime = System.currentTimeMillis();
                }

                @Override
                public void onApplicationEvent(ApplicationStartupEvent event) {
                    long elapsed = System.currentTimeMillis() - startTime;
                    System.out.println("应用启动耗时: " + elapsed + "ms");

                    // 打印启动阶段耗时
                    ApplicationContext context = event.getSource();
                    System.out.println("Bean数量: " + context.getBeanDefinitions().size());
                }
            }

            // 启动时间对比(50个Bean的应用)
            // Spring Boot:      2000-3000ms
            // Micronaut JVM:    500-800ms
            // Micronaut Native: 20-50ms
            ---

02.编译时代码生成
    a.BeanIntrospection
        a.内省机制
            Micronaut提供编译时Bean内省(BeanIntrospection),无需反射即可读写Bean属性,适用于序列化、验证等场景。
        b.内省示例
            ---
            import io.micronaut.core.annotation.Introspected;

            // 标记为可内省
            @Introspected
            public class User {
                private Long id;
                private String username;
                private String email;

                // getter和setter
                public Long getId() { return id; }
                public void setId(Long id) { this.id = id; }

                public String getUsername() { return username; }
                public void setUsername(String username) { this.username = username; }

                public String getEmail() { return email; }
                public void setEmail(String email) { this.email = email; }
            }

            // 编译时生成$User$Introspection类
            // 使用内省API操作Bean
            import io.micronaut.core.beans.BeanIntrospection;
            import io.micronaut.core.beans.BeanProperty;

            public class IntrospectionExample {
                public static void main(String[] args) {
                    // 获取内省信息(无反射)
                    BeanIntrospection<User> introspection =
                        BeanIntrospection.getIntrospection(User.class);

                    // 创建实例(无反射)
                    User user = introspection.instantiate();

                    // 获取属性(无反射)
                    BeanProperty<User, String> usernameProperty =
                        introspection.getRequiredProperty("username", String.class);

                    // 设置属性值(无反射)
                    usernameProperty.set(user, "john_doe");

                    // 获取属性值(无反射)
                    String username = usernameProperty.get(user);
                    System.out.println("Username: " + username);

                    // 遍历所有属性
                    introspection.getBeanProperties().forEach(property -> {
                        System.out.println(property.getName() + ": " +
                                         property.get(user));
                    });
                }
            }
            ---
    b.配置属性绑定
        a.编译时绑定
            @ConfigurationProperties注解标记的类在编译期生成配置绑定代码,运行时直接加载配置值,无需反射。
        b.配置绑定示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import io.micronaut.core.annotation.Nullable;
            import jakarta.validation.constraints.*;

            @ConfigurationProperties("database")
            public class DatabaseConfig {
                @NotBlank
                private String url;

                @NotBlank
                private String username;

                @NotBlank
                private String password;

                @Min(1)
                @Max(100)
                private int poolSize = 10;

                @Nullable
                private Duration connectionTimeout;

                // getter和setter省略
            }

            // application.yml
            // database:
            //   url: jdbc:mysql://localhost:3306/mydb
            //   username: root
            //   password: secret
            //   pool-size: 20
            //   connection-timeout: 30s

            // 编译时生成$DatabaseConfig$Definition类
            // 包含配置路径映射、类型转换、验证规则
            @Generated
            public class $DatabaseConfig$Definition {
                public void inject(BeanContext context, DatabaseConfig bean) {
                    // 编译时生成的配置注入代码
                    Environment env = context.getEnvironment();
                    bean.setUrl(env.getProperty("database.url", String.class).get());
                    bean.setUsername(env.getProperty("database.username", String.class).get());
                    bean.setPassword(env.getProperty("database.password", String.class).get());
                    bean.setPoolSize(env.getProperty("database.pool-size", Integer.class).orElse(10));
                    bean.setConnectionTimeout(
                        env.getProperty("database.connection-timeout", Duration.class).orElse(null));
                }
            }
            ---

03.元数据生成
    a.注解元数据
        a.元数据提取
            Micronaut在编译期提取注解信息,生成AnnotationMetadata,运行时直接读取,避免反射解析注解。
        b.元数据使用
            ---
            import io.micronaut.core.annotation.AnnotationMetadata;
            import io.micronaut.inject.BeanDefinition;

            @Singleton
            public class MetadataInspector {
                private final BeanContext beanContext;

                public MetadataInspector(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void inspectBean(Class<?> beanClass) {
                    // 获取Bean定义(编译时生成)
                    BeanDefinition<?> definition =
                        beanContext.getBeanDefinition(beanClass);

                    // 获取注解元数据(编译时提取)
                    AnnotationMetadata metadata = definition.getAnnotationMetadata();

                    // 检查注解(无反射)
                    if (metadata.hasAnnotation(Controller.class)) {
                        String value = metadata.stringValue(Controller.class).orElse("/");
                        System.out.println("Controller路径: " + value);
                    }

                    // 获取所有注解
                    metadata.getAnnotationNames().forEach(annotation -> {
                        System.out.println("注解: " + annotation);
                    });
                }
            }
            ---
    b.类型元数据
        a.泛型信息保留
            Micronaut在编译期保留完整的泛型类型信息,运行时可以准确获取泛型参数类型。
        b.泛型处理示例
            ---
            import io.micronaut.core.type.Argument;
            import io.micronaut.http.client.HttpClient;
            import io.micronaut.http.client.annotation.Client;

            @Singleton
            public class GenericClient {
                @Client("https://api.example.com")
                private HttpClient httpClient;

                // 泛型方法
                public <T> T get(String path, Class<T> responseType) {
                    // Micronaut保留了泛型类型信息
                    return httpClient.toBlocking().retrieve(path, responseType);
                }

                // 复杂泛型类型
                public <T> List<T> getList(String path, Class<T> elementType) {
                    // 构造List<T>类型
                    Argument<List<T>> argument =
                        Argument.listOf(elementType);

                    return httpClient.toBlocking().retrieve(path, argument);
                }
            }

            // 使用示例
            @Singleton
            public class UserService {
                private final GenericClient client;

                public UserService(GenericClient client) {
                    this.client = client;
                }

                public User getUser(Long id) {
                    // 泛型类型精确匹配
                    return client.get("/users/" + id, User.class);
                }

                public List<User> getAllUsers() {
                    // 泛型集合类型精确匹配
                    return client.getList("/users", User.class);
                }
            }
            ---

04.构建时优化选项
    a.增量编译
        a.增量编译支持
            Micronaut支持增量编译,仅重新处理修改的源文件,大幅减少开发时的编译时间。
        b.增量编译配置
            ---
            // Maven配置
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                    <compilerArgs>
                        <!-- 启用增量编译 -->
                        <arg>-Amicronaut.processing.incremental=true</arg>
                        <!-- 启用增量隔离模式 -->
                        <arg>-Amicronaut.processing.incremental.isolating=true</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            // Gradle配置
            tasks.withType(JavaCompile) {
                options.fork = true
                options.forkOptions.jvmArgs << '-Dmicronaut.processing.incremental=true'
                options.compilerArgs << '-Amicronaut.processing.incremental=true'
            }

            // 增量编译效果
            // 首次编译:30-60秒
            // 修改单个文件后编译:2-5秒
            // 提升:85-90%
            ---
    b.注解处理器优化
        a.处理范围限制
            可以限制注解处理器的扫描范围,仅处理特定包下的类,加快编译速度。
        b.范围限制配置
            ---
            // Maven配置
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <!-- 限制处理范围到com.example包 -->
                        <arg>-Amicronaut.processing.annotations=com.example.*</arg>
                        <!-- 排除测试包 -->
                        <arg>-Amicronaut.processing.exclude=com.example.test.*</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            // 效果
            // 扫描范围缩小:编译时间减少20-40%
            // 生成代码减少:应用体积减小10-20%
            ---
    c.编译时验证
        a.循环依赖检测
            Micronaut在编译期检测Bean之间的循环依赖,提前发现问题,避免运行时错误。
        b.验证示例
            ---
            // 循环依赖示例
            @Singleton
            public class ServiceA {
                private final ServiceB serviceB;

                public ServiceA(ServiceB serviceB) {  // 依赖ServiceB
                    this.serviceB = serviceB;
                }
            }

            @Singleton
            public class ServiceB {
                private final ServiceA serviceA;

                public ServiceB(ServiceA serviceA) {  // 依赖ServiceA
                    this.serviceA = serviceA;
                }
            }

            // 编译时报错
            // Error: Circular dependency detected:
            //   ServiceA -> ServiceB -> ServiceA
            // 解决方法:使用Provider延迟注入
            @Singleton
            public class ServiceA {
                private final Provider<ServiceB> serviceB;

                public ServiceA(Provider<ServiceB> serviceB) {
                    this.serviceB = serviceB;
                }

                public void doSomething() {
                    serviceB.get().process();  // 延迟获取
                }
            }
            ---

1.8 云原生支持

01.容器化支持
    a.Docker镜像优化
        a.分层构建
            Micronaut应用支持Docker多阶段构建,可以生成极小的镜像,特别是使用GraalVM原生镜像时,镜像大小可降至50-80MB。
        b.镜像构建实践
            ---
            // JVM模式Dockerfile
            FROM eclipse-temurin:17-jre-alpine
            WORKDIR /app
            COPY target/micronaut-app-*.jar app.jar
            EXPOSE 8080
            ENTRYPOINT ["java", "-jar", "app.jar"]

            // 镜像大小:150-200MB
            // 启动时间:1-2秒
            // 内存占用:50-100MB

            // GraalVM原生镜像Dockerfile
            FROM ghcr.io/graalvm/graalvm-ce:ol8-java17-22 AS builder
            WORKDIR /app
            COPY . .
            RUN ./mvnw package -Dpackaging=native-image

            FROM alpine:3.17
            RUN apk --no-cache add ca-certificates
            WORKDIR /app
            COPY --from=builder /app/target/micronaut-app ./app
            EXPOSE 8080
            ENTRYPOINT ["./app"]

            // 镜像大小:50-80MB
            // 启动时间:20-50ms
            // 内存占用:20-40MB

            // Jib插件构建(无需Docker)
            // pom.xml
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <to>
                        <image>myregistry/micronaut-app:latest</image>
                    </to>
                    <container>
                        <jvmFlags>
                            <jvmFlag>-Xms64m</jvmFlag>
                            <jvmFlag>-Xmx128m</jvmFlag>
                        </jvmFlags>
                        <ports>
                            <port>8080</port>
                        </ports>
                    </container>
                </configuration>
            </plugin>

            // 构建命令:mvn compile jib:build
            // 优点:不需要Docker daemon,构建速度快,镜像分层优化
            ---
    b.健康检查与就绪探测
        a.健康检查端点
            Micronaut内置health端点,支持Kubernetes的liveness和readiness探测。
        b.健康检查配置
            ---
            // application.yml
            // endpoints:
            //   health:
            //     enabled: true
            //     sensitive: false
            //   info:
            //     enabled: true

            // 自定义健康指示器
            import io.micronaut.management.health.indicator.HealthIndicator;
            import io.micronaut.management.health.indicator.HealthResult;
            import jakarta.inject.Singleton;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Mono;

            @Singleton
            public class DatabaseHealthIndicator implements HealthIndicator {
                private final DataSource dataSource;

                public DatabaseHealthIndicator(DataSource dataSource) {
                    this.dataSource = dataSource;
                }

                @Override
                public Publisher<HealthResult> getResult() {
                    return Mono.fromCallable(() -> {
                        try (Connection conn = dataSource.getConnection()) {
                            boolean isValid = conn.isValid(2);
                            if (isValid) {
                                return HealthResult.builder("database")
                                    .status(HealthStatus.UP)
                                    .details(Map.of("connection", "active"))
                                    .build();
                            } else {
                                return HealthResult.builder("database")
                                    .status(HealthStatus.DOWN)
                                    .details(Map.of("connection", "invalid"))
                                    .build();
                            }
                        } catch (Exception e) {
                            return HealthResult.builder("database")
                                .status(HealthStatus.DOWN)
                                .exception(e)
                                .build();
                        }
                    });
                }
            }

            // Kubernetes配置
            // livenessProbe:
            //   httpGet:
            //     path: /health
            //     port: 8080
            //   initialDelaySeconds: 5
            //   periodSeconds: 10
            // readinessProbe:
            //   httpGet:
            //     path: /health/readiness
            //     port: 8080
            //   initialDelaySeconds: 5
            //   periodSeconds: 5
            ---

02.服务发现
    a.Consul集成
        a.服务注册
            Micronaut原生支持Consul服务发现,应用启动时自动注册到Consul,关闭时自动注销。
        b.Consul配置
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.discovery</groupId>
            //     <artifactId>micronaut-discovery-client</artifactId>
            // </dependency>

            // application.yml
            // consul:
            //   client:
            //     registration:
            //       enabled: true
            //     defaultZone: "${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}"
            //     health-path: /health
            // micronaut:
            //   application:
            //     name: user-service

            // 服务自动注册
            import io.micronaut.runtime.Micronaut;

            public class Application {
                public static void main(String[] args) {
                    // 启动时自动注册到Consul
                    // 注册信息包括:服务名、IP、端口、健康检查路径
                    Micronaut.run(Application.class, args);
                }
            }

            // 服务调用(通过服务名)
            import io.micronaut.http.client.annotation.Client;

            @Client("user-service")  // 通过Consul解析服务地址
            public interface UserClient {
                @Get("/users/{id}")
                User getUser(Long id);
            }

            // 负载均衡(客户端负载均衡)
            // consul:
            //   client:
            //     load-balancer:
            //       enabled: true
            //       strategy: round-robin  # 轮询策略
            ---
    b.Eureka集成
        a.Eureka支持
            Micronaut也支持Netflix Eureka服务注册与发现,兼容Spring Cloud生态。
        b.Eureka配置
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.discovery</groupId>
            //     <artifactId>micronaut-discovery-client</artifactId>
            // </dependency>

            // application.yml
            // eureka:
            //   client:
            //     registration:
            //       enabled: true
            //     defaultZone: "${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka"
            //     health-check-url: http://${micronaut.server.host}:${micronaut.server.port}/health

            // 服务调用示例
            @Singleton
            public class OrderService {
                @Client("order-service")
                private OrderClient orderClient;

                public Order getOrder(Long id) {
                    return orderClient.findById(id);
                }
            }
            ---

03.配置中心
    a.Consul配置中心
        a.分布式配置
            Micronaut支持从Consul KV存储读取配置,实现配置集中管理和动态更新。
        b.配置中心示例
            ---
            // application.yml
            // consul:
            //   client:
            //     config:
            //       enabled: true
            //       format: YAML  # 配置格式:YAML、JSON、PROPERTIES
            // micronaut:
            //   application:
            //     name: order-service
            //   config-client:
            //     enabled: true

            // Consul KV存储结构
            // config/
            //   application/        # 全局配置
            //     data              # database.url=jdbc:mysql://...
            //   order-service/      # 应用特定配置
            //     data              # order.max-items=100
            //   order-service,prod/ # 环境特定配置
            //     data              # database.url=jdbc:mysql://prod-db/...

            // 配置类
            import io.micronaut.context.annotation.ConfigurationProperties;
            import io.micronaut.context.annotation.Refreshable;

            @ConfigurationProperties("order")
            @Refreshable  // 支持配置动态刷新
            public class OrderConfig {
                private int maxItems;
                private Duration timeout;

                // getter和setter
            }

            // 配置刷新
            // POST /refresh
            // 触发配置重新加载,标记@Refreshable的Bean会重新创建
            ---
    b.Kubernetes ConfigMap
        a.ConfigMap集成
            Micronaut支持从Kubernetes ConfigMap和Secret读取配置,适合云原生部署。
        b.ConfigMap配置
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.kubernetes</groupId>
            //     <artifactId>micronaut-kubernetes-discovery-client</artifactId>
            // </dependency>

            // application.yml
            // kubernetes:
            //   client:
            //     config-maps:
            //       enabled: true
            //       paths:
            //         - /etc/config/app-config
            //     secrets:
            //       enabled: true
            //       paths:
            //         - /etc/secret/db-credentials

            // Kubernetes ConfigMap
            apiVersion: v1
            kind: ConfigMap
            metadata:
              name: app-config
            data:
              application.yml: |
                datasource:
                  url: jdbc:postgresql://postgres:5432/mydb
                  pool-size: 20

            // Kubernetes Secret
            apiVersion: v1
            kind: Secret
            metadata:
              name: db-credentials
            type: Opaque
            data:
              username: YWRtaW4=  # base64编码
              password: cGFzc3dvcmQ=

            // Deployment挂载ConfigMap和Secret
            apiVersion: apps/v1
            kind: Deployment
            spec:
              template:
                spec:
                  containers:
                  - name: app
                    volumeMounts:
                    - name: config
                      mountPath: /etc/config
                    - name: secret
                      mountPath: /etc/secret
                  volumes:
                  - name: config
                    configMap:
                      name: app-config
                  - name: secret
                    secret:
                      secretName: db-credentials
            ---

04.可观测性
    a.分布式追踪
        a.Zipkin集成
            Micronaut内置Zipkin追踪支持,自动为HTTP请求生成追踪信息,无需修改业务代码。
        b.追踪配置
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.tracing</groupId>
            //     <artifactId>micronaut-tracing-zipkin</artifactId>
            // </dependency>

            // application.yml
            // tracing:
            //   zipkin:
            //     enabled: true
            //     http:
            //       url: http://zipkin:9411
            //     sampler:
            //       probability: 1.0  # 采样率100%

            // 自动追踪HTTP请求
            @Controller("/orders")
            public class OrderController {
                @Inject
                private PaymentClient paymentClient;

                @Post
                public Order createOrder(@Body OrderRequest request) {
                    // Micronaut自动生成追踪ID并传播到下游服务
                    PaymentResult result = paymentClient.charge(request);
                    return orderService.create(request, result);
                }
            }

            // 自定义追踪
            import io.micronaut.tracing.annotation.NewSpan;
            import io.micronaut.tracing.annotation.SpanTag;

            @Singleton
            public class InventoryService {
                @NewSpan("check-inventory")
                public boolean checkStock(
                    @SpanTag("product-id") Long productId,
                    @SpanTag("quantity") int quantity) {
                    // 该方法会生成独立的追踪span
                    return inventoryRepository.getStock(productId) >= quantity;
                }
            }
            ---
    b.指标监控
        a.Micrometer集成
            Micronaut集成Micrometer指标库,支持Prometheus、InfluxDB等多种监控系统。
        b.监控配置
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.micrometer</groupId>
            //     <artifactId>micronaut-micrometer-registry-prometheus</artifactId>
            // </dependency>

            // application.yml
            // micronaut:
            //   metrics:
            //     enabled: true
            //     export:
            //       prometheus:
            //         enabled: true
            //         step: PT1M
            //         descriptions: true

            // 自动暴露/prometheus端点
            // 访问 http://localhost:8080/prometheus 获取指标

            // 自定义指标
            import io.micrometer.core.instrument.MeterRegistry;
            import io.micrometer.core.instrument.Counter;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderMetrics {
                private final Counter orderCounter;
                private final Timer orderProcessingTimer;

                public OrderMetrics(MeterRegistry registry) {
                    this.orderCounter = Counter.builder("orders.created")
                        .description("订单创建总数")
                        .tag("type", "online")
                        .register(registry);

                    this.orderProcessingTimer = Timer.builder("orders.processing.time")
                        .description("订单处理耗时")
                        .register(registry);
                }

                public void recordOrderCreated() {
                    orderCounter.increment();
                }

                public void recordProcessingTime(Runnable task) {
                    orderProcessingTimer.record(task);
                }
            }

            // Kubernetes ServiceMonitor(Prometheus Operator)
            apiVersion: monitoring.coreos.com/v1
            kind: ServiceMonitor
            metadata:
              name: micronaut-app
            spec:
              selector:
                matchLabels:
                  app: micronaut-app
              endpoints:
              - port: http
                path: /prometheus
                interval: 30s
            ---
    c.日志聚合
        a.结构化日志
            Micronaut支持结构化日志输出,便于日志采集和分析系统处理。
        b.日志配置
            ---
            // logback.xml
            <configuration>
                <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                    <encoder class="net.logstash.logback.encoder.LogstashEncoder">
                        <includeContext>true</includeContext>
                        <includeMdc>true</includeMdc>
                        <customFields>{"app":"order-service","env":"prod"}</customFields>
                    </encoder>
                </appender>

                <root level="INFO">
                    <appender-ref ref="STDOUT" />
                </root>
            </configuration>

            // 输出JSON格式日志
            // {"@timestamp":"2024-01-15T10:30:45.123Z","level":"INFO",
            //  "thread":"default-nioEventLoopGroup-1-3","logger":"OrderController",
            //  "message":"创建订单","app":"order-service","env":"prod",
            //  "trace_id":"abc123","span_id":"def456"}

            // 使用MDC传递上下文
            import org.slf4j.MDC;
            import org.slf4j.Logger;
            import org.slf4j.LoggerFactory;

            @Singleton
            public class OrderService {
                private static final Logger log = LoggerFactory.getLogger(OrderService.class);

                public Order createOrder(OrderRequest request) {
                    MDC.put("user_id", request.getUserId().toString());
                    MDC.put("order_id", UUID.randomUUID().toString());

                    log.info("开始创建订单");
                    // 业务逻辑
                    log.info("订单创建成功");

                    MDC.clear();
                    return order;
                }
            }
            ---

2 核心组件

2.1 汇总:6个核心组件

01.组件概览
    a.核心组件列表
        Micronaut框架由6个核心组件构成,分别负责应用上下文管理、依赖注入、AOP代理、HTTP通信、配置管理和Bean生命周期,这些组件协同工作,构建了完整的应用运行时环境。
    b.组件关系图
        ---
        // Micronaut核心组件架构
        // ┌─────────────────────────────────────┐
        // │      ApplicationContext             │  应用上下文(顶层容器)
        // │  ┌───────────────────────────────┐  │
        // │  │   BeanContext                 │  │  Bean上下文(依赖注入容器)
        // │  │  ┌─────────────────────────┐  │  │
        // │  │  │  BeanDefinitionRegistry │  │  │  Bean定义注册表
        // │  │  └─────────────────────────┘  │  │
        // │  │  ┌─────────────────────────┐  │  │
        // │  │  │  InterceptorRegistry    │  │  │  AOP拦截器注册表
        // │  │  └─────────────────────────┘  │  │
        // │  └───────────────────────────────┘  │
        // │  ┌───────────────────────────────┐  │
        // │  │   Environment                 │  │  配置环境
        // │  └───────────────────────────────┘  │
        // │  ┌───────────────────────────────┐  │
        // │  │   HttpServerConfiguration     │  │  HTTP服务器
        // │  └───────────────────────────────┘  │
        // └─────────────────────────────────────┘

        // 组件初始化顺序
        // 1. Environment           - 加载配置
        // 2. BeanContext          - 初始化Bean容器
        // 3. BeanDefinitionRegistry - 注册Bean定义
        // 4. InterceptorRegistry   - 注册拦截器
        // 5. ApplicationContext    - 启动应用上下文
        // 6. HttpServer           - 启动HTTP服务器
        ---

02.组件依赖关系
    a.ApplicationContext
        a.作用
            ApplicationContext是Micronaut的顶层容器,管理整个应用的生命周期,继承自BeanContext,提供额外的环境管理、事件发布等功能。
        b.职责
            负责应用启动、配置加载、Bean实例化、事件传播、优雅关闭等核心任务。
    b.BeanContext
        a.作用
            BeanContext是依赖注入容器的核心,负责Bean的注册、实例化、依赖解析和生命周期管理。
        b.职责
            管理所有BeanDefinition,解析Bean依赖关系,按拓扑顺序创建Bean实例,处理作用域和单例缓存。
    c.AOP代理机制
        a.作用
            InterceptorRegistry管理所有AOP拦截器,在方法调用时执行拦截器链,实现声明式事务、缓存、日志等横切关注点。
        b.职责
            注册拦截器、构建拦截器链、执行方法拦截、管理拦截器顺序。
    d.HTTP客户端与服务器
        a.作用
            基于Netty的HTTP服务器和声明式HTTP客户端,提供高性能的非阻塞IO通信能力。
        b.职责
            处理HTTP请求和响应、路由分发、内容协商、客户端负载均衡。
    e.配置管理
        a.作用
            Environment组件负责从多种来源加载配置,合并配置优先级,提供类型安全的配置访问。
        b.职责
            加载配置文件、解析环境变量、管理配置优先级、支持配置刷新。
    f.Bean生命周期
        a.作用
            管理Bean的创建、初始化、使用和销毁全生命周期,支持生命周期回调和事件监听。
        b.职责
            执行@PostConstruct和@PreDestroy回调、发布生命周期事件、管理Bean销毁顺序。

03.组件交互流程
    a.应用启动流程
        a.启动阶段划分
            Micronaut应用启动分为环境初始化、Bean容器启动、HTTP服务器启动三个主要阶段。
        b.启动流程代码
            ---
            import io.micronaut.runtime.Micronaut;
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.context.env.Environment;

            public class Application {
                public static void main(String[] args) {
                    // 创建并启动应用上下文
                    ApplicationContext context = Micronaut.run(Application.class, args);

                    // 内部执行流程
                    // 阶段1:环境初始化(50-100ms)
                    //   1.1 解析命令行参数
                    //   1.2 加载application.yml
                    //   1.3 解析环境变量
                    //   1.4 合并配置源

                    // 阶段2:Bean容器启动(200-400ms)
                    //   2.1 加载BeanDefinition类
                    //   2.2 解析Bean依赖关系
                    //   2.3 创建单例Bean实例
                    //   2.4 执行@PostConstruct回调
                    //   2.5 发布ApplicationStartedEvent

                    // 阶段3:HTTP服务器启动(100-200ms)
                    //   3.1 初始化Netty EventLoopGroup
                    //   3.2 绑定端口
                    //   3.3 注册路由处理器
                    //   3.4 发布ServerStartupEvent

                    // 总耗时:350-700ms(JVM模式)
                    // 总耗时:20-50ms(GraalVM原生镜像)
                }
            }

            // 监听启动事件
            import io.micronaut.runtime.event.ApplicationStartupEvent;
            import io.micronaut.context.event.ApplicationEventListener;

            @Singleton
            public class StartupListener implements
                ApplicationEventListener<ApplicationStartupEvent> {

                @Override
                public void onApplicationEvent(ApplicationStartupEvent event) {
                    System.out.println("应用启动完成");
                    ApplicationContext context = event.getSource();
                    Environment env = context.getEnvironment();
                    System.out.println("活跃环境: " + env.getActiveNames());
                }
            }
            ---
    b.请求处理流程
        a.HTTP请求流程
            HTTP请求从Netty服务器接收,经过过滤器链、路由匹配、参数绑定、控制器处理、响应序列化等阶段。
        b.请求流程示例
            ---
            // HTTP请求处理流程
            // 1. Netty接收HTTP请求
            // 2. HttpServerFilter过滤器链处理
            // 3. 路由匹配(UriRouteMatch)
            // 4. 参数绑定(ArgumentBinderRegistry)
            // 5. 执行控制器方法
            // 6. AOP拦截器处理
            // 7. 响应序列化(HttpResponseEncoder)
            // 8. Netty发送HTTP响应

            // 自定义过滤器
            import io.micronaut.http.*;
            import io.micronaut.http.annotation.Filter;
            import io.micronaut.http.filter.HttpServerFilter;
            import io.micronaut.http.filter.ServerFilterChain;
            import org.reactivestreams.Publisher;

            @Filter("/api/**")
            public class LoggingFilter implements HttpServerFilter {
                private static final Logger log = LoggerFactory.getLogger(LoggingFilter.class);

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    long start = System.currentTimeMillis();

                    // 记录请求
                    log.info("收到请求: {} {}", request.getMethod(), request.getPath());

                    // 继续处理请求
                    return Flux.from(chain.proceed(request))
                        .doOnNext(response -> {
                            long duration = System.currentTimeMillis() - start;
                            log.info("响应状态: {}, 耗时: {}ms",
                                   response.getStatus(), duration);
                        });
                }
            }

            // 控制器处理
            @Controller("/api/users")
            public class UserController {
                @Get("/{id}")
                public User getUser(Long id) {
                    // 参数id已自动绑定
                    return userService.findById(id);
                }
            }
            ---

04.组件扩展机制
    a.BeanCreatedEventListener
        a.Bean创建事件
            通过监听Bean创建事件,可以在Bean创建后、注入前对Bean进行自定义处理。
        b.事件监听示例
            ---
            import io.micronaut.context.event.BeanCreatedEvent;
            import io.micronaut.context.event.BeanCreatedEventListener;
            import jakarta.inject.Singleton;

            @Singleton
            public class DataSourceCustomizer implements
                BeanCreatedEventListener<DataSource> {

                @Override
                public DataSource onCreated(BeanCreatedEvent<DataSource> event) {
                    DataSource dataSource = event.getBean();

                    // 对DataSource进行自定义配置
                    if (dataSource instanceof HikariDataSource) {
                        HikariDataSource hikari = (HikariDataSource) dataSource;
                        hikari.setConnectionTimeout(30000);
                        hikari.setMaximumPoolSize(20);
                        System.out.println("DataSource配置已定制");
                    }

                    return dataSource;
                }
            }

            // 应用场景
            // 1. 数据源连接池配置
            // 2. HTTP客户端拦截器注册
            // 3. 缓存管理器初始化
            // 4. 第三方组件定制
            ---
    b.BeanDefinitionReference
        a.延迟加载
            BeanDefinitionReference提供Bean定义的引用,支持延迟加载,在需要时才实例化Bean。
        b.延迟加载示例
            ---
            import io.micronaut.context.BeanContext;
            import io.micronaut.inject.BeanDefinition;
            import io.micronaut.inject.BeanDefinitionReference;

            @Singleton
            public class LazyBeanLoader {
                private final BeanContext beanContext;

                public LazyBeanLoader(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void loadBeansOnDemand() {
                    // 获取所有Bean定义引用(不实例化)
                    Collection<BeanDefinitionReference<?>> references =
                        beanContext.getBeanDefinitionReferences();

                    System.out.println("总共有 " + references.size() + " 个Bean定义");

                    // 按需加载Bean
                    for (BeanDefinitionReference<?> ref : references) {
                        if (ref.getBeanType().getPackage().getName().startsWith("com.example")) {
                            // 仅加载com.example包下的Bean
                            BeanDefinition<?> definition = ref.load(beanContext);
                            Object bean = beanContext.getBean(definition.getBeanType());
                            System.out.println("加载Bean: " + bean.getClass().getName());
                        }
                    }
                }
            }
            ---

2.2 应用上下文

01.ApplicationContext详解
    a.上下文创建
        a.创建方式
            ApplicationContext是Micronaut的顶层容器,可以通过Micronaut.run()或ApplicationContext.builder()创建,前者用于启动Web应用,后者用于非Web场景。
        b.创建示例
            ---
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.runtime.Micronaut;

            // 方式1:Web应用启动
            public class WebApplication {
                public static void main(String[] args) {
                    // 创建并启动Web应用上下文
                    ApplicationContext context = Micronaut.run(WebApplication.class, args);
                    // 自动启动HTTP服务器
                }
            }

            // 方式2:非Web应用
            public class CliApplication {
                public static void main(String[] args) {
                    // 创建应用上下文(不启动HTTP服务器)
                    ApplicationContext context = ApplicationContext.builder()
                        .deduceEnvironment(true)  // 自动推断环境
                        .banner(false)            // 不显示banner
                        .start();

                    // 使用Bean
                    DataProcessor processor = context.getBean(DataProcessor.class);
                    processor.process();

                    // 关闭上下文
                    context.close();
                }
            }

            // 方式3:自定义配置
            public class CustomApplication {
                public static void main(String[] args) {
                    ApplicationContext context = ApplicationContext.builder()
                        .environments("dev", "test")  // 指定环境
                        .properties(Map.of(           // 添加属性
                            "datasource.url", "jdbc:h2:mem:testdb",
                            "app.version", "1.0.0"
                        ))
                        .singletons(new CustomBean())  // 注册单例
                        .packages("com.example")       // 限制扫描包
                        .start();

                    context.close();
                }
            }
            ---
    b.上下文配置
        a.构建器模式
            ApplicationContext.builder()提供流畅的API配置应用上下文,支持环境、属性、类加载器等自定义。
        b.配置选项
            ---
            import io.micronaut.context.ApplicationContextBuilder;

            public class ContextConfiguration {
                public static ApplicationContext createContext() {
                    ApplicationContextBuilder builder = ApplicationContext.builder();

                    return builder
                        // 环境配置
                        .environments("prod")
                        .deduceEnvironment(false)

                        // 类加载器
                        .classLoader(CustomClassLoader.class.getClassLoader())

                        // 自定义属性
                        .properties(Map.of(
                            "micronaut.server.port", "9090",
                            "micronaut.application.name", "my-service"
                        ))

                        // 预注册Bean
                        .singletons(new MetricsRegistry())

                        // 包扫描限制
                        .packages("com.example.services", "com.example.controllers")

                        // 排除包
                        .excludePackages("com.example.test")

                        // 启动时不启动服务器
                        .eagerInitSingletons(false)

                        // Banner配置
                        .banner(true)

                        // 启动上下文
                        .start();
                }
            }
            ---

02.Bean访问与管理
    a.Bean获取方法
        a.类型获取
            通过Bean的Class类型获取实例,如果存在多个同类型Bean会抛出异常,需要使用@Named或@Primary指定。
        b.获取示例
            ---
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.context.exceptions.NoSuchBeanException;
            import io.micronaut.context.exceptions.NonUniqueBeanException;

            @Singleton
            public class BeanAccessor {
                private final ApplicationContext context;

                public BeanAccessor(ApplicationContext context) {
                    this.context = context;
                }

                public void accessBeans() {
                    // 1. 通过类型获取Bean
                    UserService userService = context.getBean(UserService.class);

                    // 2. 通过类型和限定符获取
                    DataSource primaryDs = context.getBean(DataSource.class,
                        Qualifiers.byName("primary"));

                    // 3. 检查Bean是否存在
                    boolean exists = context.containsBean(EmailService.class);

                    // 4. 可选获取(不存在返回Optional.empty)
                    Optional<CacheService> cacheService =
                        context.findBean(CacheService.class);

                    // 5. 获取所有同类型Bean
                    Collection<MessageSender> senders =
                        context.getBeansOfType(MessageSender.class);

                    // 6. 通过Argument获取(支持泛型)
                    Argument<List<String>> arg = Argument.listOf(String.class);
                    List<String> list = context.getBean(arg);
                }

                public void handleErrors() {
                    try {
                        context.getBean(NonExistentService.class);
                    } catch (NoSuchBeanException e) {
                        System.out.println("Bean不存在");
                    }

                    try {
                        context.getBean(NotificationService.class);
                    } catch (NonUniqueBeanException e) {
                        System.out.println("存在多个同类型Bean,需要使用@Named指定");
                    }
                }
            }
            ---
    b.Bean注册
        a.动态注册Bean
            除了通过注解自动注册Bean,还可以在运行时动态注册Bean实例或BeanDefinition。
        b.动态注册示例
            ---
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.inject.BeanDefinition;
            import io.micronaut.context.BeanRegistration;

            public class DynamicBeanRegistration {
                public static void main(String[] args) {
                    ApplicationContext context = ApplicationContext.run();

                    // 1. 注册单例实例
                    Configuration config = new Configuration("prod");
                    context.registerSingleton(Configuration.class, config);

                    // 2. 注册带限定符的Bean
                    DataSource primaryDs = createPrimaryDataSource();
                    context.registerSingleton(DataSource.class, primaryDs,
                        Qualifiers.byName("primary"));

                    DataSource secondaryDs = createSecondaryDataSource();
                    context.registerSingleton(DataSource.class, secondaryDs,
                        Qualifiers.byName("secondary"));

                    // 3. 获取注册的Bean
                    Configuration retrievedConfig = context.getBean(Configuration.class);
                    DataSource primary = context.getBean(DataSource.class,
                        Qualifiers.byName("primary"));

                    // 4. 销毁Bean
                    context.destroyBean(Configuration.class);

                    context.close();
                }

                private static DataSource createPrimaryDataSource() {
                    return new HikariDataSource(/*...*/);
                }

                private static DataSource createSecondaryDataSource() {
                    return new HikariDataSource(/*...*/);
                }
            }
            ---

03.环境管理
    a.Environment组件
        a.环境概念
            Environment管理应用的配置环境,支持多环境配置、配置优先级、属性占位符解析等功能。
        b.环境使用
            ---
            import io.micronaut.context.env.Environment;
            import io.micronaut.context.env.PropertySource;
            import jakarta.inject.Singleton;

            @Singleton
            public class EnvironmentService {
                private final Environment environment;

                public EnvironmentService(Environment environment) {
                    this.environment = environment;
                }

                public void printEnvironmentInfo() {
                    // 获取活跃环境
                    Set<String> activeNames = environment.getActiveNames();
                    System.out.println("活跃环境: " + activeNames);

                    // 获取配置属性
                    String appName = environment.getProperty("micronaut.application.name",
                        String.class).orElse("unknown");
                    System.out.println("应用名称: " + appName);

                    Integer port = environment.getProperty("micronaut.server.port",
                        Integer.class).orElse(8080);
                    System.out.println("服务端口: " + port);

                    // 获取必需属性(不存在会抛异常)
                    String dbUrl = environment.getRequiredProperty("datasource.url",
                        String.class);

                    // 属性占位符解析
                    String value = environment.getPlaceholderResolver()
                        .resolveRequiredPlaceholders("${app.name}-${app.version}");

                    // 检查环境
                    boolean isDev = environment.getActiveNames().contains("dev");
                    boolean isProd = environment.getActiveNames().contains("prod");
                }

                public void listPropertySources() {
                    // 遍历所有配置源
                    for (PropertySource source : environment.getPropertySources()) {
                        System.out.println("配置源: " + source.getName());
                        System.out.println("优先级: " + source.getOrder());
                    }
                }
            }

            // 配置优先级(从高到低)
            // 1. 命令行参数
            // 2. 系统属性
            // 3. 环境变量
            // 4. application-{env}.yml
            // 5. application.yml
            // 6. 默认值
            ---
    b.多环境配置
        a.环境激活
            通过micronaut.environments属性或MICRONAUT_ENVIRONMENTS环境变量指定活跃环境。
        b.环境配置示例
            ---
            // application.yml(默认配置)
            // micronaut:
            //   application:
            //     name: order-service
            // datasource:
            //   url: jdbc:h2:mem:default
            //   driver-class-name: org.h2.Driver

            // application-dev.yml(开发环境)
            // datasource:
            //   url: jdbc:mysql://localhost:3306/dev_db
            //   username: dev_user
            //   password: dev_pass
            // logger:
            //   levels:
            //     com.example: DEBUG

            // application-prod.yml(生产环境)
            // datasource:
            //   url: jdbc:mysql://prod-db:3306/prod_db
            //   username: prod_user
            //   password: ${DB_PASSWORD}  # 从环境变量读取
            //   pool:
            //     maximum-pool-size: 50
            // logger:
            //   levels:
            //     com.example: INFO

            // 启动时指定环境
            // java -Dmicronaut.environments=dev -jar app.jar
            // java -Dmicronaut.environments=prod -jar app.jar
            // MICRONAUT_ENVIRONMENTS=prod java -jar app.jar

            // 多环境激活
            // java -Dmicronaut.environments=cloud,prod -jar app.jar

            // 环境条件Bean
            import io.micronaut.context.annotation.Requires;

            @Singleton
            @Requires(env = "dev")
            public class DevDataInitializer {
                @PostConstruct
                public void init() {
                    System.out.println("开发环境:初始化测试数据");
                }
            }

            @Singleton
            @Requires(env = "prod")
            public class ProdMonitoringService {
                @PostConstruct
                public void init() {
                    System.out.println("生产环境:启动监控服务");
                }
            }
            ---

04.事件系统
    a.应用事件
        a.内置事件类型
            Micronaut提供丰富的应用生命周期事件,可以监听这些事件执行自定义逻辑。
        b.事件监听
            ---
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.context.event.*;
            import io.micronaut.runtime.event.*;
            import jakarta.inject.Singleton;

            // 监听应用启动事件
            @Singleton
            public class StartupListener implements
                ApplicationEventListener<ApplicationStartupEvent> {

                @Override
                public void onApplicationEvent(ApplicationStartupEvent event) {
                    System.out.println("应用启动完成");
                }
            }

            // 监听应用关闭事件
            @Singleton
            public class ShutdownListener implements
                ApplicationEventListener<ShutdownEvent> {

                @Override
                public void onApplicationEvent(ShutdownEvent event) {
                    System.out.println("应用即将关闭,清理资源...");
                }
            }

            // 监听HTTP服务器启动
            @Singleton
            public class ServerStartListener implements
                ApplicationEventListener<ServerStartupEvent> {

                @Override
                public void onApplicationEvent(ServerStartupEvent event) {
                    int port = event.getSource().getPort();
                    System.out.println("HTTP服务器启动,端口: " + port);
                }
            }

            // 监听Bean创建事件
            @Singleton
            public class BeanListener implements
                ApplicationEventListener<BeanCreatedEvent<DataSource>> {

                @Override
                public void onApplicationEvent(BeanCreatedEvent<DataSource> event) {
                    System.out.println("DataSource Bean已创建");
                }
            }
            ---
    b.自定义事件
        a.事件发布
            可以定义自定义事件并通过ApplicationEventPublisher发布,其他组件可以监听这些事件。
        b.自定义事件示例
            ---
            // 定义自定义事件
            public class OrderCreatedEvent {
                private final Order order;
                private final long timestamp;

                public OrderCreatedEvent(Order order) {
                    this.order = order;
                    this.timestamp = System.currentTimeMillis();
                }

                public Order getOrder() { return order; }
                public long getTimestamp() { return timestamp; }
            }

            // 发布事件
            import io.micronaut.context.event.ApplicationEventPublisher;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderService {
                private final ApplicationEventPublisher<OrderCreatedEvent> eventPublisher;

                public OrderService(ApplicationEventPublisher<OrderCreatedEvent> eventPublisher) {
                    this.eventPublisher = eventPublisher;
                }

                public Order createOrder(OrderRequest request) {
                    Order order = new Order(request);
                    // 保存订单
                    orderRepository.save(order);

                    // 发布事件
                    eventPublisher.publishEvent(new OrderCreatedEvent(order));

                    return order;
                }
            }

            // 监听自定义事件
            @Singleton
            public class OrderEventListener implements
                ApplicationEventListener<OrderCreatedEvent> {

                @Inject
                private NotificationService notificationService;

                @Inject
                private InventoryService inventoryService;

                @Override
                public void onApplicationEvent(OrderCreatedEvent event) {
                    Order order = event.getOrder();

                    // 发送通知
                    notificationService.sendOrderConfirmation(order);

                    // 扣减库存
                    inventoryService.decreaseStock(order.getItems());

                    System.out.println("订单事件处理完成: " + order.getId());
                }
            }

            // 异步事件监听
            import io.micronaut.scheduling.annotation.Async;

            @Singleton
            public class AsyncOrderListener implements
                ApplicationEventListener<OrderCreatedEvent> {

                @Async  // 异步执行
                @Override
                public void onApplicationEvent(OrderCreatedEvent event) {
                    // 在独立线程中处理事件
                    System.out.println("异步处理订单: " + event.getOrder().getId());
                }
            }
            ---

2.3 依赖注入容器

01.BeanContext详解
    a.容器职责
        a.核心功能
            BeanContext是Micronaut的依赖注入容器,负责管理所有Bean的定义、实例化、依赖解析和生命周期,它在编译时获得完整的依赖关系图,运行时高效地创建和管理Bean。
        b.容器操作
            ---
            import io.micronaut.context.BeanContext;
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.inject.BeanDefinition;
            import io.micronaut.inject.qualifiers.Qualifiers;

            public class BeanContextExample {
                public static void main(String[] args) {
                    BeanContext context = ApplicationContext.run();

                    // 1. 获取Bean定义(不实例化)
                    BeanDefinition<UserService> definition =
                        context.getBeanDefinition(UserService.class);
                    System.out.println("Bean类型: " + definition.getBeanType());
                    System.out.println("是否单例: " + definition.isSingleton());

                    // 2. 获取所有Bean定义
                    Collection<BeanDefinition<?>> allDefinitions =
                        context.getBeanDefinitions();
                    System.out.println("总共有 " + allDefinitions.size() + " 个Bean");

                    // 3. 按类型查找Bean定义
                    Collection<BeanDefinition<DataSource>> dsDefinitions =
                        context.getBeanDefinitions(DataSource.class);

                    // 4. 创建Bean实例
                    UserService userService = context.createBean(UserService.class);

                    // 5. 销毁Bean
                    context.destroyBean(userService);

                    // 6. 获取或创建Bean
                    OrderService orderService = context.getBean(OrderService.class);

                    // 7. 刷新Bean(仅@Refreshable标记的Bean)
                    context.refreshBean(BeanIdentifier.of("configBean"));

                    context.close();
                }
            }
            ---
    b.依赖解析
        a.依赖图构建
            BeanContext在启动时根据编译时生成的BeanDefinition构建完整的依赖关系图,确定Bean的创建顺序。
        b.依赖解析示例
            ---
            // 定义Bean依赖关系
            @Singleton
            public class RepositoryImpl implements Repository {
                public RepositoryImpl() {
                    System.out.println("1. Repository创建");
                }
            }

            @Singleton
            public class ServiceImpl implements Service {
                private final Repository repository;

                public ServiceImpl(Repository repository) {
                    System.out.println("2. Service创建,依赖Repository");
                    this.repository = repository;
                }
            }

            @Singleton
            public class ControllerImpl implements Controller {
                private final Service service;

                public ControllerImpl(Service service) {
                    System.out.println("3. Controller创建,依赖Service");
                    this.service = service;
                }
            }

            // 启动应用
            // 输出顺序:
            // 1. Repository创建
            // 2. Service创建,依赖Repository
            // 3. Controller创建,依赖Service

            // 依赖关系图
            // Controller -> Service -> Repository
            // Micronaut按拓扑顺序创建:Repository -> Service -> Controller

            // 复杂依赖示例
            @Singleton
            public class ComplexService {
                private final Dependency1 dep1;
                private final Dependency2 dep2;
                private final Dependency3 dep3;

                public ComplexService(Dependency1 dep1,
                                    Dependency2 dep2,
                                    Dependency3 dep3) {
                    this.dep1 = dep1;
                    this.dep2 = dep2;
                    this.dep3 = dep3;
                }
            }

            // Micronaut在编译时分析:
            // 1. ComplexService依赖Dependency1、Dependency2、Dependency3
            // 2. 检查这3个依赖是否存在
            // 3. 检查是否存在循环依赖
            // 4. 生成创建顺序:先创建3个依赖,再创建ComplexService
            ---

02.Bean定义
    a.BeanDefinition接口
        a.元数据访问
            BeanDefinition提供Bean的完整元数据,包括类型、作用域、注解、构造器参数、依赖关系等信息。
        b.元数据查询
            ---
            import io.micronaut.inject.BeanDefinition;
            import io.micronaut.inject.ExecutableMethod;
            import io.micronaut.core.annotation.AnnotationMetadata;

            @Singleton
            public class BeanInspector {
                private final BeanContext beanContext;

                public BeanInspector(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void inspectBean(Class<?> beanType) {
                    BeanDefinition<?> definition =
                        beanContext.getBeanDefinition(beanType);

                    // 基本信息
                    System.out.println("Bean类型: " + definition.getBeanType());
                    System.out.println("是否单例: " + definition.isSingleton());
                    System.out.println("是否可迭代: " + definition.isIterable());

                    // 作用域信息
                    Optional<Class<? extends Annotation>> scope = definition.getScope();
                    scope.ifPresent(s -> System.out.println("作用域: " + s.getName()));

                    // 注解元数据
                    AnnotationMetadata metadata = definition.getAnnotationMetadata();
                    System.out.println("注解: " + metadata.getAnnotationNames());

                    // 构造器参数
                    definition.getConstructor().getArguments()
                        .forEach(arg -> System.out.println("依赖: " + arg.getType()));

                    // 可执行方法(包含@PostConstruct等)
                    Collection<ExecutableMethod<?, ?>> methods =
                        definition.getExecutableMethods();
                    methods.forEach(method ->
                        System.out.println("方法: " + method.getName()));

                    // 注入字段
                    definition.getInjectedFields()
                        .forEach(field -> System.out.println("字段: " + field.getName()));

                    // 注入方法
                    definition.getInjectedMethods()
                        .forEach(method -> System.out.println("注入方法: " + method.getName()));
                }
            }
            ---
    b.BeanDefinitionRegistry
        a.注册表功能
            BeanDefinitionRegistry管理所有Bean定义的注册、查找和移除,是BeanContext的核心组成部分。
        b.注册表操作
            ---
            import io.micronaut.inject.BeanDefinitionRegistry;
            import io.micronaut.context.ApplicationContext;

            public class RegistryExample {
                public static void main(String[] args) {
                    ApplicationContext context = ApplicationContext.run();
                    BeanDefinitionRegistry registry = context;

                    // 1. 查找Bean定义
                    Optional<BeanDefinition<UserService>> definition =
                        registry.findBeanDefinition(UserService.class);

                    if (definition.isPresent()) {
                        BeanDefinition<UserService> def = definition.get();
                        System.out.println("找到Bean定义: " + def.getBeanType());
                    }

                    // 2. 查找所有Bean定义
                    Collection<BeanDefinition<?>> allBeans =
                        registry.getBeanDefinitions();

                    // 3. 按类型查找
                    Collection<BeanDefinition<Repository>> repositories =
                        registry.getBeanDefinitions(Repository.class);

                    // 4. 按限定符查找
                    BeanDefinition<DataSource> primaryDs =
                        registry.findBeanDefinition(DataSource.class,
                            Qualifiers.byName("primary")).orElse(null);

                    // 5. 检查Bean定义是否存在
                    boolean exists = registry.containsBean(EmailService.class);

                    // 6. 获取Bean定义数量
                    int count = registry.getBeanDefinitions().size();
                    System.out.println("注册的Bean总数: " + count);

                    context.close();
                }
            }
            ---

03.Bean实例化
    a.实例化策略
        a.单例缓存
            @Singleton标记的Bean首次创建后缓存在BeanContext中,后续注入直接从缓存获取,保证全局唯一。
        b.实例化流程
            ---
            // Bean实例化流程示例
            import io.micronaut.context.BeanContext;
            import io.micronaut.context.BeanResolutionContext;
            import io.micronaut.inject.BeanDefinition;

            // 编译时生成的BeanDefinition实现
            @Generated
            public class $OrderService$Definition
                extends AbstractInitializableBeanDefinition<OrderService> {

                @Override
                public OrderService build(BeanResolutionContext resolutionContext,
                                        BeanContext context,
                                        BeanDefinition<OrderService> definition) {
                    // 1. 解析依赖
                    OrderRepository repository =
                        (OrderRepository) super.getBeanForConstructorArgument(
                            resolutionContext, context, 0, null);

                    PaymentService paymentService =
                        (PaymentService) super.getBeanForConstructorArgument(
                            resolutionContext, context, 1, null);

                    // 2. 调用构造器创建实例(无反射)
                    OrderService bean = new OrderService(repository, paymentService);

                    // 3. 执行字段注入(如果有@Inject字段)
                    // super.injectBean(resolutionContext, context, bean);

                    // 4. 执行方法注入(如果有@Inject方法)
                    // super.injectBeanMethods(resolutionContext, context, bean);

                    // 5. 返回实例
                    return bean;
                }

                @Override
                protected Object injectBean(BeanResolutionContext resolutionContext,
                                          BeanContext context,
                                          Object bean) {
                    OrderService orderService = (OrderService) bean;

                    // 执行@PostConstruct方法
                    orderService.init();

                    return orderService;
                }
            }

            // 使用示例
            public class InstantiationExample {
                public static void main(String[] args) {
                    BeanContext context = BeanContext.run();

                    // 首次获取:触发实例化
                    OrderService service1 = context.getBean(OrderService.class);

                    // 再次获取:从缓存返回(单例)
                    OrderService service2 = context.getBean(OrderService.class);

                    // 验证是同一实例
                    System.out.println(service1 == service2);  // true

                    context.close();
                }
            }
            ---
    b.懒加载
        a.懒加载配置
            通过@Context(lazy=true)配置Bean懒加载,仅在首次使用时才创建实例。
        b.懒加载示例
            ---
            import io.micronaut.context.annotation.Context;

            @Singleton
            @Context(lazy = true)  // 懒加载
            public class HeavyService {
                public HeavyService() {
                    System.out.println("HeavyService初始化(耗时操作)");
                    // 加载大量数据、建立连接等耗时操作
                }

                public void process() {
                    System.out.println("处理业务逻辑");
                }
            }

            @Controller("/api")
            public class ApiController {
                private final HeavyService heavyService;

                public ApiController(HeavyService heavyService) {
                    this.heavyService = heavyService;
                    // 此时HeavyService尚未初始化
                }

                @Get("/process")
                public String process() {
                    // 首次调用时才初始化HeavyService
                    heavyService.process();
                    return "Done";
                }
            }

            // 启动流程
            // 1. 应用启动:HeavyService未初始化
            // 2. 首次访问/api/process:触发HeavyService初始化
            // 3. 后续访问:直接使用已创建的实例
            ---

04.作用域管理
    a.作用域类型
        a.支持的作用域
            Micronaut支持多种Bean作用域,包括Singleton、Prototype、RequestScope、ThreadLocal、Refreshable等。
        b.作用域示例
            ---
            import io.micronaut.context.annotation.Prototype;
            import io.micronaut.runtime.http.scope.RequestScope;
            import io.micronaut.context.annotation.ThreadLocal;
            import io.micronaut.context.annotation.Refreshable;

            // 单例作用域(默认)
            @Singleton
            public class ConfigService {
                // 应用生命周期内唯一实例
            }

            // 原型作用域(每次注入创建新实例)
            @Prototype
            public class TaskExecutor {
                private String taskId = UUID.randomUUID().toString();

                public String getTaskId() {
                    return taskId;
                }
            }

            // 请求作用域(每个HTTP请求内唯一)
            @RequestScope
            public class RequestContext {
                private String traceId = UUID.randomUUID().toString();
                private Map<String, Object> attributes = new HashMap<>();

                public void setAttribute(String key, Object value) {
                    attributes.put(key, value);
                }
            }

            // 线程局部作用域
            @ThreadLocal
            public class ThreadContext {
                private String threadId = Thread.currentThread().getName();
                // 每个线程独立实例
            }

            // 可刷新作用域(配置变更时重新创建)
            @Refreshable
            @ConfigurationProperties("dynamic")
            public class DynamicConfig {
                private int maxConnections;
                // POST /refresh端点触发时重新创建
            }

            // 使用示例
            @Singleton
            public class ScopeDemo {
                private final BeanContext beanContext;

                public ScopeDemo(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void demonstrateScopes() {
                    // Singleton:同一实例
                    ConfigService config1 = beanContext.getBean(ConfigService.class);
                    ConfigService config2 = beanContext.getBean(ConfigService.class);
                    System.out.println("Singleton相同: " + (config1 == config2));  // true

                    // Prototype:不同实例
                    TaskExecutor task1 = beanContext.getBean(TaskExecutor.class);
                    TaskExecutor task2 = beanContext.getBean(TaskExecutor.class);
                    System.out.println("Prototype不同: " + (task1 != task2));  // true
                    System.out.println("Task1 ID: " + task1.getTaskId());
                    System.out.println("Task2 ID: " + task2.getTaskId());
                }
            }
            ---
    b.自定义作用域
        a.作用域注解
            可以定义自定义作用域注解,实现特定的Bean生命周期管理。
        b.自定义作用域示例
            ---
            import io.micronaut.context.scope.CustomScope;
            import io.micronaut.context.BeanResolutionContext;
            import io.micronaut.inject.BeanIdentifier;
            import jakarta.inject.Singleton;
            import java.lang.annotation.*;

            // 定义作用域注解
            @Documented
            @Retention(RetentionPolicy.RUNTIME)
            @Target({ElementType.TYPE, ElementType.METHOD})
            @Scope
            public @interface TenantScope {
            }

            // 实现作用域逻辑
            @Singleton
            public class TenantScopeImpl implements CustomScope<TenantScope> {
                private final Map<String, Map<BeanIdentifier, Object>> tenantBeans =
                    new ConcurrentHashMap<>();

                @Override
                public Class<TenantScope> annotationType() {
                    return TenantScope.class;
                }

                @Override
                public <T> T get(BeanResolutionContext resolutionContext,
                               BeanDefinition<T> beanDefinition,
                               BeanIdentifier identifier,
                               BeanProvider<T> provider) {
                    // 获取当前租户ID
                    String tenantId = TenantContext.getCurrentTenantId();

                    // 获取或创建租户级别的Bean
                    Map<BeanIdentifier, Object> beans =
                        tenantBeans.computeIfAbsent(tenantId, k -> new ConcurrentHashMap<>());

                    return (T) beans.computeIfAbsent(identifier, k -> provider.get());
                }

                @Override
                public <T> Optional<T> remove(BeanIdentifier identifier) {
                    String tenantId = TenantContext.getCurrentTenantId();
                    Map<BeanIdentifier, Object> beans = tenantBeans.get(tenantId);
                    if (beans != null) {
                        return Optional.ofNullable((T) beans.remove(identifier));
                    }
                    return Optional.empty();
                }
            }

            // 使用自定义作用域
            @TenantScope
            public class TenantDataSource implements DataSource {
                // 每个租户独立的数据源实例
            }
            ---

2.4 AOP代理机制

01.拦截器系统
    a.MethodInterceptor接口
        a.拦截器定义
            MethodInterceptor是Micronaut AOP的核心接口,所有方法拦截器都需要实现此接口,提供intercept方法来处理方法调用。
        b.拦截器实现
            ---
            import io.micronaut.aop.MethodInterceptor;
            import io.micronaut.aop.MethodInvocationContext;
            import jakarta.inject.Singleton;
            import org.slf4j.Logger;
            import org.slf4j.LoggerFactory;

            @Singleton
            public class PerformanceInterceptor implements MethodInterceptor<Object, Object> {
                private static final Logger log =
                    LoggerFactory.getLogger(PerformanceInterceptor.class);

                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    long startTime = System.nanoTime();

                    // 获取方法信息
                    String className = context.getTarget().getClass().getSimpleName();
                    String methodName = context.getMethodName();
                    Object[] parameters = context.getParameterValues();

                    log.debug("开始执行: {}.{}()", className, methodName);

                    try {
                        // 执行原方法
                        Object result = context.proceed();

                        long duration = (System.nanoTime() - startTime) / 1_000_000;
                        log.info("执行完成: {}.{}() 耗时{}ms",
                               className, methodName, duration);

                        // 性能告警
                        if (duration > 1000) {
                            log.warn("方法执行超时: {}.{}() 耗时{}ms",
                                   className, methodName, duration);
                        }

                        return result;
                    } catch (Exception e) {
                        long duration = (System.nanoTime() - startTime) / 1_000_000;
                        log.error("执行失败: {}.{}() 耗时{}ms, 错误: {}",
                                className, methodName, duration, e.getMessage());
                        throw e;
                    }
                }
            }

            // 定义拦截注解
            import io.micronaut.aop.Around;
            import java.lang.annotation.*;

            @Around
            @Type(PerformanceInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            @Target({ElementType.METHOD, ElementType.TYPE})
            public @interface Monitor {
            }

            // 应用拦截器
            @Singleton
            public class ProductService {
                @Monitor  // 该方法会被性能监控
                public Product findById(Long id) {
                    // 模拟数据库查询
                    return productRepository.findById(id);
                }

                @Monitor
                public List<Product> search(String keyword) {
                    // 模拟复杂查询
                    return productRepository.search(keyword);
                }
            }
            ---
    b.拦截器链
        a.多拦截器组合
            一个方法可以被多个拦截器拦截,Micronaut按照拦截器的Order值构建拦截器链,依次执行。
        b.拦截器链示例
            ---
            import io.micronaut.core.order.Ordered;

            // 拦截器1:认证(优先级最高)
            @Singleton
            public class AuthInterceptor implements MethodInterceptor<Object, Object>,
                Ordered {

                @Override
                public int getOrder() {
                    return 100;  // 优先级高(数值小)
                }

                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    System.out.println("1. 认证检查");
                    // 检查认证
                    return context.proceed();
                }
            }

            // 拦截器2:日志
            @Singleton
            public class LogInterceptor implements MethodInterceptor<Object, Object>,
                Ordered {

                @Override
                public int getOrder() {
                    return 200;
                }

                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    System.out.println("2. 日志记录");
                    Object result = context.proceed();
                    System.out.println("6. 日志记录完成");
                    return result;
                }
            }

            // 拦截器3:缓存
            @Singleton
            public class CacheInterceptor implements MethodInterceptor<Object, Object>,
                Ordered {

                @Override
                public int getOrder() {
                    return 300;
                }

                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    System.out.println("3. 缓存检查");
                    Object result = context.proceed();
                    System.out.println("5. 缓存更新");
                    return result;
                }
            }

            // 应用多个拦截器
            @Singleton
            public class OrderService {
                @Auth      // AuthInterceptor
                @Logged    // LogInterceptor
                @Cached    // CacheInterceptor
                public Order getOrder(Long id) {
                    System.out.println("4. 实际方法执行");
                    return orderRepository.findById(id);
                }
            }

            // 执行顺序
            // 1. 认证检查(Order=100)
            // 2. 日志记录(Order=200)
            // 3. 缓存检查(Order=300)
            // 4. 实际方法执行
            // 5. 缓存更新(Order=300)
            // 6. 日志记录完成(Order=200)
            // 认证检查完成隐含在最外层
            ---

02.Introduction通知
    a.接口实现注入
        a.Introduction概念
            Introduction通知允许为接口动态提供实现,常用于声明式HTTP客户端、Repository等场景。
        b.声明式客户端
            ---
            // 定义HTTP客户端接口(无需实现类)
            import io.micronaut.http.client.annotation.Client;
            import io.micronaut.http.annotation.*;

            @Client("https://api.github.com")
            public interface GitHubApi {
                @Get("/users/{username}")
                User getUser(String username);

                @Get("/repos/{owner}/{repo}")
                Repository getRepository(String owner, String repo);
            }

            // Micronaut编译时生成实现类
            @Generated
            public class $GitHubApi$Intercepted implements GitHubApi {
                private final HttpClient httpClient;

                public $GitHubApi$Intercepted(HttpClient httpClient) {
                    this.httpClient = httpClient;
                }

                @Override
                public User getUser(String username) {
                    // 自动生成HTTP调用代码
                    return httpClient.toBlocking().retrieve(
                        "/users/" + username, User.class);
                }

                @Override
                public Repository getRepository(String owner, String repo) {
                    return httpClient.toBlocking().retrieve(
                        "/repos/" + owner + "/" + repo, Repository.class);
                }
            }

            // 使用示例
            @Singleton
            public class GithubService {
                private final GitHubApi githubApi;

                public GithubService(GitHubApi githubApi) {
                    this.githubApi = githubApi;  // 注入编译时生成的实现
                }

                public User getUserInfo(String username) {
                    return githubApi.getUser(username);
                }
            }
            ---
    b.自定义Introduction
        a.Introduction注解
            通过@Introduction注解和MethodInterceptor可以实现自定义的接口代理。
        b.自定义Introduction示例
            ---
            import io.micronaut.aop.Introduction;
            import io.micronaut.context.annotation.Type;
            import java.lang.annotation.*;

            // 定义Introduction注解
            @Introduction
            @Type(CrudRepositoryInterceptor.class)
            @Retention(RetentionPolicy.RUNTIME)
            @Target(ElementType.TYPE)
            public @interface CrudRepository {
                Class<?> entity();
            }

            // 实现Introduction拦截器
            @Singleton
            public class CrudRepositoryInterceptor implements MethodInterceptor<Object, Object> {
                private final JdbcTemplate jdbcTemplate;

                public CrudRepositoryInterceptor(JdbcTemplate jdbcTemplate) {
                    this.jdbcTemplate = jdbcTemplate;
                }

                @Override
                public Object intercept(MethodInvocationContext<Object, Object> context) {
                    String methodName = context.getMethodName();

                    // 根据方法名生成SQL
                    if (methodName.equals("findById")) {
                        Long id = (Long) context.getParameterValues()[0];
                        String sql = "SELECT * FROM users WHERE id = ?";
                        return jdbcTemplate.queryForObject(sql, User.class, id);
                    } else if (methodName.equals("save")) {
                        User user = (User) context.getParameterValues()[0];
                        String sql = "INSERT INTO users (name, email) VALUES (?, ?)";
                        jdbcTemplate.update(sql, user.getName(), user.getEmail());
                        return user;
                    }

                    return null;
                }
            }

            // 定义Repository接口
            @CrudRepository(entity = User.class)
            public interface UserRepository {
                User findById(Long id);
                User save(User user);
                void deleteById(Long id);
            }

            // 使用Repository(无需编写实现类)
            @Singleton
            public class UserService {
                private final UserRepository userRepository;

                public UserService(UserRepository userRepository) {
                    this.userRepository = userRepository;  // 注入代理实现
                }

                public User getUser(Long id) {
                    return userRepository.findById(id);
                }
            }
            ---

03.内置AOP功能
    a.声明式事务
        a.@Transactional注解
            Micronaut提供@Transactional注解实现声明式事务管理,通过AOP拦截器自动处理事务的开启、提交和回滚。
        b.事务示例
            ---
            import io.micronaut.transaction.annotation.Transactional;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderService {
                private final OrderRepository orderRepository;
                private final InventoryService inventoryService;
                private final PaymentService paymentService;

                public OrderService(OrderRepository orderRepository,
                                  InventoryService inventoryService,
                                  PaymentService paymentService) {
                    this.orderRepository = orderRepository;
                    this.inventoryService = inventoryService;
                    this.paymentService = paymentService;
                }

                @Transactional  // 方法执行在事务中
                public Order createOrder(OrderRequest request) {
                    // 1. 创建订单
                    Order order = new Order(request);
                    orderRepository.save(order);

                    // 2. 扣减库存
                    inventoryService.decreaseStock(request.getItems());

                    // 3. 处理支付
                    PaymentResult payment = paymentService.charge(request.getAmount());

                    if (!payment.isSuccess()) {
                        // 抛出异常,事务自动回滚
                        throw new PaymentFailedException("支付失败");
                    }

                    order.setPaymentId(payment.getTransactionId());
                    orderRepository.update(order);

                    return order;
                    // 方法正常返回,事务自动提交
                    // 方法抛出异常,事务自动回滚
                }

                // 只读事务(优化性能)
                @Transactional(readOnly = true)
                public List<Order> findUserOrders(Long userId) {
                    return orderRepository.findByUserId(userId);
                }

                // 自定义事务传播
                @Transactional(propagation = Propagation.REQUIRES_NEW)
                public void recordAuditLog(AuditLog log) {
                    // 在新事务中执行,不受外部事务影响
                    auditRepository.save(log);
                }
            }

            // 事务配置
            // application.yml
            // datasources:
            //   default:
            //     transaction-manager: jdbc
            //     isolation-level: READ_COMMITTED
            //     timeout: 30s
            ---
    b.声明式缓存
        a.缓存注解
            Micronaut提供@Cacheable、@CachePut、@CacheInvalidate注解实现声明式缓存,支持多种缓存后端。
        b.缓存示例
            ---
            import io.micronaut.cache.annotation.*;
            import jakarta.inject.Singleton;

            @Singleton
            public class ProductService {
                private final ProductRepository repository;

                public ProductService(ProductRepository repository) {
                    this.repository = repository;
                }

                // 缓存查询结果
                @Cacheable(value = "products", parameters = {"id"})
                public Product findById(Long id) {
                    System.out.println("从数据库查询产品: " + id);
                    return repository.findById(id);
                }

                // 更新缓存
                @CachePut(value = "products", parameters = {"id"})
                public Product updateProduct(Long id, Product product) {
                    repository.update(product);
                    return product;
                }

                // 使缓存失效
                @CacheInvalidate(value = "products", parameters = {"id"})
                public void deleteProduct(Long id) {
                    repository.deleteById(id);
                }

                // 使所有缓存失效
                @CacheInvalidate(value = "products", all = true)
                public void clearAllCache() {
                    System.out.println("清除所有产品缓存");
                }

                // 异步缓存
                @Cacheable(value = "products-async", parameters = {"id"})
                public CompletableFuture<Product> findByIdAsync(Long id) {
                    return CompletableFuture.supplyAsync(() ->
                        repository.findById(id));
                }
            }

            // 缓存配置(使用Redis)
            // application.yml
            // redis:
            //   uri: redis://localhost:6379
            // micronaut:
            //   caches:
            //     products:
            //       charset: UTF-8
            //       expire-after-write: 10m
            //       expire-after-access: 5m

            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.cache</groupId>
            //     <artifactId>micronaut-cache-redis</artifactId>
            // </dependency>
            ---
    c.重试机制
        a.@Retryable注解
            Micronaut提供@Retryable注解实现方法重试,自动处理瞬时故障。
        b.重试示例
            ---
            import io.micronaut.retry.annotation.Retryable;
            import io.micronaut.retry.annotation.CircuitBreaker;
            import jakarta.inject.Singleton;

            @Singleton
            public class ExternalApiService {
                private final HttpClient httpClient;

                public ExternalApiService(@Client("external-api") HttpClient httpClient) {
                    this.httpClient = httpClient;
                }

                // 失败时重试,最多3次,延迟1秒
                @Retryable(attempts = "3", delay = "1s")
                public ApiResponse callExternalApi(String endpoint) {
                    System.out.println("调用外部API: " + endpoint);
                    return httpClient.toBlocking()
                        .retrieve(endpoint, ApiResponse.class);
                }

                // 自定义重试条件
                @Retryable(
                    attempts = "5",
                    delay = "2s",
                    multiplier = "2",  // 延迟倍增:2s, 4s, 8s, 16s
                    includes = {IOException.class, TimeoutException.class}
                )
                public Data fetchData(String url) {
                    return httpClient.toBlocking().retrieve(url, Data.class);
                }

                // 熔断器模式
                @CircuitBreaker(
                    attempts = "5",
                    delay = "5s",
                    reset = "30s"  // 30秒后尝试恢复
                )
                public String callUnstableService() {
                    // 连续失败5次后,熔断器打开
                    // 熔断期间直接失败,不调用实际方法
                    // 30秒后尝试恢复(半开状态)
                    return httpClient.toBlocking().retrieve("/unstable");
                }
            }

            // 重试事件监听
            import io.micronaut.retry.event.RetryEvent;
            import io.micronaut.context.event.ApplicationEventListener;

            @Singleton
            public class RetryEventListener implements
                ApplicationEventListener<RetryEvent> {

                @Override
                public void onApplicationEvent(RetryEvent event) {
                    System.out.println("重试事件: 第" + event.getRetryCount() +
                                     "次重试,异常: " + event.getThrowable().getMessage());
                }
            }
            ---

04.代理类生成
    a.子类代理
        a.生成机制
            Micronaut在编译期为需要AOP的类生成子类代理,子类重写被拦截的方法,插入拦截器调用逻辑。
        b.代理类结构
            ---
            // 源代码
            import jakarta.inject.Singleton;

            @Singleton
            public class UserService {
                private final UserRepository repository;

                public UserService(UserRepository repository) {
                    this.repository = repository;
                }

                @Monitor  // 需要AOP拦截
                public User findById(Long id) {
                    return repository.findById(id);
                }

                public void updateUser(User user) {
                    repository.update(user);
                }
            }

            // 编译时生成的代理子类(简化版)
            @Generated
            public class $UserService$Intercepted extends UserService {
                private final ExecutableMethod<UserService, User> findByIdMethod;
                private final Interceptor<User>[] interceptors;

                public $UserService$Intercepted(
                    UserRepository repository,
                    BeanContext beanContext) {
                    super(repository);

                    // 加载方法元数据
                    this.findByIdMethod = beanContext.getExecutableMethod(
                        UserService.class, "findById", Long.class);

                    // 加载拦截器
                    this.interceptors = beanContext.getBeansOfType(
                        Interceptor.class, Qualifiers.byStereotype(Monitor.class));
                }

                @Override
                public User findById(Long id) {
                    // 构建拦截器上下文
                    MethodInvocationContext<UserService, User> context =
                        new MethodInvocationContext<>(
                            this, findByIdMethod, new Object[]{id});

                    // 执行拦截器链
                    return interceptors[0].intercept(context);
                }

                @Override
                public void updateUser(User user) {
                    // 无拦截器的方法直接调用父类
                    super.updateUser(user);
                }
            }

            // 依赖注入时注入代理类
            @Controller("/users")
            public class UserController {
                private final UserService userService;

                public UserController(UserService userService) {
                    // 实际注入的是$UserService$Intercepted实例
                    this.userService = userService;
                }

                @Get("/{id}")
                public User getUser(Long id) {
                    // 调用代理方法,触发拦截器
                    return userService.findById(id);
                }
            }
            ---
    b.代理限制
        a.Final类和方法
            Micronaut使用子类代理,因此无法代理final类和final方法,需要避免使用final修饰需要AOP的类。
        b.Private方法
            私有方法无法被子类重写,因此不能被AOP拦截,拦截器只对public和protected方法有效。

2.5 HTTP客户端与服务器

01.HTTP服务器
    a.Netty服务器架构
        a.事件驱动模型
            Micronaut HTTP服务器基于Netty实现,采用事件驱动的非阻塞IO模型,使用少量线程处理大量并发连接,提供卓越的吞吐量和低延迟。
        b.服务器配置
            ---
            // application.yml
            // micronaut:
            //   server:
            //     port: 8080
            //     host: 0.0.0.0
            //     netty:
            //       max-header-size: 16KB
            //       max-initial-line-length: 8KB
            //       max-chunk-size: 16KB
            //       worker:
            //         threads: 8        # 工作线程数
            //       parent:
            //         threads: 2        # Boss线程数
            //       child-options:
            //         SO_KEEPALIVE: true
            //         TCP_NODELAY: true

            // 服务器事件监听
            import io.micronaut.runtime.server.event.*;
            import io.micronaut.context.event.ApplicationEventListener;
            import jakarta.inject.Singleton;

            @Singleton
            public class ServerEventListener implements
                ApplicationEventListener<ServerStartupEvent> {

                @Override
                public void onApplicationEvent(ServerStartupEvent event) {
                    int port = event.getSource().getPort();
                    String host = event.getSource().getHost();
                    System.out.println("HTTP服务器已启动: " + host + ":" + port);

                    // 输出服务器配置
                    EmbeddedServer server = event.getSource();
                    System.out.println("服务器URL: " + server.getURL());
                    System.out.println("服务器协议: " + server.getScheme());
                }
            }

            // 优雅关闭配置
            // micronaut:
            //   server:
            //     shutdown:
            //       grace-period: 30s  # 优雅关闭等待期
            ---
    b.请求处理流程
        a.Netty管道
            HTTP请求在Netty管道中流转,经过解码器、路由器、过滤器、控制器处理器等多个Handler。
        b.自定义Handler
            ---
            import io.netty.channel.*;
            import io.netty.handler.codec.http.*;
            import io.micronaut.http.netty.channel.ChannelPipelineCustomizer;
            import jakarta.inject.Singleton;

            @Singleton
            public class CustomChannelPipelineCustomizer
                implements ChannelPipelineCustomizer {

                @Override
                public boolean isServerChannel() {
                    return true;  // 作用于服务器端
                }

                @Override
                public void doOnConnect(ChannelPipeline pipeline) {
                    // 在管道中添加自定义Handler
                    pipeline.addAfter(
                        ChannelPipelineCustomizer.HANDLER_HTTP_AGGREGATOR,
                        "custom-logger",
                        new CustomLoggingHandler()
                    );
                }
            }

            // 自定义Handler
            public class CustomLoggingHandler extends ChannelInboundHandlerAdapter {
                @Override
                public void channelRead(ChannelHandlerContext ctx, Object msg) {
                    if (msg instanceof FullHttpRequest) {
                        FullHttpRequest request = (FullHttpRequest) msg;
                        System.out.println("收到请求: " + request.method() +
                                         " " + request.uri());
                    }
                    ctx.fireChannelRead(msg);
                }

                @Override
                public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
                    System.err.println("处理请求出错: " + cause.getMessage());
                    ctx.close();
                }
            }
            ---

02.HTTP客户端
    a.声明式客户端
        a.客户端定义
            通过@Client注解定义HTTP客户端接口,Micronaut在编译时生成实现类,支持同步、异步和响应式调用。
        b.客户端示例
            ---
            import io.micronaut.http.client.annotation.Client;
            import io.micronaut.http.annotation.*;
            import io.reactivex.rxjava3.core.Single;
            import io.reactivex.rxjava3.core.Flowable;

            @Client("https://jsonplaceholder.typicode.com")
            public interface JsonPlaceholderClient {
                // 同步GET请求
                @Get("/posts/{id}")
                Post getPost(Long id);

                // 同步POST请求
                @Post("/posts")
                Post createPost(@Body Post post);

                // 异步GET请求
                @Get("/posts/{id}")
                CompletableFuture<Post> getPostAsync(Long id);

                // 响应式GET请求(单个结果)
                @Get("/posts/{id}")
                Single<Post> getPostReactive(Long id);

                // 响应式GET请求(多个结果)
                @Get("/posts")
                Flowable<Post> getAllPosts();

                // 自定义请求头
                @Get("/posts/{id}")
                @Header(name = "User-Agent", value = "Micronaut-Client")
                Post getPostWithHeader(Long id);

                // 查询参数
                @Get("/posts")
                List<Post> searchPosts(
                    @QueryValue("userId") Long userId,
                    @QueryValue("_limit") Integer limit
                );

                // DELETE请求
                @Delete("/posts/{id}")
                void deletePost(Long id);

                // PUT请��
                @Put("/posts/{id}")
                Post updatePost(Long id, @Body Post post);
            }

            // 使用客户端
            @Singleton
            public class PostService {
                private final JsonPlaceholderClient client;

                public PostService(JsonPlaceholderClient client) {
                    this.client = client;
                }

                public Post getPost(Long id) {
                    return client.getPost(id);
                }

                public void processPostsAsync() {
                    // 异步调用
                    CompletableFuture<Post> future = client.getPostAsync(1L);
                    future.thenAccept(post ->
                        System.out.println("获取到文章: " + post.getTitle())
                    );
                }

                public void processPostsReactive() {
                    // 响应式调用
                    client.getAllPosts()
                        .filter(post -> post.getUserId() == 1)
                        .take(10)
                        .subscribe(post ->
                            System.out.println("文章: " + post.getTitle())
                        );
                }
            }
            ---
    b.低级客户端
        a.HttpClient接口
            对于更复杂的场景,可以直接使用HttpClient接口进行低级HTTP操作,完全控制请求和响应。
        b.低级客户端示例
            ---
            import io.micronaut.http.client.HttpClient;
            import io.micronaut.http.client.annotation.Client;
            import io.micronaut.http.*;
            import jakarta.inject.Singleton;

            @Singleton
            public class CustomHttpService {
                private final HttpClient httpClient;

                public CustomHttpService(@Client("https://api.example.com") HttpClient httpClient) {
                    this.httpClient = httpClient;
                }

                public String makeCustomRequest() {
                    // 构建请求
                    MutableHttpRequest<String> request = HttpRequest
                        .POST("/api/data", "{\"key\":\"value\"}")
                        .contentType(MediaType.APPLICATION_JSON)
                        .header("Authorization", "Bearer token123")
                        .header("X-Custom-Header", "custom-value");

                    // 同步调用
                    HttpResponse<String> response =
                        httpClient.toBlocking().exchange(request, String.class);

                    System.out.println("状态码: " + response.getStatus());
                    System.out.println("响应头: " + response.getHeaders().asMap());
                    return response.body();
                }

                public void makeReactiveRequest() {
                    // 响应式调用
                    Flux<HttpResponse<String>> flux = Flux.from(
                        httpClient.exchange(
                            HttpRequest.GET("/api/items"),
                            String.class
                        )
                    );

                    flux.subscribe(
                        response -> System.out.println("响应: " + response.body()),
                        error -> System.err.println("错误: " + error.getMessage()),
                        () -> System.out.println("完成")
                    );
                }

                public void streamingRequest() {
                    // 流式读取响应
                    Flux<ByteBuffer<?>> stream = Flux.from(
                        httpClient.dataStream(HttpRequest.GET("/api/large-file"))
                    );

                    stream.subscribe(buffer -> {
                        System.out.println("接收数据块: " + buffer.toByteArray().length + " bytes");
                    });
                }
            }
            ---

03.客户端配置
    a.连接池管理
        a.连接池配置
            HTTP客户端使用连接池复用连接,可以配置连接池大小、超时时间、Keep-Alive等参数。
        b.配置示例
            ---
            // application.yml
            // micronaut:
            //   http:
            //     client:
            //       pool:
            //         enabled: true
            //         max-connections: 50      # 最大连接数
            //       read-timeout: 30s          # 读超时
            //       connect-timeout: 10s       # 连接超时
            //       read-idle-timeout: 60s     # 读空闲超时
            //       connection-pool-idle-timeout: 30s

            // 针对特定服务的配置
            // micronaut:
            //   http:
            //     services:
            //       user-service:
            //         urls:
            //           - http://user-service-1:8080
            //           - http://user-service-2:8080
            //         pool:
            //           max-connections: 20
            //         read-timeout: 10s
            //         load-balancer:
            //           strategy: round-robin

            // 代码中配置客户端
            import io.micronaut.http.client.HttpClientConfiguration;
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;

            @Factory
            public class HttpClientFactory {
                @Bean
                @Named("custom-client")
                public HttpClient createCustomClient() {
                    HttpClientConfiguration config = new HttpClientConfiguration();
                    config.setReadTimeout(Duration.ofSeconds(30));
                    config.setConnectTimeout(Duration.ofSeconds(10));
                    config.getPoolConfiguration().setMaxConnections(100);

                    return HttpClient.create(
                        new URL("https://api.example.com"),
                        config
                    );
                }
            }
            ---
    b.负载均衡
        a.客户端负载均衡
            当配置多个服务实例URL时,Micronaut自动实现客户端负载均衡,支持轮询、随机等策略。
        b.负载均衡示例
            ---
            // application.yml配置多个服务实例
            // micronaut:
            //   http:
            //     services:
            //       product-service:
            //         urls:
            //           - http://product-1:8080
            //           - http://product-2:8080
            //           - http://product-3:8080
            //         load-balancer:
            //           strategy: round-robin  # 轮询策略

            // 定义客户端
            @Client(id = "product-service")
            public interface ProductClient {
                @Get("/products/{id}")
                Product getProduct(Long id);
            }

            // Micronaut自动在3个实例间负载均衡
            @Singleton
            public class ProductService {
                private final ProductClient productClient;

                public ProductService(ProductClient productClient) {
                    this.productClient = productClient;
                }

                public Product getProduct(Long id) {
                    // 自动负载均衡到product-1/2/3
                    return productClient.getProduct(id);
                }
            }

            // 自定义负载均衡策略
            import io.micronaut.http.client.loadbalance.ServiceInstanceList;
            import io.micronaut.discovery.ServiceInstance;

            @Singleton
            @Replaces(RoundRobinLoadBalancer.class)
            public class WeightedLoadBalancer implements LoadBalancer {
                @Override
                public Publisher<ServiceInstance> select(ServiceInstanceList instances) {
                    // 根据权重选择实例
                    List<ServiceInstance> list = instances.getInstances();
                    ServiceInstance selected = selectByWeight(list);
                    return Publishers.just(selected);
                }

                private ServiceInstance selectByWeight(List<ServiceInstance> instances) {
                    // 权重选择逻辑
                    return instances.get(0);
                }
            }
            ---

02.服务器端点
    a.Controller定义
        a.控制器注解
            @Controller注解定义HTTP端点,支持路径前缀、版本控制等配置。
        b.控制器示例
            ---
            import io.micronaut.http.annotation.*;
            import io.micronaut.http.HttpResponse;
            import jakarta.inject.Singleton;

            @Controller("/api/v1/users")
            public class UserController {
                private final UserService userService;

                public UserController(UserService userService) {
                    this.userService = userService;
                }

                // GET请求
                @Get("/{id}")
                public User getUser(Long id) {
                    return userService.findById(id);
                }

                // POST请求
                @Post
                public HttpResponse<User> createUser(@Body UserRequest request) {
                    User user = userService.create(request);
                    return HttpResponse.created(user);
                }

                // PUT请求
                @Put("/{id}")
                public User updateUser(Long id, @Body UserRequest request) {
                    return userService.update(id, request);
                }

                // DELETE请求
                @Delete("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void deleteUser(Long id) {
                    userService.delete(id);
                }

                // 查询参数
                @Get
                public List<User> searchUsers(
                    @QueryValue("name") Optional<String> name,
                    @QueryValue("page") @DefaultValue("0") int page,
                    @QueryValue("size") @DefaultValue("20") int size) {
                    return userService.search(name.orElse(null), page, size);
                }

                // 请求头
                @Get("/profile")
                public User getCurrentUser(
                    @Header("Authorization") String authToken) {
                    String userId = extractUserId(authToken);
                    return userService.findById(Long.parseLong(userId));
                }

                // Cookie
                @Get("/preferences")
                public UserPreferences getPreferences(
                    @CookieValue("session_id") String sessionId) {
                    return userService.getPreferences(sessionId);
                }
            }
            ---
    b.响应式端点
        a.响应式返回类型
            控制器方法可以返回响应式类型,实现非阻塞的异步处理。
        b.响应式端点示例
            ---
            import io.micronaut.http.annotation.*;
            import reactor.core.publisher.Mono;
            import reactor.core.publisher.Flux;

            @Controller("/api/products")
            public class ProductController {
                private final ProductService productService;

                public ProductController(ProductService productService) {
                    this.productService = productService;
                }

                // 返回Mono(单个结果)
                @Get("/{id}")
                public Mono<Product> getProduct(Long id) {
                    return productService.findByIdAsync(id);
                }

                // 返回Flux(多个结果)
                @Get
                public Flux<Product> getAllProducts() {
                    return productService.findAllAsync();
                }

                // Server-Sent Events
                @Get(uri = "/stream", produces = MediaType.TEXT_EVENT_STREAM)
                public Flux<Product> streamProducts() {
                    // 持续推送产品更新
                    return productService.watchProductUpdates();
                }

                // 响应式POST
                @Post
                public Mono<HttpResponse<Product>> createProduct(@Body Mono<Product> product) {
                    return product
                        .flatMap(p -> productService.saveAsync(p))
                        .map(HttpResponse::created);
                }
            }

            // 响应式服务实现
            @Singleton
            public class ProductService {
                private final ProductRepository repository;

                public ProductService(ProductRepository repository) {
                    this.repository = repository;
                }

                public Mono<Product> findByIdAsync(Long id) {
                    return Mono.fromCallable(() -> repository.findById(id))
                        .subscribeOn(Schedulers.boundedElastic());
                }

                public Flux<Product> findAllAsync() {
                    return Flux.fromIterable(repository.findAll())
                        .subscribeOn(Schedulers.boundedElastic());
                }

                public Flux<Product> watchProductUpdates() {
                    // 模拟实时推送
                    return Flux.interval(Duration.ofSeconds(5))
                        .map(i -> repository.findLatest());
                }
            }
            ---

03.客户端过滤器
    a.HttpClientFilter
        a.请求拦截
            HttpClientFilter可以拦截所有HTTP客户端请求,用于添加认证头、日志记录、重试等通用逻辑。
        b.过滤器示例
            ---
            import io.micronaut.http.*;
            import io.micronaut.http.annotation.Filter;
            import io.micronaut.http.filter.ClientFilterChain;
            import io.micronaut.http.filter.HttpClientFilter;
            import org.reactivestreams.Publisher;

            // 认证过滤器
            @Filter("/api/**")
            public class AuthFilter implements HttpClientFilter {
                private final TokenProvider tokenProvider;

                public AuthFilter(TokenProvider tokenProvider) {
                    this.tokenProvider = tokenProvider;
                }

                @Override
                public Publisher<? extends HttpResponse<?>> doFilter(
                    MutableHttpRequest<?> request,
                    ClientFilterChain chain) {

                    // 添加认证头
                    String token = tokenProvider.getAccessToken();
                    request.header("Authorization", "Bearer " + token);

                    return chain.proceed(request);
                }
            }

            // 日志过滤器
            @Filter("/**")
            public class LoggingClientFilter implements HttpClientFilter {
                private static final Logger log =
                    LoggerFactory.getLogger(LoggingClientFilter.class);

                @Override
                public Publisher<? extends HttpResponse<?>> doFilter(
                    MutableHttpRequest<?> request,
                    ClientFilterChain chain) {

                    log.info("发送请求: {} {}", request.getMethod(), request.getUri());

                    return Flux.from(chain.proceed(request))
                        .doOnNext(response ->
                            log.info("收到响应: 状态={}", response.getStatus())
                        )
                        .doOnError(error ->
                            log.error("请求失败: {}", error.getMessage())
                        );
                }
            }

            // 重试过滤器
            @Filter("/**")
            public class RetryClientFilter implements HttpClientFilter {
                @Override
                public Publisher<? extends HttpResponse<?>> doFilter(
                    MutableHttpRequest<?> request,
                    ClientFilterChain chain) {

                    return Flux.from(chain.proceed(request))
                        .retryWhen(Retry.backoff(3, Duration.ofSeconds(1))
                            .filter(throwable -> throwable instanceof IOException)
                        );
                }
            }
            ---
    b.自定义序列化
        a.MediaTypeCodec
            可以注册自定义的编解码器,支持自定义序列化格式。
        b.自定义编解码器
            ---
            import io.micronaut.http.codec.MediaTypeCodec;
            import io.micronaut.http.MediaType;
            import jakarta.inject.Singleton;
            import java.io.*;

            @Singleton
            public class CustomXmlCodec implements MediaTypeCodec {
                @Override
                public Collection<MediaType> getMediaTypes() {
                    return Collections.singletonList(MediaType.APPLICATION_XML_TYPE);
                }

                @Override
                public <T> T decode(Argument<T> type, InputStream inputStream)
                    throws CodecException {
                    // 自定义XML反序列化
                    try {
                        String xml = new String(inputStream.readAllBytes());
                        // 解析XML
                        return parseXml(xml, type.getType());
                    } catch (IOException e) {
                        throw new CodecException("XML解析失败", e);
                    }
                }

                @Override
                public <T> void encode(T object, OutputStream outputStream)
                    throws CodecException {
                    // 自定义XML序列化
                    try {
                        String xml = toXml(object);
                        outputStream.write(xml.getBytes());
                    } catch (IOException e) {
                        throw new CodecException("XML生成失败", e);
                    }
                }

                private <T> T parseXml(String xml, Class<T> type) {
                    // XML解析逻辑
                    return null;
                }

                private String toXml(Object object) {
                    // XML生成逻辑
                    return "";
                }
            }
            ---

2.6 配置管理

01.配置加载
    a.配置源优先级
        a.优先级顺序
            Micronaut从多个配置源加载配置,按优先级从高到低依次为命令行参数、系统属性、环境变量、application-{env}.yml、application.yml,高优先级配置会覆盖低优先级配置。
        b.配置加载示例
            ---
            // application.yml(优先级最低)
            // datasource:
            //   url: jdbc:h2:mem:default
            //   username: sa
            //   password: ""
            //   pool:
            //     max-size: 10

            // application-prod.yml(环境配置,优先级更高)
            // datasource:
            //   url: jdbc:mysql://prod-db:3306/mydb
            //   username: prod_user
            //   password: ${DB_PASSWORD}  # 从环境变量读取

            // 环境变量(优先级更高)
            // export DB_PASSWORD=secret123
            // export DATASOURCE_POOL_MAX_SIZE=50

            // 系统属性(优先级更高)
            // java -Ddatasource.url=jdbc:mysql://override:3306/db -jar app.jar

            // 命令行参数(优先级最高)
            // java -jar app.jar --datasource.username=admin

            // 最终生效的配置
            import io.micronaut.context.env.Environment;

            @Singleton
            public class ConfigInspector {
                private final Environment environment;

                public ConfigInspector(Environment environment) {
                    this.environment = environment;
                }

                public void printConfig() {
                    // 读取最终生效的配置
                    String url = environment.getProperty("datasource.url", String.class)
                        .orElse("unknown");
                    String username = environment.getProperty("datasource.username", String.class)
                        .orElse("unknown");
                    Integer poolSize = environment.getProperty("datasource.pool.max-size",
                        Integer.class).orElse(10);

                    System.out.println("数据库URL: " + url);
                    System.out.println("用户名: " + username);
                    System.out.println("连接池大小: " + poolSize);
                }
            }
            ---
    b.配置文件格式
        a.支持的格式
            Micronaut支持YAML、Properties、JSON、HOCON等多种配置文件格式,推荐使用YAML格式。
        b.格式示例
            ---
            // application.yml(YAML格式,推荐)
            // micronaut:
            //   application:
            //     name: order-service
            //   server:
            //     port: 8080
            // datasource:
            //   url: jdbc:mysql://localhost:3306/mydb
            //   pool:
            //     max-size: 20

            // application.properties(Properties格式)
            // micronaut.application.name=order-service
            // micronaut.server.port=8080
            // datasource.url=jdbc:mysql://localhost:3306/mydb
            // datasource.pool.max-size=20

            // application.json(JSON格式)
            // {
            //   "micronaut": {
            //     "application": {
            //       "name": "order-service"
            //     },
            //     "server": {
            //       "port": 8080
            //     }
            //   },
            //   "datasource": {
            //     "url": "jdbc:mysql://localhost:3306/mydb",
            //     "pool": {
            //       "max-size": 20
            //     }
            //   }
            // }

            // 指定配置文件
            // java -Dmicronaut.config.files=file:/path/to/config.yml -jar app.jar
            ---

02.配置绑定
    a.@ConfigurationProperties
        a.类型安全配置
            @ConfigurationProperties注解将配置绑定到POJO类,提供类型安全的配置访问,支持嵌套配置和验证。
        b.配置类示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import io.micronaut.core.annotation.Nullable;
            import jakarta.validation.constraints.*;
            import java.time.Duration;

            @ConfigurationProperties("app")
            public class AppConfig {
                @NotBlank
                private String name;

                @NotBlank
                private String version;

                @Min(1)
                @Max(65535)
                private int port = 8080;

                @Nullable
                private Duration requestTimeout;

                private DatabaseConfig database;
                private CacheConfig cache;

                // getter和setter省略

                @ConfigurationProperties("database")
                public static class DatabaseConfig {
                    @NotBlank
                    private String url;

                    @NotBlank
                    private String username;

                    @NotBlank
                    private String password;

                    @Min(1)
                    @Max(1000)
                    private int maxConnections = 50;

                    private PoolConfig pool;

                    @ConfigurationProperties("pool")
                    public static class PoolConfig {
                        private Duration maxLifetime = Duration.ofMinutes(30);
                        private Duration idleTimeout = Duration.ofMinutes(10);

                        // getter和setter省略
                    }

                    // getter和setter省略
                }

                @ConfigurationProperties("cache")
                public static class CacheConfig {
                    private boolean enabled = true;
                    private String provider = "caffeine";
                    private Duration ttl = Duration.ofMinutes(10);

                    // getter和setter省略
                }
            }

            // application.yml
            // app:
            //   name: my-service
            //   version: 1.0.0
            //   port: 9090
            //   request-timeout: 30s
            //   database:
            //     url: jdbc:postgresql://localhost:5432/mydb
            //     username: dbuser
            //     password: dbpass
            //     max-connections: 100
            //     pool:
            //       max-lifetime: 60m
            //       idle-timeout: 20m
            //   cache:
            //     enabled: true
            //     provider: redis
            //     ttl: 5m

            // 使用配置
            @Singleton
            public class AppService {
                private final AppConfig config;

                public AppService(AppConfig config) {
                    this.config = config;
                    System.out.println("应用名称: " + config.getName());
                    System.out.println("数据库URL: " + config.getDatabase().getUrl());
                    System.out.println("缓存提供者: " + config.getCache().getProvider());
                }
            }
            ---
    b.@Value注入
        a.属性值注入
            @Value注解直接将配置属性注入到字段或方法参数,支持占位符和默认值。
        b.Value注入示例
            ---
            import io.micronaut.context.annotation.Value;
            import jakarta.inject.Singleton;

            @Singleton
            public class ServiceConfig {
                @Value("${micronaut.application.name}")
                private String appName;

                @Value("${micronaut.server.port:8080}")  // 默认值8080
                private int serverPort;

                @Value("${api.timeout:30s}")
                private Duration apiTimeout;

                @Value("${feature.enabled:false}")
                private boolean featureEnabled;

                @Value("${api.base-url}")
                private String apiBaseUrl;

                public void printConfig() {
                    System.out.println("应用名: " + appName);
                    System.out.println("端口: " + serverPort);
                    System.out.println("API超时: " + apiTimeout);
                    System.out.println("功能启用: " + featureEnabled);
                    System.out.println("API地址: " + apiBaseUrl);
                }
            }

            // 构造器注入配置值
            @Singleton
            public class EmailService {
                private final String smtpHost;
                private final int smtpPort;
                private final String from;

                public EmailService(
                    @Value("${email.smtp.host}") String smtpHost,
                    @Value("${email.smtp.port:587}") int smtpPort,
                    @Value("${email.from}") String from) {
                    this.smtpHost = smtpHost;
                    this.smtpPort = smtpPort;
                    this.from = from;
                }

                public void sendEmail(String to, String subject, String body) {
                    System.out.println("SMTP服务器: " + smtpHost + ":" + smtpPort);
                    System.out.println("发件人: " + from);
                }
            }
            ---

03.动态配置
    a.@Refreshable刷新
        a.配置刷新机制
            @Refreshable注解标记的Bean在配置变更时会被重新创建,实现配置的动态更新。
        b.刷新示例
            ---
            import io.micronaut.context.annotation.Refreshable;
            import io.micronaut.context.annotation.ConfigurationProperties;

            @Refreshable  // 可刷新Bean
            @ConfigurationProperties("dynamic")
            public class DynamicConfig {
                private int maxConnections;
                private Duration timeout;
                private boolean debugMode;

                public DynamicConfig() {
                    System.out.println("DynamicConfig创建");
                }

                // getter和setter省略
            }

            @Singleton
            public class ConnectionManager {
                private final DynamicConfig config;

                public ConnectionManager(DynamicConfig config) {
                    this.config = config;
                }

                public void createConnection() {
                    // 总是使用最新的配置值
                    int max = config.getMaxConnections();
                    System.out.println("最大连接数: " + max);
                }
            }

            // 触发配置刷新
            // POST http://localhost:8080/refresh
            // 返回:{"changed": ["dynamic.max-connections", "dynamic.timeout"]}

            // 配置刷新流程
            // 1. 接收/refresh请求
            // 2. 重新加载配置文件
            // 3. 对比配置变更
            // 4. 销毁@Refreshable Bean
            // 5. 重新创建Bean(使用新配置)
            // 6. 返回变更的配置项列表

            // 启用refresh端点
            // application.yml
            // endpoints:
            //   refresh:
            //     enabled: true
            //     sensitive: false
            ---
    b.配置监听
        a.RefreshEvent
            可以监听配置刷新事件,在配置变更时执行自定义逻辑。
        b.刷新事件监听
            ---
            import io.micronaut.runtime.context.scope.refresh.RefreshEvent;
            import io.micronaut.context.event.ApplicationEventListener;
            import jakarta.inject.Singleton;

            @Singleton
            public class ConfigRefreshListener implements
                ApplicationEventListener<RefreshEvent> {

                private final ConnectionPool connectionPool;
                private final CacheManager cacheManager;

                public ConfigRefreshListener(ConnectionPool connectionPool,
                                           CacheManager cacheManager) {
                    this.connectionPool = connectionPool;
                    this.cacheManager = cacheManager;
                }

                @Override
                public void onApplicationEvent(RefreshEvent event) {
                    Set<String> changedKeys = event.getChanges();

                    System.out.println("配置已刷新,变更项: " + changedKeys);

                    // 如果数据库配置变更,重新初始化连接池
                    if (changedKeys.stream().anyMatch(key -> key.startsWith("datasource"))) {
                        connectionPool.reinitialize();
                    }

                    // 如果缓存配置变更,清除缓存
                    if (changedKeys.stream().anyMatch(key -> key.startsWith("cache"))) {
                        cacheManager.clearAll();
                    }
                }
            }
            ---

04.外部配置中心
    a.Consul配置
        a.Consul KV集成
            Micronaut支持从Consul KV存储读取配置,实现配置的集中管理和动态更新。
        b.Consul配置示例
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.discovery</groupId>
            //     <artifactId>micronaut-discovery-client</artifactId>
            // </dependency>

            // bootstrap.yml(在application.yml之前加载)
            // micronaut:
            //   application:
            //     name: order-service
            //   config-client:
            //     enabled: true
            // consul:
            //   client:
            //     config:
            //       enabled: true
            //       format: YAML
            //     defaultZone: ${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}

            // Consul KV存储结构
            // config/
            //   application/           # 全局配置(所有应用共享)
            //     data: |
            //       logging:
            //         level: INFO
            //   order-service/         # 应用特定配置
            //     data: |
            //       order:
            //         max-items: 100
            //         timeout: 30s
            //   order-service,prod/    # 环境特定配置
            //     data: |
            //       datasource:
            //         url: jdbc:mysql://prod-db/orderdb

            // 配置读取
            @ConfigurationProperties("order")
            @Refreshable  // 支持Consul配置变更推送
            public class OrderConfig {
                private int maxItems;
                private Duration timeout;

                // getter和setter省略
            }

            // 使用配置
            @Singleton
            public class OrderService {
                private final OrderConfig config;

                public OrderService(OrderConfig config) {
                    this.config = config;
                }

                public void processOrder(Order order) {
                    int maxItems = config.getMaxItems();  // 从Consul读取
                    if (order.getItems().size() > maxItems) {
                        throw new IllegalArgumentException("订单商品数超过限制");
                    }
                }
            }

            // Consul配置变更自动刷新
            // 1. 在Consul UI修改配置
            // 2. Micronaut自动检测变更
            // 3. 发布RefreshEvent
            // 4. 重新创建@Refreshable Bean
            ---
    b.AWS Parameter Store
        a.AWS集成
            Micronaut支持从AWS Systems Manager Parameter Store读取配置,适合AWS云环境。
        b.AWS配置示例
            ---
            // Maven依赖
            // <dependency>
            //     <groupId>io.micronaut.aws</groupId>
            //     <artifactId>micronaut-aws-parameter-store</artifactId>
            // </dependency>

            // bootstrap.yml
            // aws:
            //   client:
            //     system-manager:
            //       parameterstore:
            //         enabled: true
            //         useSecureParameters: true
            // micronaut:
            //   application:
            //     name: order-service
            //   config-client:
            //     enabled: true

            // AWS Parameter Store结构
            // /config/application/             # 全局配置
            //   database.url
            //   database.username
            // /config/order-service/           # 应用配置
            //   order.max-items
            //   order.timeout
            // /config/order-service_prod/      # 环境配置
            //   database.password              # 使用SecureString加密

            // 配置类
            @ConfigurationProperties("order")
            public class OrderConfig {
                private int maxItems;
                private Duration timeout;

                // getter和setter省略
            }

            // AWS IAM权限要求
            // {
            //   "Version": "2012-10-17",
            //   "Statement": [{
            //     "Effect": "Allow",
            //     "Action": [
            //       "ssm:GetParameter",
            //       "ssm:GetParameters",
            //       "ssm:GetParametersByPath"
            //     ],
            //     "Resource": "arn:aws:ssm:*:*:parameter/config/*"
            //   }]
            // }
            ---

03.环境变量注入
    a.环境变量映射
        a.命名约定
            环境变量名使用大写字母和下划线,Micronaut自动映射到配置属性,如DATASOURCE_URL映射到datasource.url。
        b.环境变量示例
            ---
            // 环境变量定义
            // export MICRONAUT_APPLICATION_NAME=my-service
            // export MICRONAUT_SERVER_PORT=9090
            // export DATASOURCE_URL=jdbc:mysql://db:3306/mydb
            // export DATASOURCE_USERNAME=dbuser
            // export DATASOURCE_PASSWORD=secret123
            // export APP_FEATURE_ENABLED=true
            // export APP_MAX_CONNECTIONS=50

            // 配置类
            @ConfigurationProperties("app")
            public class AppConfig {
                private boolean featureEnabled;
                private int maxConnections;

                // getter和setter省略
            }

            // 读取配置
            @Singleton
            public class ConfigService {
                private final AppConfig appConfig;
                private final Environment environment;

                public ConfigService(AppConfig appConfig, Environment environment) {
                    this.appConfig = appConfig;
                    this.environment = environment;
                }

                public void printConfig() {
                    // 通过ConfigurationProperties读取
                    System.out.println("功能启用: " + appConfig.isFeatureEnabled());
                    System.out.println("最大连接: " + appConfig.getMaxConnections());

                    // 直接从Environment读取
                    String appName = environment.getProperty("micronaut.application.name",
                        String.class).orElse("unknown");
                    System.out.println("应用名: " + appName);

                    // 读取原始环境变量
                    String javaHome = System.getenv("JAVA_HOME");
                    System.out.println("JAVA_HOME: " + javaHome);
                }
            }

            // Docker Compose配置
            // version: '3.8'
            // services:
            //   app:
            //     image: micronaut-app:latest
            //     environment:
            //       - MICRONAUT_ENVIRONMENTS=prod
            //       - DATASOURCE_URL=jdbc:mysql://mysql:3306/proddb
            //       - DATASOURCE_USERNAME=produser
            //       - DATASOURCE_PASSWORD=${DB_PASSWORD}
            //       - APP_MAX_CONNECTIONS=100
            //     env_file:
            //       - .env.prod
            ---
    b.占位符解析
        a.属性占位符
            配置中可以使用${...}占位符引用其他配置属性或环境变量。
        b.占位符示例
            ---
            // application.yml
            // app:
            //   name: order-service
            //   version: 1.0.0
            //   display-name: ${app.name} v${app.version}  # 引用其他属性
            //
            // datasource:
            //   host: ${DB_HOST:localhost}                 # 从环境变量读取,默认localhost
            //   port: ${DB_PORT:3306}
            //   database: ${DB_NAME:mydb}
            //   url: jdbc:mysql://${datasource.host}:${datasource.port}/${datasource.database}
            //   username: ${DB_USER:root}
            //   password: ${DB_PASSWORD:}
            //
            // api:
            //   base-url: ${API_PROTOCOL:http}://${API_HOST}:${API_PORT:8080}
            //   endpoints:
            //     users: ${api.base-url}/users
            //     orders: ${api.base-url}/orders

            // 读取配置
            @Singleton
            public class ApiClient {
                @Value("${api.endpoints.users}")
                private String usersEndpoint;

                @Value("${api.endpoints.orders}")
                private String ordersEndpoint;

                public void printEndpoints() {
                    System.out.println("用户API: " + usersEndpoint);
                    System.out.println("订单API: " + ordersEndpoint);
                }
            }

            // 环境变量
            // export DB_HOST=prod-db.example.com
            // export DB_PORT=3306
            // export DB_NAME=production
            // export DB_USER=prod_user
            // export DB_PASSWORD=secret123
            // export API_HOST=api.example.com
            // export API_PORT=443
            // export API_PROTOCOL=https

            // 最终配置值
            // datasource.url=jdbc:mysql://prod-db.example.com:3306/production
            // api.endpoints.users=https://api.example.com:443/users
            ---

2.7 附:Bean生命周期

01.生命周期阶段
    a.Bean创建阶段
        a.实例化顺序
            BeanContext根据依赖关系图按拓扑顺序创建Bean,确保依赖的Bean先于依赖它的Bean创建,避免依赖未就绪的问题。
        b.创建流程
            ---
            // Bean创建流程示例
            import jakarta.inject.Singleton;
            import jakarta.annotation.PostConstruct;

            // 第1个创建:无依赖
            @Singleton
            public class ConfigLoader {
                public ConfigLoader() {
                    System.out.println("步骤1: ConfigLoader构造器执行");
                }

                @PostConstruct
                public void init() {
                    System.out.println("步骤2: ConfigLoader初始化");
                }
            }

            // 第2个创建:依赖ConfigLoader
            @Singleton
            public class DataSource {
                private final ConfigLoader configLoader;

                public DataSource(ConfigLoader configLoader) {
                    System.out.println("步骤3: DataSource构造器执行");
                    this.configLoader = configLoader;
                }

                @PostConstruct
                public void init() {
                    System.out.println("步骤4: DataSource初始化");
                }
            }

            // 第3个创建:依赖DataSource
            @Singleton
            public class UserRepository {
                private final DataSource dataSource;

                public UserRepository(DataSource dataSource) {
                    System.out.println("步骤5: UserRepository构造器执行");
                    this.dataSource = dataSource;
                }

                @PostConstruct
                public void init() {
                    System.out.println("步骤6: UserRepository初始化");
                }
            }

            // 第4个创建:依赖UserRepository
            @Singleton
            public class UserService {
                private final UserRepository repository;

                public UserService(UserRepository repository) {
                    System.out.println("步骤7: UserService构造器执行");
                    this.repository = repository;
                }

                @PostConstruct
                public void init() {
                    System.out.println("步骤8: UserService初始化");
                }
            }

            // 应用启动输出
            // 步骤1: ConfigLoader构造器执行
            // 步骤2: ConfigLoader初始化
            // 步骤3: DataSource构造器执行
            // 步骤4: DataSource初始化
            // 步骤5: UserRepository构造器执行
            // 步骤6: UserRepository初始化
            // 步骤7: UserService构造器执行
            // 步骤8: UserService初始化
            ---
    b.初始化回调
        a.@PostConstruct注解
            @PostConstruct方法在Bean构造完成、依赖注入完成后执行,用于初始化资源、建立连接等操作。
        b.PostConstruct示例
            ---
            import jakarta.annotation.PostConstruct;
            import jakarta.inject.Singleton;
            import java.sql.Connection;

            @Singleton
            public class DatabaseInitializer {
                private final DataSource dataSource;
                private Connection connection;

                public DatabaseInitializer(DataSource dataSource) {
                    this.dataSource = dataSource;
                    System.out.println("构造器:dataSource注入完成");
                }

                @PostConstruct
                public void initialize() {
                    System.out.println("@PostConstruct:开始初始化");

                    try {
                        // 建立数据库连接
                        connection = dataSource.getConnection();
                        System.out.println("数据库连接已建立");

                        // 执行初始化SQL
                        Statement stmt = connection.createStatement();
                        stmt.execute("CREATE TABLE IF NOT EXISTS users (...)");
                        System.out.println("数据库表初始化完成");

                    } catch (SQLException e) {
                        throw new RuntimeException("数据库初始化失败", e);
                    }
                }

                public Connection getConnection() {
                    return connection;
                }
            }

            // 多个@PostConstruct方法
            @Singleton
            public class MultiInitBean {
                @PostConstruct
                public void init1() {
                    System.out.println("初始化步骤1");
                }

                @PostConstruct
                public void init2() {
                    System.out.println("初始化步骤2");
                }
                // 执行顺序不确定,避免依赖顺序
            }
            ---

02.生命周期事件
    a.ApplicationEventListener
        a.事件类型
            Micronaut提供丰富的生命周期事件,包括启动事件、关闭事件、Bean创建事件等,可以监听这些事件执行自定义逻辑。
        b.事件监听示例
            ---
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.runtime.event.*;
            import io.micronaut.context.event.*;
            import jakarta.inject.Singleton;

            // 监听应用启动事件
            @Singleton
            public class StartupInitializer implements
                ApplicationEventListener<ApplicationStartupEvent> {

                @Inject
                private DataMigrationService migrationService;

                @Override
                public void onApplicationEvent(ApplicationStartupEvent event) {
                    System.out.println("应用启动完成,执行数据迁移");
                    migrationService.migrate();
                }
            }

            // 监听服务器启动事件
            @Singleton
            public class ServerReadyListener implements
                ApplicationEventListener<ServerStartupEvent> {

                @Override
                public void onApplicationEvent(ServerStartupEvent event) {
                    EmbeddedServer server = event.getSource();
                    System.out.println("服务器已就绪: " + server.getURL());

                    // 注册到服务发现
                    registerToServiceDiscovery(server);
                }

                private void registerToServiceDiscovery(EmbeddedServer server) {
                    // 服务注册逻辑
                }
            }

            // 监听应用关闭事件
            @Singleton
            public class ShutdownHandler implements
                ApplicationEventListener<ShutdownEvent> {

                @Inject
                private ConnectionPool connectionPool;

                @Override
                public void onApplicationEvent(ShutdownEvent event) {
                    System.out.println("应用即将关闭,清理资源");

                    // 关闭连接池
                    connectionPool.close();

                    // 注销服务
                    deregisterFromServiceDiscovery();
                }

                private void deregisterFromServiceDiscovery() {
                    // 服务注销逻辑
                }
            }

            // 监听Bean创建事件
            import io.micronaut.context.event.BeanCreatedEvent;

            @Singleton
            public class DataSourceListener implements
                ApplicationEventListener<BeanCreatedEvent<DataSource>> {

                @Override
                public void onApplicationEvent(BeanCreatedEvent<DataSource> event) {
                    DataSource dataSource = event.getBean();
                    System.out.println("DataSource Bean已创建");

                    // 配置连接池
                    if (dataSource instanceof HikariDataSource) {
                        HikariDataSource hikari = (HikariDataSource) dataSource;
                        hikari.setMaximumPoolSize(50);
                    }
                }
            }
            ---
    b.自定义生命周期事件
        a.事件定义与发布
            可以定义自定义生命周期事件,通过ApplicationEventPublisher发布,实现组件间解耦通信。
        b.自定义事件示例
            ---
            // 定义数据迁移事件
            public class DataMigrationEvent {
                private final String version;
                private final boolean success;
                private final long duration;

                public DataMigrationEvent(String version, boolean success, long duration) {
                    this.version = version;
                    this.success = success;
                    this.duration = duration;
                }

                public String getVersion() { return version; }
                public boolean isSuccess() { return success; }
                public long getDuration() { return duration; }
            }

            // 发布事件
            import io.micronaut.context.event.ApplicationEventPublisher;

            @Singleton
            public class DataMigrationService {
                private final ApplicationEventPublisher<DataMigrationEvent> eventPublisher;

                public DataMigrationService(
                    ApplicationEventPublisher<DataMigrationEvent> eventPublisher) {
                    this.eventPublisher = eventPublisher;
                }

                public void migrate() {
                    long start = System.currentTimeMillis();
                    String version = "1.0.0";

                    try {
                        // 执行迁移
                        executeMigration(version);

                        long duration = System.currentTimeMillis() - start;
                        // 发布成功事件
                        eventPublisher.publishEvent(
                            new DataMigrationEvent(version, true, duration));

                    } catch (Exception e) {
                        long duration = System.currentTimeMillis() - start;
                        // 发布失败事件
                        eventPublisher.publishEvent(
                            new DataMigrationEvent(version, false, duration));
                        throw e;
                    }
                }

                private void executeMigration(String version) {
                    // 迁移逻辑
                }
            }

            // 监听迁移事件
            @Singleton
            public class MigrationEventListener implements
                ApplicationEventListener<DataMigrationEvent> {

                @Inject
                private AuditLogger auditLogger;

                @Inject
                private MetricsService metricsService;

                @Override
                public void onApplicationEvent(DataMigrationEvent event) {
                    // 记录审计日���
                    auditLogger.log("数据迁移",
                        "版本: " + event.getVersion() +
                        ", 结果: " + (event.isSuccess() ? "成功" : "失败") +
                        ", 耗时: " + event.getDuration() + "ms");

                    // 记录指标
                    metricsService.recordMigration(
                        event.getVersion(),
                        event.isSuccess(),
                        event.getDuration()
                    );

                    // 失败时告警
                    if (!event.isSuccess()) {
                        sendAlert("数据迁移失败: " + event.getVersion());
                    }
                }

                private void sendAlert(String message) {
                    // 发送告警
                }
            }
            ---

03.Bean销毁
    a.@PreDestroy注解
        a.销毁回调
            @PreDestroy方法在Bean销毁前执行,用于关闭连接、释放资源、清理缓存等清理操作。
        b.PreDestroy示例
            ---
            import jakarta.annotation.PreDestroy;
            import jakarta.inject.Singleton;

            @Singleton
            public class ConnectionManager {
                private final List<Connection> connections = new ArrayList<>();

                public Connection getConnection() {
                    Connection conn = createConnection();
                    connections.add(conn);
                    return conn;
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("@PreDestroy:开始清理连接");

                    for (Connection conn : connections) {
                        try {
                            if (!conn.isClosed()) {
                                conn.close();
                                System.out.println("连接已关闭");
                            }
                        } catch (SQLException e) {
                            System.err.println("关闭连接失败: " + e.getMessage());
                        }
                    }

                    connections.clear();
                    System.out.println("所有连接已清理");
                }

                private Connection createConnection() {
                    // 创建连接
                    return null;
                }
            }

            // 实现Closeable接口
            @Singleton
            public class ResourceHolder implements Closeable {
                private InputStream inputStream;

                public ResourceHolder() throws IOException {
                    this.inputStream = new FileInputStream("/data/resource.dat");
                }

                @Override
                @PreDestroy
                public void close() throws IOException {
                    if (inputStream != null) {
                        inputStream.close();
                        System.out.println("资源已关闭");
                    }
                }
            }
            ---
    b.销毁顺序
        a.依赖反向销毁
            Bean销毁顺序与创建顺序相反,先销毁依赖其他Bean的Bean,后销毁被依赖的Bean,确保销毁时依赖仍可用。
        b.销毁顺序示例
            ---
            // Bean依赖关系:Controller -> Service -> Repository -> DataSource

            @Singleton
            public class DataSource {
                @PreDestroy
                public void close() {
                    System.out.println("4. DataSource销毁");
                }
            }

            @Singleton
            public class Repository {
                private final DataSource dataSource;

                public Repository(DataSource dataSource) {
                    this.dataSource = dataSource;
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("3. Repository销毁");
                }
            }

            @Singleton
            public class Service {
                private final Repository repository;

                public Service(Repository repository) {
                    this.repository = repository;
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("2. Service销毁");
                }
            }

            @Controller("/api")
            public class Controller {
                private final Service service;

                public Controller(Service service) {
                    this.service = service;
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("1. Controller销毁");
                }
            }

            // 应用关闭输出顺序
            // 1. Controller销毁
            // 2. Service销毁
            // 3. Repository销毁
            // 4. DataSource销毁
            ---

02.生命周期接口
    a.Lifecycle接口
        a.接口定义
            实现io.micronaut.context.LifeCycle接口可以更精细地控制Bean的启动和停止逻辑。
        b.Lifecycle实现
            ---
            import io.micronaut.context.LifeCycle;
            import jakarta.inject.Singleton;

            @Singleton
            public class BackgroundTaskManager implements LifeCycle<BackgroundTaskManager> {
                private ScheduledExecutorService executor;
                private volatile boolean running = false;

                @Override
                public BackgroundTaskManager start() {
                    System.out.println("启动后台任务管理器");
                    executor = Executors.newScheduledThreadPool(4);
                    running = true;

                    // 启动定时任务
                    executor.scheduleAtFixedRate(
                        () -> System.out.println("执行后台任务"),
                        0, 10, TimeUnit.SECONDS
                    );

                    return this;
                }

                @Override
                public BackgroundTaskManager stop() {
                    System.out.println("停止后台任务管理器");
                    running = false;

                    if (executor != null) {
                        executor.shutdown();
                        try {
                            if (!executor.awaitTermination(30, TimeUnit.SECONDS)) {
                                executor.shutdownNow();
                            }
                        } catch (InterruptedException e) {
                            executor.shutdownNow();
                        }
                    }

                    return this;
                }

                @Override
                public boolean isRunning() {
                    return running;
                }
            }

            // 启动和停止由BeanContext自动管理
            // 应用启动时自动调用start()
            // 应用关闭时自动调用stop()
            ---
    b.DisposableBean接口
        a.资源释放
            实现DisposableBean接口的dispose()方法,在Bean销毁时释放资源。
        b.DisposableBean示例
            ---
            import io.micronaut.context.annotation.Bean;
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.core.io.Closeable;

            @Factory
            public class ResourceFactory {
                @Bean
                @Singleton
                public CustomResource createResource() {
                    return new CustomResource();
                }
            }

            public class CustomResource implements Closeable {
                private final FileChannel channel;

                public CustomResource() throws IOException {
                    this.channel = FileChannel.open(
                        Paths.get("/data/resource.dat"),
                        StandardOpenOption.READ
                    );
                    System.out.println("资源已打开");
                }

                public ByteBuffer read(int size) throws IOException {
                    ByteBuffer buffer = ByteBuffer.allocate(size);
                    channel.read(buffer);
                    return buffer;
                }

                @Override
                public void close() throws IOException {
                    if (channel != null && channel.isOpen()) {
                        channel.close();
                        System.out.println("资源已关闭");
                    }
                }
            }

            // BeanContext关闭时自动调用close()
            ---

03.作用域生命周期
    a.RequestScope生命周期
        a.请求级Bean
            @RequestScope标记的Bean在每个HTTP请求开始时创建,请求结束时销毁,适合存储请求级上下文信息。
        b.RequestScope示例
            ---
            import io.micronaut.runtime.http.scope.RequestScope;
            import jakarta.annotation.PreDestroy;

            @RequestScope
            public class RequestTraceContext {
                private final String traceId;
                private final long startTime;
                private Map<String, Object> attributes;

                public RequestTraceContext() {
                    this.traceId = UUID.randomUUID().toString();
                    this.startTime = System.currentTimeMillis();
                    this.attributes = new HashMap<>();
                    System.out.println("请求上下文创建: " + traceId);
                }

                public void setAttribute(String key, Object value) {
                    attributes.put(key, value);
                }

                public Object getAttribute(String key) {
                    return attributes.get(key);
                }

                public String getTraceId() {
                    return traceId;
                }

                public long getElapsedTime() {
                    return System.currentTimeMillis() - startTime;
                }

                @PreDestroy
                public void cleanup() {
                    long duration = getElapsedTime();
                    System.out.println("请求完成: " + traceId + ", 耗时: " + duration + "ms");
                    attributes.clear();
                }
            }

            // 在同一请求中共享RequestTraceContext
            @Controller("/api")
            public class ApiController {
                private final RequestTraceContext traceContext;
                private final LogService logService;

                public ApiController(RequestTraceContext traceContext,
                                   LogService logService) {
                    this.traceContext = traceContext;
                    this.logService = logService;
                }

                @Get("/users/{id}")
                public User getUser(Long id) {
                    traceContext.setAttribute("user_id", id);
                    logService.log("查询用户: " + id);
                    return userService.findById(id);
                }
            }

            @Singleton
            public class LogService {
                private final RequestTraceContext traceContext;  // 同一实例

                public LogService(RequestTraceContext traceContext) {
                    this.traceContext = traceContext;
                }

                public void log(String message) {
                    System.out.println("[" + traceContext.getTraceId() + "] " + message);
                }
            }
            ---
    b.Refreshable生命周期
        a.配置刷新重建
            @Refreshable标记的Bean在配置刷新时会被销毁并重新创建,获取最新的配置值。
        b.Refreshable示例
            ---
            import io.micronaut.context.annotation.Refreshable;
            import io.micronaut.context.annotation.ConfigurationProperties;
            import jakarta.annotation.PostConstruct;
            import jakarta.annotation.PreDestroy;

            @Refreshable
            @ConfigurationProperties("cache")
            public class CacheConfig {
                private int maxSize;
                private Duration ttl;

                public CacheConfig() {
                    System.out.println("CacheConfig创建");
                }

                @PostConstruct
                public void init() {
                    System.out.println("CacheConfig初始化: maxSize=" + maxSize +
                                     ", ttl=" + ttl);
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("CacheConfig销毁(配置已变更)");
                }

                // getter和setter省略
            }

            @Singleton
            public class CacheManager {
                private final CacheConfig config;

                public CacheManager(CacheConfig config) {
                    this.config = config;
                }

                public void printConfig() {
                    // 总是访问最新的CacheConfig实例
                    System.out.println("当前缓存配置: " + config.getMaxSize());
                }
            }

            // 配置刷新流程
            // 1. POST /refresh
            // 2. 重新加载配置文件
            // 3. 调用CacheConfig.cleanup()(@PreDestroy)
            // 4. 销毁旧CacheConfig实例
            // 5. 创建新CacheConfig实例
            // 6. 调用CacheConfig.init()(@PostConstruct)
            // 7. 重新注入到CacheManager
            ---

04.优雅关闭
    a.关闭流程
        a.优雅关闭机制
            应用接收到关闭信号时,先停止接受新请求,等待现有请求处理完成,然后依次销毁Bean,最后关闭线程池。
        b.关闭流程示例
            ---
            // application.yml配置
            // micronaut:
            //   server:
            //     shutdown:
            //       grace-period: 30s  # 优雅关闭等待时间

            // 监控关闭过程
            import io.micronaut.runtime.event.ShutdownEvent;
            import io.micronaut.runtime.server.event.ServerShutdownEvent;

            @Singleton
            public class ShutdownMonitor implements
                ApplicationEventListener<ShutdownEvent> {

                @Inject
                private ActiveRequestTracker requestTracker;

                @Override
                public void onApplicationEvent(ShutdownEvent event) {
                    System.out.println("收到关闭信号");

                    // 等待活跃请求完成
                    int activeRequests = requestTracker.getActiveCount();
                    System.out.println("当前活跃请求数: " + activeRequests);

                    while (activeRequests > 0) {
                        try {
                            Thread.sleep(1000);
                            activeRequests = requestTracker.getActiveCount();
                            System.out.println("等待请求完成,剩余: " + activeRequests);
                        } catch (InterruptedException e) {
                            break;
                        }
                    }

                    System.out.println("所有请求已完成,开始销毁Bean");
                }
            }

            // 关闭流程
            // 1. 接收SIGTERM信号
            // 2. 触发ShutdownEvent
            // 3. HTTP服务器停止接受新连接
            // 4. 等待活跃请求完成(最多30秒)
            // 5. 按依赖反向顺序销毁Bean
            // 6. 调用所有@PreDestroy方法
            // 7. 关闭线程池
            // 8. JVM退出
            ---
    b.关闭Hook
        a.JVM关闭Hook
            Micronaut自动注册JVM关闭Hook,确保应用被kill时也能执行清理逻辑。
        b.关闭Hook示例
            ---
            import jakarta.inject.Singleton;

            @Singleton
            public class CustomShutdownHook {
                public CustomShutdownHook() {
                    // 注册自定义关闭Hook
                    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                        System.out.println("JVM即将退出,执行最后的清理");
                        // 刷新日志缓冲区
                        // 保存临时数据
                        // 发送关闭通知
                    }));
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("Bean销毁前的清理");
                }
            }

            // 关闭方式对比
            // kill -15 <pid>   (SIGTERM)  → 优雅关闭,执行@PreDestroy和Hook
            // kill -9 <pid>    (SIGKILL)  → 强制终止,无法执行清理
            // Ctrl+C                      → 优雅关闭,执行@PreDestroy和Hook
            // context.close()             → 程序关闭,执行@PreDestroy
            ---

3 依赖注入详解

3.1 注解驱动注入

01.JSR-330标准注解
    a.@Inject注解
        a.注入标记
            @Inject是JSR-330标准注解,用于标记需要依赖注入的构造器、字段或方法,Micronaut完全支持此标准,保证代码可移植性。
        b.Inject使用示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderService {
                // 字段注入
                @Inject
                private OrderRepository orderRepository;

                @Inject
                private PaymentService paymentService;

                private NotificationService notificationService;

                // 构造器注入(推荐方式)
                // 单个构造器时@Inject可省略
                public OrderService() {
                    System.out.println("无参构造器");
                }

                // 方法注入
                @Inject
                public void setNotificationService(NotificationService service) {
                    this.notificationService = service;
                    System.out.println("方法注入完成");
                }

                public Order createOrder(OrderRequest request) {
                    Order order = new Order(request);
                    orderRepository.save(order);
                    paymentService.process(order);
                    notificationService.notify(order);
                    return order;
                }
            }

            // 注入执行顺序
            // 1. 调用构造器
            // 2. 注入@Inject字段
            // 3. 调用@Inject方法
            // 4. 调用@PostConstruct方法

            // 构造器注入示例(推荐)
            @Singleton
            public class UserService {
                private final UserRepository repository;
                private final EmailService emailService;

                // 单构造器时@Inject可省略
                public UserService(UserRepository repository,
                                 EmailService emailService) {
                    this.repository = repository;
                    this.emailService = emailService;
                }
            }

            // 多构造器时必须标记@Inject
            @Singleton
            public class ProductService {
                private final ProductRepository repository;
                private final CacheService cacheService;

                // 默认构造器
                public ProductService() {
                    this(null, null);
                }

                // 注入构造器
                @Inject
                public ProductService(ProductRepository repository,
                                    CacheService cacheService) {
                    this.repository = repository;
                    this.cacheService = cacheService;
                }
            }
            ---
    b.@Singleton注解
        a.单例作用域
            @Singleton是JSR-330标准注解,标记Bean为单例作用域,整个应用生命周期内只创建一次。
        b.Singleton示例
            ---
            import jakarta.inject.Singleton;
            import java.util.concurrent.ConcurrentHashMap;
            import java.util.concurrent.atomic.AtomicLong;

            @Singleton
            public class SessionManager {
                private final Map<String, Session> sessions = new ConcurrentHashMap<>();
                private final AtomicLong sessionCounter = new AtomicLong(0);

                public String createSession(String userId) {
                    String sessionId = UUID.randomUUID().toString();
                    Session session = new Session(sessionId, userId);
                    sessions.put(sessionId, session);
                    sessionCounter.incrementAndGet();
                    System.out.println("创建会话: " + sessionId);
                    return sessionId;
                }

                public Session getSession(String sessionId) {
                    return sessions.get(sessionId);
                }

                public void invalidateSession(String sessionId) {
                    sessions.remove(sessionId);
                    System.out.println("会话失效: " + sessionId);
                }

                public long getActiveSessionCount() {
                    return sessions.size();
                }

                public long getTotalSessionCount() {
                    return sessionCounter.get();
                }
            }

            // 任何地方注入的都是同一个SessionManager实例
            @Controller("/auth")
            public class AuthController {
                private final SessionManager sessionManager;

                public AuthController(SessionManager sessionManager) {
                    this.sessionManager = sessionManager;
                }

                @Post("/login")
                public LoginResponse login(@Body LoginRequest request) {
                    String sessionId = sessionManager.createSession(request.getUserId());
                    return new LoginResponse(sessionId);
                }
            }

            @Controller("/api")
            public class ApiController {
                private final SessionManager sessionManager;  // 同一实例

                public ApiController(SessionManager sessionManager) {
                    this.sessionManager = sessionManager;
                }

                @Get("/session/count")
                public long getSessionCount() {
                    return sessionManager.getActiveSessionCount();
                }
            }
            ---
    c.@Named注解
        a.Bean限定符
            @Named注解为Bean指定名称,用于区分同类型的多个Bean实现。
        b.Named使用示例
            ---
            import jakarta.inject.Named;
            import jakarta.inject.Singleton;

            // 定义接口
            public interface DataSource {
                Connection getConnection();
            }

            // 主数据源
            @Singleton
            @Named("primary")
            public class PrimaryDataSource implements DataSource {
                @Override
                public Connection getConnection() {
                    System.out.println("获取主库连接");
                    return createConnection("jdbc:mysql://master:3306/db");
                }

                private Connection createConnection(String url) {
                    // 创建连接
                    return null;
                }
            }

            // 从数据源
            @Singleton
            @Named("secondary")
            public class SecondaryDataSource implements DataSource {
                @Override
                public Connection getConnection() {
                    System.out.println("获取从库连接");
                    return createConnection("jdbc:mysql://slave:3306/db");
                }

                private Connection createConnection(String url) {
                    return null;
                }
            }

            // 注入指定名称的Bean
            @Singleton
            public class UserRepository {
                private final DataSource primaryDataSource;
                private final DataSource secondaryDataSource;

                public UserRepository(
                    @Named("primary") DataSource primaryDataSource,
                    @Named("secondary") DataSource secondaryDataSource) {
                    this.primaryDataSource = primaryDataSource;
                    this.secondaryDataSource = secondaryDataSource;
                }

                public User findById(Long id) {
                    // 写操作使用主库
                    Connection conn = primaryDataSource.getConnection();
                    return queryUser(conn, id);
                }

                public List<User> search(String keyword) {
                    // 读操作使用从库
                    Connection conn = secondaryDataSource.getConnection();
                    return searchUsers(conn, keyword);
                }

                private User queryUser(Connection conn, Long id) {
                    return null;
                }

                private List<User> searchUsers(Connection conn, String keyword) {
                    return Collections.emptyList();
                }
            }
            ---

02.Micronaut扩展注解
    a.@Primary注解
        a.首选Bean
            @Primary注解标记首选Bean,当存在多个同类型Bean且未指定@Named时,优先注入标记为@Primary的Bean。
        b.Primary示例
            ---
            import io.micronaut.context.annotation.Primary;
            import jakarta.inject.Singleton;

            public interface CacheProvider {
                void put(String key, Object value);
                Object get(String key);
            }

            // Redis缓存实现(首选)
            @Singleton
            @Primary
            public class RedisCacheProvider implements CacheProvider {
                @Override
                public void put(String key, Object value) {
                    System.out.println("Redis缓存写入: " + key);
                }

                @Override
                public Object get(String key) {
                    System.out.println("Redis缓存读取: " + key);
                    return null;
                }
            }

            // 内存缓存实现
            @Singleton
            public class InMemoryCacheProvider implements CacheProvider {
                private final Map<String, Object> cache = new ConcurrentHashMap<>();

                @Override
                public void put(String key, Object value) {
                    cache.put(key, value);
                    System.out.println("内存缓存写入: " + key);
                }

                @Override
                public Object get(String key) {
                    System.out.println("内存缓存读取: " + key);
                    return cache.get(key);
                }
            }

            // 不指定@Named时注入Primary Bean
            @Singleton
            public class ProductService {
                private final CacheProvider cacheProvider;  // 注入RedisCacheProvider

                public ProductService(CacheProvider cacheProvider) {
                    this.cacheProvider = cacheProvider;
                    System.out.println("注入的缓存提供者: " +
                                     cacheProvider.getClass().getSimpleName());
                }

                public Product getProduct(Long id) {
                    Object cached = cacheProvider.get("product:" + id);
                    if (cached != null) {
                        return (Product) cached;
                    }

                    Product product = productRepository.findById(id);
                    cacheProvider.put("product:" + id, product);
                    return product;
                }
            }

            // 明确注入非Primary Bean
            @Singleton
            public class BackupService {
                private final CacheProvider memoryCache;

                public BackupService(@Named("inMemoryCacheProvider") CacheProvider memoryCache) {
                    this.memoryCache = memoryCache;
                }
            }
            ---
    b.@Requires条件注入
        a.条件Bean创建
            @Requires注解根据条件决定是否创建Bean,条件包括配置属性、环境、类路径、Bean存在性等。
        b.Requires示例
            ---
            import io.micronaut.context.annotation.Requires;
            import jakarta.inject.Singleton;

            // 条件1:配置属性存在且为true
            @Singleton
            @Requires(property = "redis.enabled", value = "true")
            public class RedisCacheService implements CacheService {
                @Override
                public void cache(String key, Object value) {
                    System.out.println("使用Redis缓存");
                }
            }

            // 条件2:配置属性不为true(默认false)
            @Singleton
            @Requires(property = "redis.enabled", value = "false", defaultValue = "false")
            public class LocalCacheService implements CacheService {
                @Override
                public void cache(String key, Object value) {
                    System.out.println("使用本地缓存");
                }
            }

            // 条件3:类路径存在指定类
            @Singleton
            @Requires(classes = com.mysql.cj.jdbc.Driver.class)
            public class MySQLDataSource implements DataSource {
                // MySQL驱动存在时才创建
            }

            // 条件4:Bean存在
            @Singleton
            @Requires(beans = DataSource.class)
            public class DatabaseMigration {
                // 仅当DataSource Bean存在时创建
            }

            // 条件5:Bean不存在
            @Singleton
            @Requires(missingBeans = CustomAuthProvider.class)
            public class DefaultAuthProvider implements AuthProvider {
                // 仅当CustomAuthProvider不存在时创建
            }

            // 条件6:指定环境
            @Singleton
            @Requires(env = "dev")
            public class MockEmailService implements EmailService {
                @Override
                public void send(String to, String subject, String body) {
                    System.out.println("Mock发送邮件到: " + to);
                }
            }

            @Singleton
            @Requires(env = "prod")
            public class SmtpEmailService implements EmailService {
                @Override
                public void send(String to, String subject, String body) {
                    System.out.println("通过SMTP发送邮件到: " + to);
                }
            }

            // 条件7:非指定环境
            @Singleton
            @Requires(notEnv = "test")
            public class ProductionMetrics {
                // 非test环境时创建
            }

            // 条件8:SDK版本
            @Singleton
            @Requires(sdk = Requires.Sdk.JAVA, value = "17")
            public class Java17Feature {
                // 仅Java 17及以上版本创建
            }

            // 条件9:配置属性匹配模式
            @Singleton
            @Requires(property = "datasource.url", pattern = "jdbc:mysql:.*")
            public class MySQLSpecificConfig {
                // 仅当数据库URL为MySQL时创建
            }

            // 条件10:多条件组合(AND关系)
            @Singleton
            @Requires(property = "feature.enabled", value = "true")
            @Requires(env = "prod")
            @Requires(beans = DataSource.class)
            public class AdvancedFeature {
                // 所有条件都满足时才创建
            }
            ---
    c.@Factory工厂类
        a.工厂模式
            @Factory注解标记工厂类,类中的@Bean方法可以创建和配置第三方Bean,适合无法添加@Singleton注解的外部类。
        b.Factory示例
            ---
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;
            import jakarta.inject.Singleton;
            import com.zaxxer.hikari.HikariConfig;
            import com.zaxxer.hikari.HikariDataSource;

            @Factory
            public class DataSourceFactory {
                // 创建HikariCP数据源
                @Bean
                @Singleton
                @Named("primary")
                public DataSource primaryDataSource(
                    @Value("${datasource.primary.url}") String url,
                    @Value("${datasource.primary.username}") String username,
                    @Value("${datasource.primary.password}") String password) {

                    HikariConfig config = new HikariConfig();
                    config.setJdbcUrl(url);
                    config.setUsername(username);
                    config.setPassword(password);
                    config.setMaximumPoolSize(20);
                    config.setMinimumIdle(5);
                    config.setConnectionTimeout(30000);
                    config.setIdleTimeout(600000);
                    config.setMaxLifetime(1800000);

                    System.out.println("创建主数据源: " + url);
                    return new HikariDataSource(config);
                }

                // 创建从数据源
                @Bean
                @Singleton
                @Named("secondary")
                public DataSource secondaryDataSource(
                    @Value("${datasource.secondary.url}") String url,
                    @Value("${datasource.secondary.username}") String username,
                    @Value("${datasource.secondary.password}") String password) {

                    HikariConfig config = new HikariConfig();
                    config.setJdbcUrl(url);
                    config.setUsername(username);
                    config.setPassword(password);
                    config.setMaximumPoolSize(10);

                    System.out.println("创建从数据源: " + url);
                    return new HikariDataSource(config);
                }

                // 创建ObjectMapper
                @Bean
                @Singleton
                public ObjectMapper objectMapper() {
                    ObjectMapper mapper = new ObjectMapper();
                    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
                    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
                    mapper.registerModule(new JavaTimeModule());
                    return mapper;
                }

                // 条件化工厂方法
                @Bean
                @Singleton
                @Requires(property = "aws.enabled", value = "true")
                public AmazonS3 amazonS3(
                    @Value("${aws.access-key}") String accessKey,
                    @Value("${aws.secret-key}") String secretKey,
                    @Value("${aws.region}") String region) {

                    AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
                    return AmazonS3ClientBuilder.standard()
                        .withCredentials(new AWSStaticCredentialsProvider(credentials))
                        .withRegion(region)
                        .build();
                }
            }

            // 使用工厂创建的Bean
            @Singleton
            public class UserRepository {
                private final DataSource dataSource;
                private final ObjectMapper objectMapper;

                public UserRepository(
                    @Named("primary") DataSource dataSource,
                    ObjectMapper objectMapper) {
                    this.dataSource = dataSource;
                    this.objectMapper = objectMapper;
                }
            }
            ---

02.泛型注入
    a.泛型Bean
        a.泛型类型保留
            Micronaut在编译期保留完整的泛型类型信息,支持注入泛型Bean,类型参数精确匹配。
        b.泛型注入示例
            ---
            import jakarta.inject.Singleton;

            // 定义泛型接口
            public interface Repository<T, ID> {
                T findById(ID id);
                List<T> findAll();
                T save(T entity);
                void deleteById(ID id);
            }

            // 泛型实现1:User Repository
            @Singleton
            public class UserRepository implements Repository<User, Long> {
                @Override
                public User findById(Long id) {
                    System.out.println("查询用户: " + id);
                    return new User(id, "User" + id);
                }

                @Override
                public List<User> findAll() {
                    return Arrays.asList(new User(1L, "Alice"), new User(2L, "Bob"));
                }

                @Override
                public User save(User entity) {
                    System.out.println("保存用户: " + entity.getName());
                    return entity;
                }

                @Override
                public void deleteById(Long id) {
                    System.out.println("删除用户: " + id);
                }
            }

            // 泛型实现2:Product Repository
            @Singleton
            public class ProductRepository implements Repository<Product, String> {
                @Override
                public Product findById(String id) {
                    System.out.println("查询产品: " + id);
                    return new Product(id, "Product-" + id);
                }

                @Override
                public List<Product> findAll() {
                    return Arrays.asList(
                        new Product("P001", "商品1"),
                        new Product("P002", "商品2")
                    );
                }

                @Override
                public Product save(Product entity) {
                    System.out.println("保存产品: " + entity.getName());
                    return entity;
                }

                @Override
                public void deleteById(String id) {
                    System.out.println("删除产品: " + id);
                }
            }

            // 注入泛型Bean(类型精确匹配)
            @Singleton
            public class UserService {
                private final Repository<User, Long> userRepository;

                public UserService(Repository<User, Long> userRepository) {
                    this.userRepository = userRepository;  // 注入UserRepository
                }

                public User getUser(Long id) {
                    return userRepository.findById(id);
                }
            }

            @Singleton
            public class ProductService {
                private final Repository<Product, String> productRepository;

                public ProductService(Repository<Product, String> productRepository) {
                    this.productRepository = productRepository;  // 注入ProductRepository
                }

                public Product getProduct(String id) {
                    return productRepository.findById(id);
                }
            }

            // Micronaut根据泛型参数精确匹配Bean
            // Repository<User, Long> → UserRepository
            // Repository<Product, String> → ProductRepository
            ---
    b.Provider注入
        a.延迟获取
            Provider<T>接口提供延迟获取Bean的能力,在需要时才从容器获取Bean实例,可以解决循环依赖和提升启动性能。
        b.Provider示例
            ---
            import jakarta.inject.Provider;
            import jakarta.inject.Singleton;

            // 场景1:解决循环依赖
            @Singleton
            public class ServiceA {
                private final Provider<ServiceB> serviceBProvider;

                public ServiceA(Provider<ServiceB> serviceBProvider) {
                    this.serviceBProvider = serviceBProvider;
                    System.out.println("ServiceA创建");
                }

                public void doSomething() {
                    // 延迟获取ServiceB
                    ServiceB serviceB = serviceBProvider.get();
                    serviceB.process();
                }
            }

            @Singleton
            public class ServiceB {
                private final ServiceA serviceA;

                public ServiceB(ServiceA serviceA) {
                    this.serviceA = serviceA;
                    System.out.println("ServiceB创建");
                }

                public void process() {
                    System.out.println("ServiceB处理业务");
                }
            }

            // 场景2:获取Prototype Bean
            @Singleton
            public class TaskManager {
                private final Provider<TaskExecutor> executorProvider;

                public TaskManager(Provider<TaskExecutor> executorProvider) {
                    this.executorProvider = executorProvider;
                }

                public void executeTasks(List<Task> tasks) {
                    for (Task task : tasks) {
                        // 每个任务使用新的Executor实例
                        TaskExecutor executor = executorProvider.get();
                        executor.execute(task);
                    }
                }
            }

            @Prototype
            public class TaskExecutor {
                private final String executorId = UUID.randomUUID().toString();

                public void execute(Task task) {
                    System.out.println("Executor " + executorId + " 执行任务: " + task);
                }
            }

            // 场景3:条件获取Bean
            @Singleton
            public class NotificationService {
                private final Provider<EmailService> emailProvider;
                private final Provider<SmsService> smsProvider;

                public NotificationService(
                    Provider<EmailService> emailProvider,
                    Provider<SmsService> smsProvider) {
                    this.emailProvider = emailProvider;
                    this.smsProvider = smsProvider;
                }

                public void notify(String userId, String message, NotificationType type) {
                    switch (type) {
                        case EMAIL:
                            emailProvider.get().send(userId, message);
                            break;
                        case SMS:
                            smsProvider.get().send(userId, message);
                            break;
                        case BOTH:
                            emailProvider.get().send(userId, message);
                            smsProvider.get().send(userId, message);
                            break;
                    }
                }
            }
            ---

3.2 构造器注入

01.构造器注入最佳实践
    a.推荐使用原因
        a.不可变性保证
            构造器注入允许将依赖字段声明为final,保证对象创建后依赖不可变,提高线程安全性和代码可预测性。
        b.依赖明确性
            所有依赖在构造器参数中明确声明,一眼就能看出类的依赖关系,便于理解和维护。
        c.易于测试
            ---
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderService {
                private final OrderRepository orderRepository;
                private final PaymentGateway paymentGateway;
                private final NotificationService notificationService;
                private final AuditLogger auditLogger;

                // 构造器注入:所有依赖声明为final
                public OrderService(OrderRepository orderRepository,
                                  PaymentGateway paymentGateway,
                                  NotificationService notificationService,
                                  AuditLogger auditLogger) {
                    this.orderRepository = orderRepository;
                    this.paymentGateway = paymentGateway;
                    this.notificationService = notificationService;
                    this.auditLogger = auditLogger;
                }

                public Order createOrder(OrderRequest request) {
                    // 创建订单
                    Order order = new Order(request);
                    orderRepository.save(order);

                    // 处理支付
                    PaymentResult payment = paymentGateway.charge(
                        request.getUserId(),
                        request.getAmount()
                    );

                    if (!payment.isSuccess()) {
                        throw new PaymentFailedException("支付失败");
                    }

                    // 发送通知
                    notificationService.sendOrderConfirmation(order);

                    // 记录审计日志
                    auditLogger.log("订单创建", order.getId());

                    return order;
                }
            }

            // 单元测试(无需Micronaut容器)
            import org.junit.jupiter.api.Test;
            import org.mockito.Mockito;

            public class OrderServiceTest {
                @Test
                public void testCreateOrder() {
                    // 创建Mock依赖
                    OrderRepository mockRepository = Mockito.mock(OrderRepository.class);
                    PaymentGateway mockGateway = Mockito.mock(PaymentGateway.class);
                    NotificationService mockNotification = Mockito.mock(NotificationService.class);
                    AuditLogger mockLogger = Mockito.mock(AuditLogger.class);

                    // 直接通过构造器创建服务实例
                    OrderService service = new OrderService(
                        mockRepository,
                        mockGateway,
                        mockNotification,
                        mockLogger
                    );

                    // 配置Mock行为
                    Mockito.when(mockGateway.charge(Mockito.any(), Mockito.any()))
                        .thenReturn(PaymentResult.success());

                    // 测试
                    OrderRequest request = new OrderRequest(1L, 100.0);
                    Order order = service.createOrder(request);

                    // 验证
                    Mockito.verify(mockRepository).save(Mockito.any(Order.class));
                    Mockito.verify(mockGateway).charge(1L, 100.0);
                }
            }
            ---
    b.多构造器处理
        a.@Inject标记
            当类有多个构造器时,必须使用@Inject标记用于依赖注入的构造器。
        b.多构造器示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class ReportService {
                private final ReportRepository repository;
                private final TemplateEngine templateEngine;
                private final ExportService exportService;

                // 默认构造器(用于测试)
                public ReportService() {
                    this(null, null, null);
                }

                // 部分依赖构造器
                public ReportService(ReportRepository repository) {
                    this(repository, new DefaultTemplateEngine(), null);
                }

                // 完整依赖构造器(标记@Inject)
                @Inject
                public ReportService(ReportRepository repository,
                                   TemplateEngine templateEngine,
                                   ExportService exportService) {
                    this.repository = repository;
                    this.templateEngine = templateEngine;
                    this.exportService = exportService;
                    System.out.println("使用完整依赖创建ReportService");
                }

                public Report generateReport(String templateName, Map<String, Object> data) {
                    String content = templateEngine.render(templateName, data);
                    Report report = new Report(content);
                    repository.save(report);
                    return report;
                }

                public byte[] exportToPdf(Long reportId) {
                    Report report = repository.findById(reportId);
                    return exportService.toPdf(report);
                }
            }

            // Micronaut会调用标记@Inject的构造器
            // 如果没有@Inject标记且有多个构造器,编译报错
            ---

02.构造器参数处理
    a.可选依赖
        a.@Nullable注解
            构造器参数可以标记@Nullable,表示该依赖是可选的,容器中不存在时注入null。
        b.可选依赖示例
            ---
            import io.micronaut.core.annotation.Nullable;
            import jakarta.inject.Singleton;

            @Singleton
            public class EmailService {
                private final SmtpClient smtpClient;
                private final EmailTemplate templateEngine;
                private final AttachmentService attachmentService;  // 可选依赖

                public EmailService(
                    SmtpClient smtpClient,
                    EmailTemplate templateEngine,
                    @Nullable AttachmentService attachmentService) {  // 可选

                    this.smtpClient = smtpClient;
                    this.templateEngine = templateEngine;
                    this.attachmentService = attachmentService;

                    if (attachmentService == null) {
                        System.out.println("AttachmentService不可用,禁用附件功能");
                    }
                }

                public void sendEmail(String to, String subject, String body) {
                    String html = templateEngine.render(body);
                    smtpClient.send(to, subject, html);
                }

                public void sendEmailWithAttachment(String to, String subject,
                                                   String body, File attachment) {
                    if (attachmentService == null) {
                        throw new UnsupportedOperationException("附件服务不可用");
                    }

                    String html = templateEngine.render(body);
                    byte[] attachmentData = attachmentService.readFile(attachment);
                    smtpClient.sendWithAttachment(to, subject, html, attachmentData);
                }
            }

            // Optional包装
            @Singleton
            public class CacheService {
                private final CacheProvider primaryCache;
                private final Optional<CacheProvider> secondaryCache;

                public CacheService(
                    @Named("primary") CacheProvider primaryCache,
                    @Named("secondary") Optional<CacheProvider> secondaryCache) {

                    this.primaryCache = primaryCache;
                    this.secondaryCache = secondaryCache;
                }

                public void put(String key, Object value) {
                    primaryCache.put(key, value);

                    // 双写到备用缓存
                    secondaryCache.ifPresent(cache -> cache.put(key, value));
                }
            }
            ---
    b.默认值参数
        a.@Value注入配置
            构造器参数可以使用@Value注解注入配置值,支持默认值。
        b.配置参数示例
            ---
            import io.micronaut.context.annotation.Value;
            import jakarta.inject.Singleton;
            import java.time.Duration;

            @Singleton
            public class HttpClientService {
                private final String baseUrl;
                private final Duration timeout;
                private final int maxRetries;
                private final boolean enableLogging;

                public HttpClientService(
                    @Value("${api.base-url}") String baseUrl,
                    @Value("${api.timeout:30s}") Duration timeout,
                    @Value("${api.max-retries:3}") int maxRetries,
                    @Value("${api.logging.enabled:false}") boolean enableLogging) {

                    this.baseUrl = baseUrl;
                    this.timeout = timeout;
                    this.maxRetries = maxRetries;
                    this.enableLogging = enableLogging;

                    System.out.println("HTTP客户端配置:");
                    System.out.println("  Base URL: " + baseUrl);
                    System.out.println("  Timeout: " + timeout);
                    System.out.println("  Max Retries: " + maxRetries);
                    System.out.println("  Logging: " + enableLogging);
                }

                public ApiResponse callApi(String endpoint) {
                    String url = baseUrl + endpoint;
                    if (enableLogging) {
                        System.out.println("调用API: " + url);
                    }
                    // API调用逻辑
                    return new ApiResponse();
                }
            }

            // 混合注入Bean和配置
            @Singleton
            public class DatabaseService {
                private final DataSource dataSource;
                private final String schema;
                private final int queryTimeout;

                public DatabaseService(
                    DataSource dataSource,  // 注入Bean
                    @Value("${database.schema:public}") String schema,  // 注入配置
                    @Value("${database.query-timeout:30}") int queryTimeout) {

                    this.dataSource = dataSource;
                    this.schema = schema;
                    this.queryTimeout = queryTimeout;
                }

                public List<User> queryUsers() {
                    try (Connection conn = dataSource.getConnection()) {
                        Statement stmt = conn.createStatement();
                        stmt.setQueryTimeout(queryTimeout);
                        ResultSet rs = stmt.executeQuery(
                            "SELECT * FROM " + schema + ".users"
                        );
                        return mapResultSet(rs);
                    } catch (SQLException e) {
                        throw new RuntimeException("查询失败", e);
                    }
                }

                private List<User> mapResultSet(ResultSet rs) throws SQLException {
                    List<User> users = new ArrayList<>();
                    while (rs.next()) {
                        users.add(new User(rs.getLong("id"), rs.getString("name")));
                    }
                    return users;
                }
            }
            ---

03.构造器验证
    a.参数验证
        a.Bean Validation集成
            构造器参数可以使用Bean Validation注解进行验证,Micronaut在Bean创建时自动执行验证。
        b.验证示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import jakarta.validation.constraints.*;
            import jakarta.inject.Singleton;

            @ConfigurationProperties("server")
            public class ServerConfig {
                @NotBlank(message = "主机名不能为空")
                private String host;

                @Min(value = 1, message = "端口必须大于0")
                @Max(value = 65535, message = "端口必须小于65536")
                private int port;

                @NotNull
                @Pattern(regexp = "https?://.*", message = "URL格式无效")
                private String baseUrl;

                // 构造器验证
                public ServerConfig(
                    @NotBlank String host,
                    @Min(1) @Max(65535) int port,
                    @NotNull String baseUrl) {

                    this.host = host;
                    this.port = port;
                    this.baseUrl = baseUrl;
                }

                // getter和setter省略
            }

            // 验证失败时抛出异常
            // application.yml配置错误
            // server:
            //   host: ""        # 空字符串,违反@NotBlank
            //   port: 99999     # 超出范围,违反@Max
            //   base-url: "invalid"  # 格式错误,违反@Pattern

            // 启动时抛出异常
            // jakarta.validation.ConstraintViolationException:
            //   - host: 主机名不能为空
            //   - port: 端口必须小于65536
            //   - baseUrl: URL格式无效

            // 自定义验证器
            import jakarta.validation.Constraint;
            import jakarta.validation.ConstraintValidator;
            import jakarta.validation.ConstraintValidatorContext;

            @Constraint(validatedBy = UrlValidator.class)
            @Retention(RetentionPolicy.RUNTIME)
            @Target({ElementType.PARAMETER, ElementType.FIELD})
            public @interface ValidUrl {
                String message() default "URL格式无效";
                Class<?>[] groups() default {};
                Class<? extends Payload>[] payload() default {};
            }

            public class UrlValidator implements
                ConstraintValidator<ValidUrl, String> {

                @Override
                public boolean isValid(String value,
                                     ConstraintValidatorContext context) {
                    if (value == null || value.isEmpty()) {
                        return false;
                    }
                    try {
                        new URL(value);
                        return true;
                    } catch (MalformedURLException e) {
                        return false;
                    }
                }
            }

            // 使用自定义验证器
            @Singleton
            public class ApiClient {
                private final String apiUrl;

                public ApiClient(@ValidUrl String apiUrl) {
                    this.apiUrl = apiUrl;
                }
            }
            ---
    b.依赖检查
        a.编译时检查
            Micronaut在编译期检查构造器参数的依赖是否存在,提前发现依赖缺失问题。
        b.依赖检查示例
            ---
            // 定义服务
            @Singleton
            public class UserService {
                private final UserRepository repository;
                private final EmailService emailService;

                public UserService(UserRepository repository,
                                 EmailService emailService) {
                    this.repository = repository;
                    this.emailService = emailService;
                }
            }

            // 场景1:缺少EmailService Bean
            // 如果项目中没有定义EmailService的实现
            // 编译时报错:
            // error: No bean of type [EmailService] exists.
            //        Make sure the bean is not disabled by bean requirements
            //        and if the bean is enabled then ensure the class is
            //        declared a bean.

            // 场景2:循环依赖
            @Singleton
            public class ServiceA {
                public ServiceA(ServiceB serviceB) {
                }
            }

            @Singleton
            public class ServiceB {
                public ServiceB(ServiceA serviceA) {
                }
            }

            // 编译时报错:
            // error: Circular dependency detected:
            //   ServiceA -> ServiceB -> ServiceA

            // 解决方案:使用Provider
            @Singleton
            public class ServiceA {
                private final Provider<ServiceB> serviceBProvider;

                public ServiceA(Provider<ServiceB> serviceBProvider) {
                    this.serviceBProvider = serviceBProvider;
                }

                public void doSomething() {
                    ServiceB serviceB = serviceBProvider.get();
                    serviceB.process();
                }
            }
            ---

02.构造器重载
    a.多构造器场景
        a.构造器选择
            当类有多个构造器时,Micronaut优先选择参数最多的构造器,或选择标记@Inject的构造器。
        b.构造器选择示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class DataProcessor {
                private final DataSource dataSource;
                private final DataValidator validator;
                private final DataTransformer transformer;

                // 构造器1:最少依赖(用于测试)
                public DataProcessor(DataSource dataSource) {
                    this(dataSource, new DefaultValidator(), new DefaultTransformer());
                    System.out.println("使用构造器1");
                }

                // 构造器2:部分依赖
                public DataProcessor(DataSource dataSource, DataValidator validator) {
                    this(dataSource, validator, new DefaultTransformer());
                    System.out.println("使用构造器2");
                }

                // 构造器3:完整依赖(标记@Inject,优先使用)
                @Inject
                public DataProcessor(DataSource dataSource,
                                   DataValidator validator,
                                   DataTransformer transformer) {
                    this.dataSource = dataSource;
                    this.validator = validator;
                    this.transformer = transformer;
                    System.out.println("使用构造器3(完整依赖)");
                }

                public ProcessResult process(Data data) {
                    if (!validator.validate(data)) {
                        throw new ValidationException("数据验证失败");
                    }

                    Data transformed = transformer.transform(data);
                    saveToDatabase(dataSource, transformed);

                    return ProcessResult.success();
                }

                private void saveToDatabase(DataSource ds, Data data) {
                    // 保存逻辑
                }
            }

            // Micronaut注入时使用构造器3
            // 输出:使用构造器3(完整依赖)
            ---
    b.Builder模式集成
        a.工厂方法
            对于使用Builder模式的类,可以通过@Factory方法创建Bean。
        b.Builder示例
            ---
            // 第三方库的Builder类
            public class HttpClientConfig {
                private String baseUrl;
                private Duration timeout;
                private int maxRetries;

                private HttpClientConfig() {}

                public static Builder builder() {
                    return new Builder();
                }

                public static class Builder {
                    private String baseUrl;
                    private Duration timeout = Duration.ofSeconds(30);
                    private int maxRetries = 3;

                    public Builder baseUrl(String baseUrl) {
                        this.baseUrl = baseUrl;
                        return this;
                    }

                    public Builder timeout(Duration timeout) {
                        this.timeout = timeout;
                        return this;
                    }

                    public Builder maxRetries(int maxRetries) {
                        this.maxRetries = maxRetries;
                        return this;
                    }

                    public HttpClientConfig build() {
                        HttpClientConfig config = new HttpClientConfig();
                        config.baseUrl = this.baseUrl;
                        config.timeout = this.timeout;
                        config.maxRetries = this.maxRetries;
                        return config;
                    }
                }

                // getter方法省略
            }

            // 使用Factory创建Bean
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;

            @Factory
            public class HttpClientConfigFactory {
                @Bean
                @Singleton
                public HttpClientConfig httpClientConfig(
                    @Value("${http.client.base-url}") String baseUrl,
                    @Value("${http.client.timeout:30s}") Duration timeout,
                    @Value("${http.client.max-retries:3}") int maxRetries) {

                    return HttpClientConfig.builder()
                        .baseUrl(baseUrl)
                        .timeout(timeout)
                        .maxRetries(maxRetries)
                        .build();
                }
            }

            // 注入配置Bean
            @Singleton
            public class ApiService {
                private final HttpClientConfig config;

                public ApiService(HttpClientConfig config) {
                    this.config = config;
                    System.out.println("API配置: " + config.getBaseUrl());
                }
            }
            ---

03.构造器依赖排序
    a.依赖拓扑排序
        a.创建顺序
            Micronaut根据Bean之间的依赖关系进行拓扑排序,确保依赖的Bean先于依赖它的Bean创建。
        b.排序示例
            ---
            // 定义4层依赖关系
            @Singleton
            public class Layer1Config {
                public Layer1Config() {
                    System.out.println("1. Layer1Config创建(无依赖)");
                }
            }

            @Singleton
            public class Layer2DataSource {
                private final Layer1Config config;

                public Layer2DataSource(Layer1Config config) {
                    this.config = config;
                    System.out.println("2. Layer2DataSource创建(依赖Layer1)");
                }
            }

            @Singleton
            public class Layer2Cache {
                private final Layer1Config config;

                public Layer2Cache(Layer1Config config) {
                    this.config = config;
                    System.out.println("3. Layer2Cache创建(依赖Layer1)");
                }
            }

            @Singleton
            public class Layer3Repository {
                private final Layer2DataSource dataSource;

                public Layer3Repository(Layer2DataSource dataSource) {
                    this.dataSource = dataSource;
                    System.out.println("4. Layer3Repository创建(依赖Layer2DataSource)");
                }
            }

            @Singleton
            public class Layer3Service {
                private final Layer2DataSource dataSource;
                private final Layer2Cache cache;

                public Layer3Service(Layer2DataSource dataSource, Layer2Cache cache) {
                    this.dataSource = dataSource;
                    this.cache = cache;
                    System.out.println("5. Layer3Service创建(依赖Layer2DataSource和Layer2Cache)");
                }
            }

            @Singleton
            public class Layer4Controller {
                private final Layer3Repository repository;
                private final Layer3Service service;

                public Layer4Controller(Layer3Repository repository, Layer3Service service) {
                    this.repository = repository;
                    this.service = service;
                    System.out.println("6. Layer4Controller创建(依赖Layer3)");
                }
            }

            // 依赖关系图
            // Layer1Config
            //   ├── Layer2DataSource
            //   │     ├── Layer3Repository
            //   │     │     └── Layer4Controller
            //   │     └── Layer3Service
            //   │           └── Layer4Controller
            //   └── Layer2Cache
            //         └── Layer3Service

            // Micronaut创建顺序(拓扑排序)
            // 1. Layer1Config
            // 2. Layer2DataSource
            // 3. Layer2Cache
            // 4. Layer3Repository
            // 5. Layer3Service
            // 6. Layer4Controller

            // 启动输出
            // 1. Layer1Config创建(无依赖)
            // 2. Layer2DataSource创建(依赖Layer1)
            // 3. Layer2Cache创建(依赖Layer1)
            // 4. Layer3Repository创建(依赖Layer2DataSource)
            // 5. Layer3Service创建(依赖Layer2DataSource和Layer2Cache)
            // 6. Layer4Controller创建(依赖Layer3)
            ---
    b.并行实例化
        a.无依赖Bean并行创建
            对于没有依赖关系的Bean,Micronaut可以并行创建,提升启动速度。
        b.并行创建示例
            ---
            // 独立的服务Bean(无相互依赖)
            @Singleton
            public class MetricsService {
                public MetricsService() {
                    System.out.println(Thread.currentThread().getName() +
                                     ": MetricsService创建");
                    simulateInitialization();
                }

                private void simulateInitialization() {
                    try { Thread.sleep(100); } catch (InterruptedException e) {}
                }
            }

            @Singleton
            public class LoggingService {
                public LoggingService() {
                    System.out.println(Thread.currentThread().getName() +
                                     ": LoggingService创建");
                    simulateInitialization();
                }

                private void simulateInitialization() {
                    try { Thread.sleep(100); } catch (InterruptedException e) {}
                }
            }

            @Singleton
            public class CacheService {
                public CacheService() {
                    System.out.println(Thread.currentThread().getName() +
                                     ": CacheService创建");
                    simulateInitialization();
                }

                private void simulateInitialization() {
                    try { Thread.sleep(100); } catch (InterruptedException e) {}
                }
            }

            // 这3个Bean无相互依赖,可以并行创建
            // 输出示例(线程名可能不同)
            // ForkJoinPool-1: MetricsService创建
            // ForkJoinPool-2: LoggingService创建
            // ForkJoinPool-3: CacheService创建

            // 串行创建耗时:300ms
            // 并行创建耗时:100ms
            // 性能提升:3倍
            ---

3.3 字段注入与方法注入

01.字段注入
    a.字段注入语法
        a.@Inject字段
            通过@Inject注解标记字段实现依赖注入,Micronaut在Bean创建后自动为字段赋值,但不推荐使用此方式。
        b.字段注入示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class ReportGenerator {
                // 字段注入
                @Inject
                private TemplateEngine templateEngine;

                @Inject
                private DataSource dataSource;

                @Inject
                @Named("pdf")
                private ExportService pdfExporter;

                @Inject
                @Named("excel")
                private ExportService excelExporter;

                public Report generateReport(String templateName, Map<String, Object> data) {
                    // 使用注入的依赖
                    String content = templateEngine.render(templateName, data);
                    Report report = new Report(content);

                    // 保存到数据库
                    try (Connection conn = dataSource.getConnection()) {
                        saveReport(conn, report);
                    } catch (SQLException e) {
                        throw new RuntimeException("保存报告失败", e);
                    }

                    return report;
                }

                public byte[] exportToPdf(Long reportId) {
                    Report report = loadReport(reportId);
                    return pdfExporter.export(report);
                }

                public byte[] exportToExcel(Long reportId) {
                    Report report = loadReport(reportId);
                    return excelExporter.export(report);
                }

                private void saveReport(Connection conn, Report report) {
                    // 保存逻辑
                }

                private Report loadReport(Long reportId) {
                    return new Report();
                }
            }

            // 字段注入的缺点
            // 1. 字段不能声明为final,对象可变
            // 2. 依赖关系不明确,需要查看字段定义
            // 3. 单元测试困难,无法直接new对象
            // 4. 可能出现NullPointerException(依赖未注入就调用)
            // 5. 破坏封装性,字段通常应该是private
            ---
    b.字段注入陷阱
        a.NullPointerException风险
            字段注入在构造器执行时依赖尚未注入,如果在构造器中使用依赖字段会导致NPE。
        b.NPE示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class RiskyService {
                @Inject
                private ConfigService configService;

                public RiskyService() {
                    // ❌ 错误:此时configService还未注入,值为null
                    // String value = configService.getValue();  // NullPointerException!

                    System.out.println("构造器执行,configService=" +
                                     (configService == null ? "null" : "not null"));
                }

                @PostConstruct
                public void init() {
                    // ✅ 正确:@PostConstruct时字段已注入
                    String value = configService.getValue();
                    System.out.println("配置值: " + value);
                }

                public void doSomething() {
                    // ✅ 正确:实例方法调用时字段已注入
                    configService.update("key", "value");
                }
            }

            // 注入执行顺序
            // 1. 调用构造器(此时@Inject字段为null)
            // 2. 注入@Inject字段
            // 3. 调用@PostConstruct方法
            // 因此在构造器中不能使用@Inject字段!

            // 推荐使用构造器注入避免此问题
            @Singleton
            public class SafeService {
                private final ConfigService configService;

                public SafeService(ConfigService configService) {
                    // ✅ 安全:构造器参数已经是注入的实例
                    this.configService = configService;
                    String value = configService.getValue();  // 不会NPE
                    System.out.println("配置值: " + value);
                }
            }
            ---

02.方法注入
    a.Setter注入
        a.方法注入语法
            通过@Inject标记setter方法实现依赖注入,适合可选依赖或需要在Bean创建后动态配置的场景。
        b.Setter注入示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;
            import io.micronaut.core.annotation.Nullable;

            @Singleton
            public class EmailService {
                private final SmtpConfig config;
                private EmailTemplate defaultTemplate;
                private AttachmentHandler attachmentHandler;  // 可选依赖

                // 构造器注入必需依赖
                public EmailService(SmtpConfig config) {
                    this.config = config;
                    System.out.println("EmailService创建,config已注入");
                }

                // 方法注入:设置默认模板
                @Inject
                public void setDefaultTemplate(EmailTemplate defaultTemplate) {
                    this.defaultTemplate = defaultTemplate;
                    System.out.println("默认模板已注入");
                }

                // 方法注入:可选的附件处理器
                @Inject
                public void setAttachmentHandler(
                    @Nullable AttachmentHandler attachmentHandler) {
                    this.attachmentHandler = attachmentHandler;

                    if (attachmentHandler != null) {
                        System.out.println("附件处理器已注入");
                    } else {
                        System.out.println("附件处理器不可用");
                    }
                }

                public void sendEmail(String to, String subject, String body) {
                    String content = defaultTemplate.render(body);
                    send(to, subject, content);
                }

                public void sendEmailWithAttachment(String to, String subject,
                                                   String body, File file) {
                    if (attachmentHandler == null) {
                        throw new UnsupportedOperationException("附件功能不可用");
                    }

                    String content = defaultTemplate.render(body);
                    byte[] attachment = attachmentHandler.process(file);
                    sendWithAttachment(to, subject, content, attachment);
                }

                private void send(String to, String subject, String content) {
                    System.out.println("发送邮件到: " + to);
                }

                private void sendWithAttachment(String to, String subject,
                                              String content, byte[] attachment) {
                    System.out.println("发送带附件的邮件到: " + to);
                }
            }

            // 注入执行顺序
            // 1. 调用构造器(config注入)
            // 2. 调用setDefaultTemplate(defaultTemplate注入)
            // 3. 调用setAttachmentHandler(attachmentHandler注入)
            // 4. 调用@PostConstruct方法
            ---
    b.多参数方法注入
        a.方法注入多个依赖
            @Inject方法可以有多个参数,Micronaut会注入所有参数。
        b.多参数注入示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderProcessor {
                private InventoryService inventoryService;
                private PaymentService paymentService;
                private ShippingService shippingService;

                // 方法注入多个依赖
                @Inject
                public void setDependencies(
                    InventoryService inventoryService,
                    PaymentService paymentService,
                    ShippingService shippingService) {

                    this.inventoryService = inventoryService;
                    this.paymentService = paymentService;
                    this.shippingService = shippingService;

                    System.out.println("3个依赖已通过方法注入");
                }

                public void processOrder(Order order) {
                    // 检查库存
                    boolean inStock = inventoryService.checkStock(order.getItems());
                    if (!inStock) {
                        throw new OutOfStockException();
                    }

                    // 处理支付
                    PaymentResult payment = paymentService.charge(order);
                    if (!payment.isSuccess()) {
                        throw new PaymentFailedException();
                    }

                    // 安排发货
                    shippingService.schedule(order);
                }
            }

            // 多个@Inject方法
            @Singleton
            public class ComplexService {
                private DataSource dataSource;
                private CacheService cacheService;
                private MetricsService metricsService;
                private LoggingService loggingService;

                @Inject
                public void setDataAccess(DataSource dataSource, CacheService cacheService) {
                    this.dataSource = dataSource;
                    this.cacheService = cacheService;
                    System.out.println("数据访问依赖已注入");
                }

                @Inject
                public void setObservability(MetricsService metricsService,
                                            LoggingService loggingService) {
                    this.metricsService = metricsService;
                    this.loggingService = loggingService;
                    System.out.println("可观测性依赖已注入");
                }

                // 所有@Inject方法都会被调用
            }
            ---

03.注入方式对比
    a.三种注入方式比较
        a.构造器vs字段vs方法
            构造器注入保证不可变性和依赖完整性,字段注入简洁但不安全,方法注入适合可选依赖,应根据场景选择。
        b.对比示例
            ---
            // 推荐:构造器注入
            @Singleton
            public class GoodService {
                private final Repository repository;      // final,不可变
                private final Validator validator;        // final,不可变

                public GoodService(Repository repository, Validator validator) {
                    this.repository = repository;
                    this.validator = validator;
                    // 依赖在对象创建时就已确定
                }
            }

            // 优点:
            // ✅ 字段可以是final,保证不可变
            // ✅ 依赖明确,构造器签名清晰展示依赖
            // ✅ 便于测试,直接new对象传入mock
            // ✅ 不会出现NPE,构造器执行时依赖已就绪
            // ✅ 编译期检查依赖完整性

            // 不推荐:字段注入
            @Singleton
            public class BadService {
                @Inject
                private Repository repository;  // 不能是final
                @Inject
                private Validator validator;    // 不能是final

                public BadService() {
                    // 构造器中不能使用依赖(此时为null)
                }
            }

            // 缺点:
            // ❌ 字段不能是final,对象可变
            // ❌ 依赖隐藏,需要查看字段定义
            // ❌ 测试困难,必须通过容器创建
            // ❌ 可能NPE,构造器中依赖未就绪
            // ❌ 无编译期检查,运行时才发现依赖缺失

            // 适用场景:方法注入
            @Singleton
            public class FlexibleService {
                private final Repository repository;  // 必需依赖
                private CacheService cacheService;    // 可选依赖

                // 构造器注入必需依赖
                public FlexibleService(Repository repository) {
                    this.repository = repository;
                }

                // 方法注入可选依赖
                @Inject
                public void setCacheService(@Nullable CacheService cacheService) {
                    this.cacheService = cacheService;
                }

                public Data getData(String key) {
                    // 尝试从缓存获取
                    if (cacheService != null) {
                        Data cached = cacheService.get(key);
                        if (cached != null) return cached;
                    }

                    // 从数据库查询
                    Data data = repository.findByKey(key);

                    // 写入缓存
                    if (cacheService != null) {
                        cacheService.put(key, data);
                    }

                    return data;
                }
            }

            // 适用场景:
            // ✅ 可选依赖(依赖可能不存在)
            // ✅ 循环依赖(通过setter打破循环)
            // ✅ 需要重新配置依赖的场景
            ---
    b.性能对比
        a.注入性能
            构造器注入和字段注入的性能几乎相同,因为都是编译时生成代码,方法注入略有额外开销(多一次方法调用)。
        b.性能测试
            ---
            // 性能测试代码
            import io.micronaut.context.ApplicationContext;

            public class InjectionPerformanceTest {
                public static void main(String[] args) {
                    ApplicationContext context = ApplicationContext.run();

                    // 测试构造器注入
                    long start1 = System.nanoTime();
                    for (int i = 0; i < 10000; i++) {
                        context.createBean(ConstructorInjectionService.class);
                    }
                    long duration1 = System.nanoTime() - start1;
                    System.out.println("构造器注入: " + duration1 / 1_000_000 + "ms");

                    // 测试字段注入
                    long start2 = System.nanoTime();
                    for (int i = 0; i < 10000; i++) {
                        context.createBean(FieldInjectionService.class);
                    }
                    long duration2 = System.nanoTime() - start2;
                    System.out.println("字段注入: " + duration2 / 1_000_000 + "ms");

                    // 测试方法注入
                    long start3 = System.nanoTime();
                    for (int i = 0; i < 10000; i++) {
                        context.createBean(MethodInjectionService.class);
                    }
                    long duration3 = System.nanoTime() - start3;
                    System.out.println("方法注入: " + duration3 / 1_000_000 + "ms");

                    context.close();
                }
            }

            // 测试结果(10000次Bean创建)
            // 构造器注入: 85ms
            // 字段注入: 87ms
            // 方法注入: 92ms

            // 性能差异很小,优先考虑代码质量和可维护性
            // 推荐使用构造器注入
            ---

02.Setter方法注入
    a.标准Setter
        a.Bean属性设置
            Setter方法注入遵循JavaBean规范,方法名以set开头,接受一个参数。
        b.Setter示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class ConfigurableService {
                private final DatabaseConfig dbConfig;  // 必需,构造器注入
                private CacheConfig cacheConfig;        // 可选,setter注入
                private int maxRetries = 3;             // 可选,默认值
                private Duration timeout = Duration.ofSeconds(30);

                public ConfigurableService(DatabaseConfig dbConfig) {
                    this.dbConfig = dbConfig;
                }

                @Inject
                public void setCacheConfig(@Nullable CacheConfig cacheConfig) {
                    this.cacheConfig = cacheConfig;
                    if (cacheConfig != null) {
                        System.out.println("缓存配置已设置");
                    }
                }

                @Inject
                public void setMaxRetries(@Value("${service.max-retries:3}") int maxRetries) {
                    this.maxRetries = maxRetries;
                    System.out.println("最大重试次数: " + maxRetries);
                }

                @Inject
                public void setTimeout(@Value("${service.timeout:30s}") Duration timeout) {
                    this.timeout = timeout;
                    System.out.println("超时时间: " + timeout);
                }

                public void execute() {
                    // 使用配置
                    System.out.println("数据库: " + dbConfig.getUrl());

                    if (cacheConfig != null) {
                        System.out.println("缓存: " + cacheConfig.getProvider());
                    }

                    System.out.println("最大重试: " + maxRetries);
                    System.out.println("超时: " + timeout);
                }
            }
            ---
    b.自定义方法注入
        a.任意方法名
            @Inject可以标记任意public方法,不限于setter方法,方法可以有多个参数。
        b.自定义方法示例
            ---
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class OrderService {
                private OrderRepository repository;
                private PaymentService paymentService;
                private NotificationService notificationService;

                // 自定义方法名
                @Inject
                public void configureDependencies(
                    OrderRepository repository,
                    PaymentService paymentService) {

                    this.repository = repository;
                    this.paymentService = paymentService;
                    System.out.println("核心依赖已配置");
                }

                // 另一个注入方法
                @Inject
                public void setupNotification(NotificationService notificationService) {
                    this.notificationService = notificationService;
                    System.out.println("通知服务已配置");
                }

                // 初始化方法(在所有注入完成后执行)
                @PostConstruct
                public void initialize() {
                    System.out.println("所有依赖已就绪,初始化完成");
                }

                public Order createOrder(OrderRequest request) {
                    Order order = repository.save(new Order(request));
                    paymentService.process(order);
                    notificationService.notify(order);
                    return order;
                }
            }

            // 注入执行顺序
            // 1. 调用构造器
            // 2. 调用configureDependencies方法
            // 3. 调用setupNotification方法
            // 4. 调用initialize方法(@PostConstruct)
            ---

03.注入方式选择指南
    a.决策树
        a.选择流程
            根据依赖特性选择合适的注入方式,优先使用构造器注入,特殊场景才使用字段或方法注入。
        b.选择建议
            ---
            // 决策流程
            // 1. 依赖是否必需?
            //    ├─ 是 → 使用构造器注入
            //    └─ 否 → 继续判断
            //
            // 2. 依赖是否需要声明为final?
            //    ├─ 是 → 使用构造器注入
            //    └─ 否 → 继续判断
            //
            // 3. 是否需要在Bean创建后重新配置?
            //    ├─ 是 → 使用方法注入
            //    └─ 否 → 继续判断
            //
            // 4. 是否存在循环依赖?
            //    ├─ 是 → 使用Provider或方法注入
            //    └─ 否 → 使用构造器注入

            // 示例1:必需依赖 → 构造器注入
            @Singleton
            public class UserService {
                private final UserRepository repository;  // 必需

                public UserService(UserRepository repository) {
                    this.repository = repository;
                }
            }

            // 示例2:可选依赖 → 方法注入
            @Singleton
            public class EmailService {
                private final SmtpClient smtpClient;  // 必需
                private AttachmentService attachmentService;  // 可选

                public EmailService(SmtpClient smtpClient) {
                    this.smtpClient = smtpClient;
                }

                @Inject
                public void setAttachmentService(@Nullable AttachmentService service) {
                    this.attachmentService = service;
                }
            }

            // 示例3:循环依赖 → Provider
            @Singleton
            public class ServiceA {
                private final Provider<ServiceB> serviceBProvider;

                public ServiceA(Provider<ServiceB> serviceBProvider) {
                    this.serviceBProvider = serviceBProvider;
                }
            }

            // 示例4:大量依赖 → 考虑重构
            @Singleton
            public class GodService {
                // ❌ 不推荐:依赖过多,违反单一职责原则
                public GodService(
                    Dep1 d1, Dep2 d2, Dep3 d3, Dep4 d4, Dep5 d5,
                    Dep6 d6, Dep7 d7, Dep8 d8, Dep9 d9, Dep10 d10) {
                    // 依赖超过5个时应考虑拆分服务
                }
            }

            // ✅ 推荐:拆分为多个职责单一的服务
            @Singleton
            public class UserService {
                private final UserRepository repository;
                private final UserValidator validator;

                public UserService(UserRepository repository, UserValidator validator) {
                    this.repository = repository;
                    this.validator = validator;
                }
            }

            @Singleton
            public class OrderService {
                private final OrderRepository repository;
                private final PaymentService paymentService;

                public OrderService(OrderRepository repository, PaymentService paymentService) {
                    this.repository = repository;
                    this.paymentService = paymentService;
                }
            }
            ---
    b.最佳实践总结
        a.推荐模式
            优先使用构造器注入,依赖声明为final,每个类的依赖数量控制在5个以内,遵循单一职责原则。
        b.反模式
            ---
            // ❌ 反模式1:字段注入 + 在构造器中使用
            @Singleton
            public class BadService1 {
                @Inject
                private ConfigService config;

                public BadService1() {
                    String value = config.getValue();  // NPE!
                }
            }

            // ❌ 反模式2:字段注入 + 无法测试
            @Singleton
            public class BadService2 {
                @Inject
                private ExternalApi externalApi;

                public void process() {
                    externalApi.call();
                }
            }
            // 测试时无法mock externalApi

            // ❌ 反模式3:方法注入 + 必需依赖
            @Singleton
            public class BadService3 {
                private Repository repository;

                @Inject
                public void setRepository(Repository repository) {
                    this.repository = repository;
                }

                public void save(Entity entity) {
                    repository.save(entity);  // 如果setRepository未调用会NPE
                }
            }

            // ✅ 最佳实践
            @Singleton
            public class GoodService {
                private final Repository repository;          // 必需,final
                private final Validator validator;            // 必需,final
                private CacheService cacheService;            // 可选,非final

                // 构造器注入必需依赖
                public GoodService(Repository repository, Validator validator) {
                    this.repository = repository;
                    this.validator = validator;
                }

                // 方法注入可选依赖
                @Inject
                public void setCacheService(@Nullable CacheService cacheService) {
                    this.cacheService = cacheService;
                }

                public Entity save(Entity entity) {
                    if (!validator.validate(entity)) {
                        throw new ValidationException();
                    }

                    repository.save(entity);

                    if (cacheService != null) {
                        cacheService.put(entity.getId(), entity);
                    }

                    return entity;
                }
            }
            ---

3.4 作用域管理

01.内置作用域
    a.@Singleton作用域
        a.全局单例
            @Singleton标记的Bean在整个应用生命周期内只创建一次,所有注入点共享同一实例,适合无状态服务。
        b.单例示例
            ---
            import jakarta.inject.Singleton;

            @Singleton
            public class ConfigurationService {
                private final Map<String, String> config;

                public ConfigurationService() {
                    System.out.println("ConfigurationService实例化");
                    this.config = loadConfig();
                }

                private Map<String, String> loadConfig() {
                    // 加载配置文件
                    Map<String, String> map = new HashMap<>();
                    map.put("app.name", "MyApp");
                    map.put("app.version", "1.0.0");
                    return map;
                }

                public String get(String key) {
                    return config.get(key);
                }
            }

            // 验证单例行为
            @Singleton
            public class ServiceA {
                private final ConfigurationService configService;

                public ServiceA(ConfigurationService configService) {
                    this.configService = configService;
                    System.out.println("ServiceA获得ConfigService: " +
                                     System.identityHashCode(configService));
                }
            }

            @Singleton
            public class ServiceB {
                private final ConfigurationService configService;

                public ServiceB(ConfigurationService configService) {
                    this.configService = configService;
                    System.out.println("ServiceB获得ConfigService: " +
                                     System.identityHashCode(configService));
                }
            }

            // 输出结果
            // ConfigurationService实例化
            // ServiceA获得ConfigService: 123456789
            // ServiceB获得ConfigService: 123456789
            // 两个Service获得的是同一个ConfigService实例
            ---
    b.@Prototype作用域
        a.多实例模式
            @Prototype标记的Bean每次注入都会创建新实例,适合有状态的对象或需要隔离的场景。
        b.Prototype示例
            ---
            import io.micronaut.context.annotation.Prototype;
            import java.util.UUID;

            @Prototype
            public class RequestProcessor {
                private final String processorId;
                private final long createTime;
                private int requestCount = 0;

                public RequestProcessor() {
                    this.processorId = UUID.randomUUID().toString();
                    this.createTime = System.currentTimeMillis();
                    System.out.println("创建处理器: " + processorId);
                }

                public void processRequest(String request) {
                    requestCount++;
                    System.out.println("处理器[" + processorId + "] 处理第" +
                                     requestCount + "个请求: " + request);
                }

                public String getProcessorId() {
                    return processorId;
                }
            }

            // 每次注入都创建新实例
            @Singleton
            public class TaskManager {
                private final BeanContext beanContext;

                public TaskManager(BeanContext beanContext) {
                    this.beanContext = beanContext;
                }

                public void executeTasks() {
                    // 获取3个独立的处理器实例
                    RequestProcessor processor1 = beanContext.getBean(RequestProcessor.class);
                    RequestProcessor processor2 = beanContext.getBean(RequestProcessor.class);
                    RequestProcessor processor3 = beanContext.getBean(RequestProcessor.class);

                    // 并行处理
                    processor1.processRequest("Task-1");
                    processor2.processRequest("Task-2");
                    processor3.processRequest("Task-3");

                    System.out.println("Processor1 ID: " + processor1.getProcessorId());
                    System.out.println("Processor2 ID: " + processor2.getProcessorId());
                    System.out.println("Processor3 ID: " + processor3.getProcessorId());
                    // 3个ID都不相同
                }
            }

            // 输出结果
            // 创建处理器: a1b2c3d4-...
            // 创建处理器: e5f6g7h8-...
            // 创建处理器: i9j0k1l2-...
            // 处理器[a1b2c3d4-...] 处理第1个请求: Task-1
            // 处理器[e5f6g7h8-...] 处理第1个请求: Task-2
            // 处理器[i9j0k1l2-...] 处理第1个请求: Task-3
            // Processor1 ID: a1b2c3d4-...
            // Processor2 ID: e5f6g7h8-...
            // Processor3 ID: i9j0k1l2-...
            ---

02.请求作用域
    a.@RequestScope
        a.HTTP请求级别
            @RequestScope标记的Bean在每个HTTP请求开始时创建,请求结束时销毁,同一请求内所有注入点共享实例。
        b.RequestScope示例
            ---
            import io.micronaut.runtime.http.scope.RequestScope;
            import jakarta.annotation.PreDestroy;
            import java.util.UUID;

            @RequestScope
            public class RequestContext {
                private final String requestId;
                private final long startTime;
                private final Map<String, Object> attributes;

                public RequestContext() {
                    this.requestId = UUID.randomUUID().toString();
                    this.startTime = System.currentTimeMillis();
                    this.attributes = new HashMap<>();
                    System.out.println("请求上下文创建: " + requestId);
                }

                public void setAttribute(String key, Object value) {
                    attributes.put(key, value);
                }

                public Object getAttribute(String key) {
                    return attributes.get(key);
                }

                public String getRequestId() {
                    return requestId;
                }

                public long getElapsedTime() {
                    return System.currentTimeMillis() - startTime;
                }

                @PreDestroy
                public void cleanup() {
                    long duration = getElapsedTime();
                    System.out.println("请求完成: " + requestId +
                                     ", 耗时: " + duration + "ms");
                    attributes.clear();
                }
            }

            // 在Controller中使用
            @Controller("/api/orders")
            public class OrderController {
                private final RequestContext requestContext;
                private final OrderService orderService;

                public OrderController(RequestContext requestContext,
                                     OrderService orderService) {
                    this.requestContext = requestContext;
                    this.orderService = orderService;
                }

                @Post
                public Order createOrder(@Body OrderRequest request) {
                    // 设置请求属性
                    requestContext.setAttribute("user_id", request.getUserId());
                    requestContext.setAttribute("ip", request.getIp());

                    // 处理订单
                    Order order = orderService.createOrder(request);

                    // 记录请求信息
                    System.out.println("请求ID: " + requestContext.getRequestId());
                    System.out.println("耗时: " + requestContext.getElapsedTime() + "ms");

                    return order;
                }
            }

            // Service也可以注入同一RequestContext实例
            @Singleton
            public class OrderService {
                private final RequestContext requestContext;
                private final OrderRepository repository;

                public OrderService(RequestContext requestContext,
                                  OrderRepository repository) {
                    this.requestContext = requestContext;
                    this.repository = repository;
                }

                public Order createOrder(OrderRequest request) {
                    // 访问同一请求上下文
                    String requestId = requestContext.getRequestId();
                    Long userId = (Long) requestContext.getAttribute("user_id");

                    System.out.println("[" + requestId + "] 创建订单,用户ID: " + userId);

                    Order order = new Order();
                    order.setUserId(userId);
                    order.setRequestId(requestId);

                    return repository.save(order);
                }
            }

            // 请求流程
            // 1. 收到HTTP请求
            // 2. 创建RequestContext实例
            // 3. 注入到Controller和Service(同一实例)
            // 4. 处理请求
            // 5. 返回响应
            // 6. 调用RequestContext.cleanup()(@PreDestroy)
            // 7. 销毁RequestContext实例
            ---
    b.请��作用域传播
        a.异步场景
            RequestScope在异步执行中不会自动传播,需要手动传递上下文或使用ThreadLocal。
        b.异步处理示例
            ---
            import io.micronaut.scheduling.annotation.Async;
            import java.util.concurrent.CompletableFuture;

            @Singleton
            public class AsyncOrderService {
                private final RequestContext requestContext;

                public AsyncOrderService(RequestContext requestContext) {
                    this.requestContext = requestContext;
                }

                @Async
                public CompletableFuture<Order> createOrderAsync(OrderRequest request) {
                    // ⚠️ 警告:异步方法中RequestContext可能不可用
                    // 因为异步执行在不同线程,请求作用域不会传播

                    // 解决方案1:在调用前保存需要的数据
                    String requestId = requestContext.getRequestId();

                    return CompletableFuture.supplyAsync(() -> {
                        // 使用保存的requestId
                        System.out.println("异步处理订单: " + requestId);
                        return new Order();
                    });
                }
            }

            // 解决方案2:使用ThreadLocal传播上下文
            import io.micronaut.core.propagation.PropagatedContext;

            @Singleton
            public class ImprovedAsyncService {
                private final RequestContext requestContext;

                public ImprovedAsyncService(RequestContext requestContext) {
                    this.requestContext = requestContext;
                }

                @Async
                public CompletableFuture<Order> createOrderAsync(OrderRequest request) {
                    // 捕获当前上下文
                    try (PropagatedContext.Scope scope = PropagatedContext.getOrEmpty().plus(
                        "requestId", requestContext.getRequestId()).propagate()) {

                        return CompletableFuture.supplyAsync(() -> {
                            // 在异步线程中访问传播的上下文
                            String requestId = PropagatedContext.get()
                                .get("requestId", String.class).orElse("unknown");
                            System.out.println("异步处理订单: " + requestId);
                            return new Order();
                        });
                    }
                }
            }
            ---

03.ThreadLocal作用域
    a.@ThreadLocal注解
        a.线程级别隔离
            @ThreadLocal标记的Bean为每个线程创建独立实例,不同线程间互不干扰,适合线程上下文管理。
        b.ThreadLocal示例
            ---
            import io.micronaut.context.annotation.ThreadLocal;
            import java.util.HashMap;
            import java.util.Map;

            @ThreadLocal
            public class ThreadContext {
                private final String threadId;
                private final Map<String, Object> data;

                public ThreadContext() {
                    this.threadId = Thread.currentThread().getName();
                    this.data = new HashMap<>();
                    System.out.println("为线程创建上下文: " + threadId);
                }

                public void set(String key, Object value) {
                    data.put(key, value);
                }

                public Object get(String key) {
                    return data.get(key);
                }

                public String getThreadId() {
                    return threadId;
                }
            }

            // 多线程使用示例
            @Singleton
            public class ParallelProcessor {
                private final ThreadContext threadContext;
                private final ExecutorService executor;

                public ParallelProcessor(ThreadContext threadContext) {
                    this.threadContext = threadContext;
                    this.executor = Executors.newFixedThreadPool(3);
                }

                public void processInParallel() {
                    // 提交3个任务到不同线程
                    for (int i = 1; i <= 3; i++) {
                        int taskId = i;
                        executor.submit(() -> {
                            // 每个线程获得独立的ThreadContext实例
                            threadContext.set("task_id", taskId);
                            threadContext.set("start_time", System.currentTimeMillis());

                            System.out.println("线程 " + threadContext.getThreadId() +
                                             " 处理任务 " + threadContext.get("task_id"));

                            // 模拟处理
                            Thread.sleep(100);

                            long duration = System.currentTimeMillis() -
                                          (Long) threadContext.get("start_time");
                            System.out.println("线程 " + threadContext.getThreadId() +
                                             " 完成,耗时: " + duration + "ms");
                        });
                    }
                }
            }

            // 输出结果
            // 为线程创建上下文: pool-1-thread-1
            // 为线程创建上下文: pool-1-thread-2
            // 为线程创建上下文: pool-1-thread-3
            // 线程 pool-1-thread-1 处理任务 1
            // 线程 pool-1-thread-2 处理任务 2
            // 线程 pool-1-thread-3 处理任务 3
            // 线程 pool-1-thread-1 完成,耗时: 102ms
            // 线程 pool-1-thread-2 完成,耗时: 103ms
            // 线程 pool-1-thread-3 完成,耗时: 101ms
            ---
    b.线程池注意事项
        a.线程复用问题
            使用线程池时,ThreadLocal Bean会在线程首次执行时创建,线程复用时不会重新创建,可能导致状态污染。
        b.清理示例
            ---
            import jakarta.annotation.PreDestroy;

            @ThreadLocal
            public class SafeThreadContext {
                private final Map<String, Object> data = new HashMap<>();

                public void set(String key, Object value) {
                    data.put(key, value);
                }

                public Object get(String key) {
                    return data.get(key);
                }

                // 手动清理方法
                public void clear() {
                    data.clear();
                    System.out.println("线程上下文已清理: " +
                                     Thread.currentThread().getName());
                }

                @PreDestroy
                public void cleanup() {
                    // 线程结束时自动清理
                    clear();
                }
            }

            @Singleton
            public class TaskExecutor {
                private final SafeThreadContext threadContext;

                public TaskExecutor(SafeThreadContext threadContext) {
                    this.threadContext = threadContext;
                }

                public void executeTask(String taskData) {
                    try {
                        // 使用上下文
                        threadContext.set("task_data", taskData);
                        processTask();
                    } finally {
                        // ✅ 重要:任务完成后清理上下文
                        threadContext.clear();
                    }
                }

                private void processTask() {
                    String data = (String) threadContext.get("task_data");
                    System.out.println("处理任务: " + data);
                }
            }
            ---

04.@Refreshable作用域
    a.配置刷新
        a.动态重载
            @Refreshable标记的Bean在配置刷新时会被销毁并重新创建,自动获取最新配置值。
        b.Refreshable示例
            ---
            import io.micronaut.context.annotation.Refreshable;
            import io.micronaut.context.annotation.ConfigurationProperties;
            import jakarta.annotation.PostConstruct;
            import jakarta.annotation.PreDestroy;

            @Refreshable
            @ConfigurationProperties("database")
            public class DatabaseConfig {
                private String url;
                private int maxConnections;
                private Duration connectionTimeout;

                public DatabaseConfig() {
                    System.out.println("DatabaseConfig实例创建");
                }

                @PostConstruct
                public void init() {
                    System.out.println("DatabaseConfig初始化:");
                    System.out.println("  URL: " + url);
                    System.out.println("  最大连接数: " + maxConnections);
                    System.out.println("  超时时间: " + connectionTimeout);
                }

                @PreDestroy
                public void cleanup() {
                    System.out.println("DatabaseConfig销毁(配置已变更)");
                }

                // Getter和Setter
                public String getUrl() { return url; }
                public void setUrl(String url) { this.url = url; }
                public int getMaxConnections() { return maxConnections; }
                public void setMaxConnections(int maxConnections) {
                    this.maxConnections = maxConnections;
                }
                public Duration getConnectionTimeout() { return connectionTimeout; }
                public void setConnectionTimeout(Duration connectionTimeout) {
                    this.connectionTimeout = connectionTimeout;
                }
            }

            // 使用Refreshable Bean
            @Singleton
            public class ConnectionPool {
                private final DatabaseConfig config;

                public ConnectionPool(DatabaseConfig config) {
                    this.config = config;
                }

                public void printConfig() {
                    // 总是访问最新的DatabaseConfig实例
                    System.out.println("当前数据库URL: " + config.getUrl());
                    System.out.println("当前最大连接数: " + config.getMaxConnections());
                }
            }

            // 配置文件 application.yml
            // database:
            //   url: jdbc:mysql://localhost:3306/mydb
            //   max-connections: 10
            //   connection-timeout: 5s

            // 配置刷新流程
            // 1. 修改配置文件或环境变量
            // 2. POST /refresh 触发刷新
            // 3. 调用DatabaseConfig.cleanup()(@PreDestroy)
            // 4. 销毁旧DatabaseConfig实例
            // 5. 重新读取配置
            // 6. 创建新DatabaseConfig实例
            // 7. 调用DatabaseConfig.init()(@PostConstruct)
            // 8. 重新注入到依赖它的Bean
            ---
    b.刷新端点
        a.启用刷新功能
            需要添加management依赖并启用refresh端点,通过HTTP POST触发配置刷新。
        b.刷新配置
            ---
            // pom.xml
            // <dependency>
            //     <groupId>io.micronaut</groupId>
            //     <artifactId>micronaut-management</artifactId>
            // </dependency>

            // application.yml
            // endpoints:
            //   refresh:
            //     enabled: true
            //     sensitive: false  # 开发环境,生产环境应设为true

            // 触发刷新
            // curl -X POST http://localhost:8080/refresh

            // 监听刷新事件
            import io.micronaut.runtime.context.scope.refresh.RefreshEvent;
            import io.micronaut.context.event.ApplicationEventListener;

            @Singleton
            public class RefreshEventListener implements
                ApplicationEventListener<RefreshEvent> {

                @Override
                public void onApplicationEvent(RefreshEvent event) {
                    System.out.println("配置刷新事件触发");
                    System.out.println("刷新的配置键: " + event.getSource());

                    // 执行刷新后的操作
                    // 例如:重新连接数据库、更新缓存配置等
                }
            }

            // 编程式刷新
            import io.micronaut.management.endpoint.refresh.RefreshEndpoint;

            @Singleton
            public class ConfigManager {
                private final RefreshEndpoint refreshEndpoint;

                public ConfigManager(RefreshEndpoint refreshEndpoint) {
                    this.refreshEndpoint = refreshEndpoint;
                }

                public void refreshConfig() {
                    // 编程式触发刷新
                    String[] refreshedKeys = refreshEndpoint.refresh(null);

                    System.out.println("刷新了 " + refreshedKeys.length + " 个配置");
                    for (String key : refreshedKeys) {
                        System.out.println("  - " + key);
                    }
                }
            }
            ---

05.自定义作用域
    a.CustomScope接口
        a.作用域定义
            通过实现CustomScope接口可以创建自定义作用域,控制Bean的创建、缓存和销毁策略。
        b.自定义作用域实现
            ---
            import io.micronaut.context.scope.CustomScope;
            import io.micronaut.context.BeanResolutionContext;
            import io.micronaut.inject.BeanDefinition;
            import io.micronaut.inject.BeanIdentifier;
            import jakarta.inject.Singleton;
            import java.lang.annotation.*;

            // 1. 定义作用域注解
            @Documented
            @Retention(RetentionPolicy.RUNTIME)
            @Target({ElementType.TYPE, ElementType.METHOD})
            @Scope
            public @interface TenantScope {
            }

            // 2. 实现作用域逻辑
            @Singleton
            public class TenantScopeImpl implements CustomScope<TenantScope> {
                // 每个租户一个Bean实例缓存
                private final Map<String, Map<BeanIdentifier, Object>> tenantBeans =
                    new ConcurrentHashMap<>();

                @Override
                public Class<TenantScope> annotationType() {
                    return TenantScope.class;
                }

                @Override
                public <T> T get(BeanResolutionContext resolutionContext,
                               BeanDefinition<T> beanDefinition,
                               BeanIdentifier identifier,
                               Provider<T> provider) {
                    // 获取当前租户ID
                    String tenantId = getCurrentTenantId();

                    // 为每个租户维护独立的Bean缓存
                    Map<BeanIdentifier, Object> beans =
                        tenantBeans.computeIfAbsent(tenantId,
                            k -> new ConcurrentHashMap<>());

                    // 如果租户Bean不存在,创建新实例
                    return (T) beans.computeIfAbsent(identifier, k -> {
                        T bean = provider.get();
                        System.out.println("为租户[" + tenantId + "]创建Bean: " +
                                         beanDefinition.getBeanType().getSimpleName());
                        return bean;
                    });
                }

                @Override
                public <T> Optional<T> remove(BeanIdentifier identifier) {
                    String tenantId = getCurrentTenantId();
                    Map<BeanIdentifier, Object> beans = tenantBeans.get(tenantId);

                    if (beans != null) {
                        T removed = (T) beans.remove(identifier);
                        System.out.println("移除租户[" + tenantId + "]的Bean");
                        return Optional.ofNullable(removed);
                    }

                    return Optional.empty();
                }

                private String getCurrentTenantId() {
                    // 从ThreadLocal或请求头获取租户ID
                    return TenantContext.getCurrentTenantId();
                }

                // 清理指定租户的所有Bean
                public void clearTenant(String tenantId) {
                    Map<BeanIdentifier, Object> beans = tenantBeans.remove(tenantId);
                    if (beans != null) {
                        System.out.println("清理租户[" + tenantId + "]的" +
                                         beans.size() + "个Bean");
                    }
                }
            }

            // 3. 租户上下文管理
            @Singleton
            public class TenantContext {
                private static final ThreadLocal<String> currentTenant =
                    new ThreadLocal<>();

                public static void setCurrentTenantId(String tenantId) {
                    currentTenant.set(tenantId);
                }

                public static String getCurrentTenantId() {
                    String tenantId = currentTenant.get();
                    if (tenantId == null) {
                        throw new IllegalStateException("租户ID未设置");
                    }
                    return tenantId;
                }

                public static void clear() {
                    currentTenant.remove();
                }
            }
            ---
    b.使用自定义作用域
        a.应用场景
            自定义作用域适合多租户系统、会话管理、缓存策略等需要特殊Bean生命周期的场景。
        b.使用示例
            ---
            // 定义租户级别的服务
            @TenantScope
            public class TenantDataSource implements DataSource {
                private final String tenantId;
                private Connection connection;

                public TenantDataSource() {
                    this.tenantId = TenantContext.getCurrentTenantId();
                    System.out.println("创建租户数据源: " + tenantId);
                }

                @PostConstruct
                public void init() throws SQLException {
                    // 根据租户ID连接到对应数据库
                    String url = "jdbc:mysql://localhost:3306/tenant_" + tenantId;
                    this.connection = DriverManager.getConnection(url);
                    System.out.println("租户[" + tenantId + "]数据库连接已建立");
                }

                @Override
                public Connection getConnection() throws SQLException {
                    return connection;
                }

                @PreDestroy
                public void cleanup() throws SQLException {
                    if (connection != null && !connection.isClosed()) {
                        connection.close();
                        System.out.println("租户[" + tenantId + "]数据库连接已关闭");
                    }
                }
            }

            // 租户级别的Repository
            @TenantScope
            public class TenantUserRepository {
                private final TenantDataSource dataSource;

                public TenantUserRepository(TenantDataSource dataSource) {
                    this.dataSource = dataSource;
                    System.out.println("创建租户Repository");
                }

                public List<User> findAll() throws SQLException {
                    try (Connection conn = dataSource.getConnection();
                         Statement stmt = conn.createStatement();
                         ResultSet rs = stmt.executeQuery("SELECT * FROM users")) {

                        List<User> users = new ArrayList<>();
                        while (rs.next()) {
                            users.add(mapUser(rs));
                        }
                        return users;
                    }
                }

                private User mapUser(ResultSet rs) throws SQLException {
                    // 映射逻辑
                    return new User();
                }
            }

            // 使用示例
            @Controller("/api/users")
            public class UserController {
                private final TenantUserRepository userRepository;

                public UserController(TenantUserRepository userRepository) {
                    this.userRepository = userRepository;
                }

                @Get
                public List<User> getUsers(@Header("X-Tenant-Id") String tenantId) {
                    try {
                        // 设置当前租户
                        TenantContext.setCurrentTenantId(tenantId);

                        // 获取租户数据(使用租户级别的Repository)
                        return userRepository.findAll();

                    } finally {
                        // 清理租户上下文
                        TenantContext.clear();
                    }
                }
            }

            // 多租户请求示例
            // 请求1: GET /api/users  Header: X-Tenant-Id=tenant-001
            // 输出:
            // 创建租户数据源: tenant-001
            // 租户[tenant-001]数据库连接已建立
            // 创建租户Repository
            // 返回tenant-001的用户列表

            // 请求2: GET /api/users  Header: X-Tenant-Id=tenant-002
            // 输出:
            // 创建租户数据源: tenant-002
            // 租户[tenant-002]数据库连接已建立
            // 创建租户Repository
            // 返回tenant-002的用户列表

            // 请求3: GET /api/users  Header: X-Tenant-Id=tenant-001
            // 输出:
            // 返回tenant-001的用户列表(复用已创建的实例)
            ---

06.作用域选择指南
    a.选择决策
        a.作用域决策树
            根据Bean的特性选择合适的作用域,考虑线程安全性、状态管理、性能和资源占用。
        b.决策示例
            ---
            // 决策流程
            // 1. Bean是否有状态(包含可变字段)?
            //    ├─ 否(无状态)→ 使用@Singleton
            //    └─ 是(有状态)→ 继续判断

            // 2. 状态是否与HTTP请求相关?
            //    ├─ 是 → 使用@RequestScope
            //    └─ 否 → 继续判断

            // 3. 状态是否与线程相关?
            //    ├─ 是 → 使用@ThreadLocal
            //    └─ 否 → 继续判断

            // 4. 是否需要独立实例?
            //    ├─ 是 → 使用@Prototype
            //    └─ 否 → 继续判断

            // 5. 配置是否需要动态刷新?
            //    ├─ 是 → 使用@Refreshable
            //    └─ 否 → 使用@Singleton

            // 示例1:无状态服务 → Singleton
            @Singleton
            public class MathService {
                public int add(int a, int b) {
                    return a + b;
                }
                // 无状态,线程安全,使用单例
            }

            // 示例2:请求相关 → RequestScope
            @RequestScope
            public class UserSession {
                private User currentUser;
                private String sessionToken;
                // 每个请求独立实例
            }

            // 示例3:线程相关 → ThreadLocal
            @ThreadLocal
            public class TransactionContext {
                private String transactionId;
                private List<String> operations;
                // 每个线程独立实例
            }

            // 示例4:需要隔离 → Prototype
            @Prototype
            public class ReportGenerator {
                private List<ReportSection> sections = new ArrayList<>();

                public void addSection(ReportSection section) {
                    sections.add(section);
                }
                // 每次使用创建新实例,避免状态污染
            }

            // 示例5:动态配置 → Refreshable
            @Refreshable
            @ConfigurationProperties("feature-flags")
            public class FeatureFlags {
                private boolean newUIEnabled;
                private boolean betaFeaturesEnabled;
                // 配置变更时重新创建
            }

            // 示例6:有状态但需共享 → 需要重新设计
            // ❌ 错误示例
            @Singleton
            public class BadCounter {
                private int count = 0;  // 多线程不安全!

                public void increment() {
                    count++;  // 竞态条件
                }
            }

            // ✅ 正确方案1:使用原子类
            @Singleton
            public class SafeCounter {
                private final AtomicInteger count = new AtomicInteger(0);

                public void increment() {
                    count.incrementAndGet();
                }
            }

            // ✅ 正确方案2:无状态设计
            @Singleton
            public class StatelessCounter {
                public int increment(int current) {
                    return current + 1;
                }
            }
            ---
    b.性能与资源权衡
        a.性能对比
            Singleton性能最优,Prototype和RequestScope会频繁创建实例,需要权衡性能和资源占用。
        b.资源使用示例
            ---
            // 性能测试
            import io.micronaut.context.BeanContext;

            public class ScopePerformanceTest {
                public static void main(String[] args) {
                    BeanContext context = BeanContext.run();

                    // 测试1:Singleton
                    long start1 = System.nanoTime();
                    for (int i = 0; i < 100000; i++) {
                        SingletonBean bean = context.getBean(SingletonBean.class);
                    }
                    long duration1 = System.nanoTime() - start1;
                    System.out.println("Singleton获取10万次: " +
                                     duration1 / 1_000_000 + "ms");

                    // 测试2:Prototype
                    long start2 = System.nanoTime();
                    for (int i = 0; i < 100000; i++) {
                        PrototypeBean bean = context.getBean(PrototypeBean.class);
                    }
                    long duration2 = System.nanoTime() - start2;
                    System.out.println("Prototype创建10万次: " +
                                     duration2 / 1_000_000 + "ms");

                    context.close();
                }
            }

            // 测试结果
            // Singleton获取10万次: 12ms(缓存查找)
            // Prototype创建10万次: 850ms(每次创建新实例)

            // 内存占用对比
            @Singleton
            public class HeavyService {
                private final byte[] data = new byte[1024 * 1024];  // 1MB
                // 整个应用只占用1MB
            }

            @Prototype
            public class HeavyPrototype {
                private final byte[] data = new byte[1024 * 1024];  // 1MB
                // 每次创建占用1MB,需要注意内存泄漏
            }

            // 使用建议
            // ✅ 大对象、重量级资源 → 使用Singleton
            // ✅ 频繁创建的轻量对象 → 使用Prototype
            // ✅ 请求级别的小对象 → 使用RequestScope
            // ❌ 避免大对象使用Prototype(内存占用高)
            // ❌ 避免频繁创建重量级对象(性能问题)
            ---

07.作用域陷阱
    a.作用域不匹配
        a.依赖作用域问题
            Singleton Bean不应依赖Prototype或RequestScope Bean,否则会导致作用域泄漏,需要使用Provider延迟获取。
        b.作用域陷阱示例
            ---
            // ❌ 错误:Singleton依赖Prototype
            @Prototype
            public class TaskHandler {
                private String taskId = UUID.randomUUID().toString();

                public void handle() {
                    System.out.println("处理任务: " + taskId);
                }
            }

            @Singleton
            public class TaskManager {
                private final TaskHandler taskHandler;

                public TaskManager(TaskHandler taskHandler) {
                    // ⚠️ 问题:Singleton在创建时注入一个Prototype实例
                    // 之后TaskManager一直使用这个实例,Prototype失去意义
                    this.taskHandler = taskHandler;
                }

                public void executeTask() {
                    // 总是使用同一个TaskHandler实例
                    taskHandler.handle();  // taskId永远相同!
                }
            }

            // ✅ 正确:使用Provider
            import jakarta.inject.Provider;

            @Singleton
            public class CorrectTaskManager {
                private final Provider<TaskHandler> taskHandlerProvider;

                public CorrectTaskManager(Provider<TaskHandler> taskHandlerProvider) {
                    this.taskHandlerProvider = taskHandlerProvider;
                }

                public void executeTask() {
                    // 每次调用时获取新的Prototype实例
                    TaskHandler handler = taskHandlerProvider.get();
                    handler.handle();  // taskId每次不同
                }
            }

            // ❌ 错误:Singleton依赖RequestScope
            @RequestScope
            public class CurrentUser {
                private User user;
                // 每个请求独立实例
            }

            @Singleton
            public class UserAuditService {
                private final CurrentUser currentUser;

                public UserAuditService(CurrentUser currentUser) {
                    // ⚠️ 问题:Singleton创建时注入第一个请求的CurrentUser
                    // 后续所有请求都使用这个实例,导致错误
                    this.currentUser = currentUser;
                }
            }

            // ✅ 正确:使用Provider
            @Singleton
            public class CorrectUserAuditService {
                private final Provider<CurrentUser> currentUserProvider;

                public CorrectUserAuditService(Provider<CurrentUser> currentUserProvider) {
                    this.currentUserProvider = currentUserProvider;
                }

                public void audit(String action) {
                    // 每次调用时获取当前请求的CurrentUser
                    CurrentUser user = currentUserProvider.get();
                    log(user, action);
                }

                private void log(CurrentUser user, String action) {
                    // 记录审计日志
                }
            }
            ---
    b.作用域混合最佳实践
        a.依赖规则
            遵循作用域依赖规则,长生命周期Bean可以依赖短生命周期Bean,但需要通过Provider获取,确保每次获取最新实例。
        b.最佳实践示例
            ---
            // 作用域依赖规则
            // ✅ 允许:窄作用域 → 宽作用域
            @RequestScope
            public class RequestBean {
                private final SingletonBean singletonBean;  // OK
            }

            // ❌ 禁止:宽作用域 → 窄作用域(直接依赖)
            @Singleton
            public class SingletonBean {
                private final RequestBean requestBean;  // 错误!
            }

            // ✅ 允许:宽作用域 → 窄作用域(通过Provider)
            @Singleton
            public class CorrectSingletonBean {
                private final Provider<RequestBean> requestBeanProvider;  // OK
            }

            // 完整示例:电商系统
            // 1. Singleton:配置服务
            @Singleton
            public class AppConfig {
                public String getAppName() {
                    return "ECommerce";
                }
            }

            // 2. RequestScope:当前用户
            @RequestScope
            public class CurrentUserContext {
                private Long userId;
                private String username;

                public void setUser(Long userId, String username) {
                    this.userId = userId;
                    this.username = username;
                }

                public Long getUserId() { return userId; }
                public String getUsername() { return username; }
            }

            // 3. Prototype:订单处理器
            @Prototype
            public class OrderProcessor {
                private final String processorId = UUID.randomUUID().toString();

                public Order process(OrderRequest request) {
                    System.out.println("处理器[" + processorId + "]处理订单");
                    return new Order(request);
                }
            }

            // 4. Singleton服务混合使用
            @Singleton
            public class OrderService {
                private final AppConfig appConfig;                          // Singleton
                private final Provider<CurrentUserContext> userProvider;    // RequestScope
                private final Provider<OrderProcessor> processorProvider;   // Prototype

                public OrderService(
                    AppConfig appConfig,
                    Provider<CurrentUserContext> userProvider,
                    Provider<OrderProcessor> processorProvider) {

                    this.appConfig = appConfig;
                    this.userProvider = userProvider;
                    this.processorProvider = processorProvider;
                }

                public Order createOrder(OrderRequest request) {
                    // 访问Singleton(直接使用)
                    System.out.println("应用: " + appConfig.getAppName());

                    // 访问RequestScope(通过Provider)
                    CurrentUserContext user = userProvider.get();
                    System.out.println("当前用户: " + user.getUsername());

                    // 访问Prototype(通过Provider,每次获取新实例)
                    OrderProcessor processor = processorProvider.get();
                    return processor.process(request);
                }
            }

            // 作用域总结
            // @Singleton      → 无状态服务、配置、工具类
            // @Prototype      → 有状态对象、需要隔离的对象
            // @RequestScope   → 请求级上下文、用户会话
            // @ThreadLocal    → 线程级上下文、事务管理
            // @Refreshable    → 动态配置、特性开关
            // 自定义作用域    → 多租户、特殊生命周期需求
            ---

3.5 条件化Bean

01.@Requires注解
    a.条件创建Bean
        a.基本条件判断
            @Requires注解允许根据配置、环境、类存在等条件决定是否创建Bean,实现灵活的组件装配。
        b.基础条件示例
            ---
            import io.micronaut.context.annotation.Requires;
            import jakarta.inject.Singleton;

            // 示例1:根据配置属性决定是否创建
            @Singleton
            @Requires(property = "redis.enabled", value = "true")
            public class RedisCache implements CacheService {
                public RedisCache() {
                    System.out.println("Redis缓存已启用");
                }

                @Override
                public void put(String key, Object value) {
                    // Redis缓存实现
                }

                @Override
                public Object get(String key) {
                    return null;
                }
            }

            // 示例2:配置不存在时创建(默认实现)
            @Singleton
            @Requires(property = "redis.enabled", value = "false", defaultValue = "false")
            public class InMemoryCache implements CacheService {
                private final Map<String, Object> cache = new ConcurrentHashMap<>();

                public InMemoryCache() {
                    System.out.println("内存缓存已启用");
                }

                @Override
                public void put(String key, Object value) {
                    cache.put(key, value);
                }

                @Override
                public Object get(String key) {
                    return cache.get(key);
                }
            }

            // application.yml场景1
            // redis:
            //   enabled: true
            // 结果:创建RedisCache

            // application.yml场景2
            // redis:
            //   enabled: false
            // 结果:创建InMemoryCache

            // application.yml场景3(未配置redis.enabled)
            // 结果:创建InMemoryCache(defaultValue="false")
            ---
    b.配置条件
        a.属性匹配
            @Requires支持多种配置条件,包括属性存在、属性值匹配、属性不存在等。
        b.配置条件示例
            ---
            import io.micronaut.context.annotation.Requires;

            // 条件1:属性存在
            @Singleton
            @Requires(property = "database.url")
            public class DatabaseService {
                // 仅当database.url配置存在时创建
            }

            // 条件2:属性值匹配
            @Singleton
            @Requires(property = "app.mode", value = "production")
            public class ProductionMonitor {
                // 仅在生产环境创建
            }

            // 条件3:属性值不匹配
            @Singleton
            @Requires(property = "app.mode", notEquals = "production")
            public class DevelopmentDebugger {
                // 非生产环境创建
            }

            // 条件4:属性不存在
            @Singleton
            @Requires(missingProperty = "external.service.url")
            public class MockExternalService implements ExternalService {
                // 外部服务未配置时使用Mock
                @Override
                public String call() {
                    return "Mock Response";
                }
            }

            // 条件5:多个属性条件(AND关系)
            @Singleton
            @Requires(property = "oauth.enabled", value = "true")
            @Requires(property = "oauth.provider", value = "google")
            public class GoogleOAuthService {
                // 同时满足:oauth启用 且 provider为google
            }

            // 条件6:属性值模式匹配
            @Singleton
            @Requires(property = "storage.type", pattern = "s3|oss|obs")
            public class CloudStorageService {
                private final String storageType;

                public CloudStorageService(@Value("${storage.type}") String storageType) {
                    this.storageType = storageType;
                    System.out.println("云存储类型: " + storageType);
                }
            }

            // 配置示例
            // application-dev.yml
            // app:
            //   mode: development
            // 结果:创建DevelopmentDebugger

            // application-prod.yml
            // app:
            //   mode: production
            // oauth:
            //   enabled: true
            //   provider: google
            // storage:
            //   type: s3
            // 结果:创建ProductionMonitor, GoogleOAuthService, CloudStorageService
            ---

02.环境条件
    a.@Requires(env)
        a.环境判断
            根据当前激活的环境(dev、test、prod等)决定是否创建Bean,实现环境特定的组件配置。
        b.环境条件示例
            ---
            import io.micronaut.context.annotation.Requires;
            import io.micronaut.context.env.Environment;

            // 示例1:仅在开发环境创建
            @Singleton
            @Requires(env = Environment.DEVELOPMENT)
            public class H2DatabaseInitializer {
                @PostConstruct
                public void init() {
                    System.out.println("初始化H2内存数据库(开发环境)");
                    // 创建测试数据
                    createTestData();
                }

                private void createTestData() {
                    // 插入测试数据
                }
            }

            // 示例2:仅在生产环境创建
            @Singleton
            @Requires(env = Environment.PRODUCTION)
            public class ProductionDataSource implements DataSource {
                public ProductionDataSource() {
                    System.out.println("连接生产数据库");
                }

                @Override
                public Connection getConnection() throws SQLException {
                    return DriverManager.getConnection(
                        "jdbc:mysql://prod-db:3306/mydb");
                }
            }

            // 示例3:多环境条件
            @Singleton
            @Requires(env = {Environment.DEVELOPMENT, Environment.TEST})
            public class MockEmailService implements EmailService {
                @Override
                public void send(String to, String subject, String body) {
                    // 开发和测试环境不发送真实邮件
                    System.out.println("模拟发送邮件到: " + to);
                    System.out.println("主题: " + subject);
                }
            }

            // 示例4:排除特定环境
            @Singleton
            @Requires(notEnv = Environment.TEST)
            public class RealPaymentGateway implements PaymentGateway {
                // 非测试环境使用真实支付网关
                @Override
                public PaymentResult charge(BigDecimal amount) {
                    System.out.println("调用真实支付接口");
                    return new PaymentResult(true);
                }
            }

            @Singleton
            @Requires(env = Environment.TEST)
            public class MockPaymentGateway implements PaymentGateway {
                // 测试环境使用Mock支付
                @Override
                public PaymentResult charge(BigDecimal amount) {
                    System.out.println("Mock支付: " + amount);
                    return new PaymentResult(true);
                }
            }

            // 启动命令与环境
            // java -jar app.jar                        → 默认环境
            // java -jar app.jar -Dmicronaut.environments=dev  → 开发环境
            // java -jar app.jar -Dmicronaut.environments=prod → 生产环境
            // java -jar app.jar -Dmicronaut.environments=test → 测试环境
            ---
    b.自定义环境
        a.环境定义
            可以定义自定义环境名称,根据部署场景创建不同的Bean配置。
        b.自定义环境示例
            ---
            // 定义自定义环境
            // application.yml
            // micronaut:
            //   environments:
            //     - staging
            //     - aws-cn

            // 使用自定义环境
            @Singleton
            @Requires(env = "staging")
            public class StagingMonitor {
                public StagingMonitor() {
                    System.out.println("预发布环境监控已启用");
                }
            }

            @Singleton
            @Requires(env = "aws-cn")
            public class ChinaRegionService {
                public ChinaRegionService() {
                    System.out.println("中国区服务已启用");
                }
            }

            // 多环境组合
            @Singleton
            @Requires(env = {"staging", "production"})
            public class PerformanceMonitor {
                // 在预发布和生产环境启用性能监控
            }

            // 启动应用
            // java -jar app.jar -Dmicronaut.environments=staging
            // 结果:创建StagingMonitor和PerformanceMonitor

            // java -jar app.jar -Dmicronaut.environments=staging,aws-cn
            // 结果:创建StagingMonitor、ChinaRegionService、PerformanceMonitor
            ---

03.类存在条件
    a.@Requires(classes)
        a.依赖类检测
            根据classpath中是否存在特定类来决定是否创建Bean,实现可选依赖的自动配置。
        b.类存在示例
            ---
            import io.micronaut.context.annotation.Requires;

            // 示例1:Redis客户端存在时启用Redis缓存
            @Singleton
            @Requires(classes = {
                io.lettuce.core.RedisClient.class,
                io.micronaut.redis.RedisConfiguration.class
            })
            public class RedisConfiguration {
                public RedisConfiguration() {
                    System.out.println("检测到Redis依赖,启用Redis配置");
                }

                @Bean
                public RedisClient redisClient() {
                    return RedisClient.create("redis://localhost:6379");
                }
            }

            // 示例2:Kafka客户端存在时启用消息队列
            @Singleton
            @Requires(classes = org.apache.kafka.clients.producer.KafkaProducer.class)
            public class KafkaMessagePublisher implements MessagePublisher {
                private final KafkaProducer<String, String> producer;

                public KafkaMessagePublisher() {
                    System.out.println("Kafka客户端可用,启用Kafka发布器");
                    Properties props = new Properties();
                    props.put("bootstrap.servers", "localhost:9092");
                    this.producer = new KafkaProducer<>(props);
                }

                @Override
                public void publish(String topic, String message) {
                    producer.send(new ProducerRecord<>(topic, message));
                }
            }

            // 示例3:类不存在时使用备用方案
            @Singleton
            @Requires(missingClasses = "org.apache.kafka.clients.producer.KafkaProducer")
            public class InMemoryMessagePublisher implements MessagePublisher {
                public InMemoryMessagePublisher() {
                    System.out.println("Kafka不可用,使用内存队列");
                }

                @Override
                public void publish(String topic, String message) {
                    System.out.println("发布消息到内存队列[" + topic + "]: " + message);
                }
            }

            // pom.xml包含Redis依赖时
            // <dependency>
            //     <groupId>io.micronaut.redis</groupId>
            //     <artifactId>micronaut-redis-lettuce</artifactId>
            // </dependency>
            // 结果:创建RedisConfiguration

            // pom.xml包含Kafka依赖时
            // <dependency>
            //     <groupId>org.apache.kafka</groupId>
            //     <artifactId>kafka-clients</artifactId>
            // </dependency>
            // 结果:创建KafkaMessagePublisher

            // pom.xml不包含Kafka依赖时
            // 结果:创建InMemoryMessagePublisher
            ---
    b.Bean存在条件
        a.@Requires(beans)
            根据容器中是否存在特定Bean来决定是否创建当前Bean,实现Bean间的条件依赖。
        b.Bean条件示例
            ---
            // 示例1:依赖DataSource存在
            @Singleton
            @Requires(beans = DataSource.class)
            public class DatabaseHealthIndicator implements HealthIndicator {
                private final DataSource dataSource;

                public DatabaseHealthIndicator(DataSource dataSource) {
                    this.dataSource = dataSource;
                }

                @Override
                public HealthStatus check() {
                    try (Connection conn = dataSource.getConnection()) {
                        return HealthStatus.UP;
                    } catch (SQLException e) {
                        return HealthStatus.DOWN;
                    }
                }
            }

            // 示例2:某Bean不存在时创建备用Bean
            @Singleton
            @Requires(missingBeans = RedisClient.class)
            public class LocalCacheManager implements CacheManager {
                public LocalCacheManager() {
                    System.out.println("Redis客户端不存在,使用本地缓存");
                }
            }

            // 示例3:组合条件
            @Singleton
            @Requires(beans = {DataSource.class, TransactionManager.class})
            @Requires(property = "jpa.enabled", value = "true")
            public class JpaConfiguration {
                // 同时满足:
                // 1. DataSource Bean存在
                // 2. TransactionManager Bean存在
                // 3. jpa.enabled=true
                public JpaConfiguration() {
                    System.out.println("JPA配置已启用");
                }
            }

            // 示例4:条件化@Primary
            @Primary
            @Singleton
            @Requires(beans = RedisClient.class)
            public class RedisCacheManager implements CacheManager {
                // 如果Redis可用,优先使用Redis缓存
            }

            @Singleton
            @Requires(missingBeans = RedisClient.class)
            public class SimpleCacheManager implements CacheManager {
                // Redis不可用时使用简单缓存
            }
            ---

04.SDK版本条件
    a.@Requires(sdk)
        a.JDK版本判断
            根据当前运行的JDK版本决定是否创建Bean,适配不同Java版本的API。
        b.SDK版本示例
            ---
            import io.micronaut.context.annotation.Requires;
            import io.micronaut.core.version.SemanticVersion;

            // 示例1:要求最低JDK版本
            @Singleton
            @Requires(sdk = Requires.Sdk.JAVA, value = "17")
            public class ModernJavaService {
                public ModernJavaService() {
                    System.out.println("使用Java 17+特性");
                }

                public String processWithRecords(String input) {
                    // 使用Java 17 Records
                    record Result(String value, long timestamp) {}

                    Result result = new Result(input, System.currentTimeMillis());
                    return result.value();
                }

                public String usePatternMatching(Object obj) {
                    // 使用Java 17 Pattern Matching
                    if (obj instanceof String s && s.length() > 0) {
                        return s.toUpperCase();
                    }
                    return "";
                }
            }

            // 示例2:特定版本范围
            @Singleton
            @Requires(sdk = Requires.Sdk.JAVA, value = "11", configuration = "11-16")
            public class Java11To16Service {
                // 仅在JDK 11-16版本创建
            }

            // 示例3:JDK 8兼容实现
            @Singleton
            @Requires(sdk = Requires.Sdk.JAVA, value = "1.8")
            public class LegacyJavaService {
                public LegacyJavaService() {
                    System.out.println("使用Java 8兼容实现");
                }

                public String process(String input) {
                    // 避免使用新版本特性
                    return input.toUpperCase();
                }
            }

            // 示例4:GraalVM条件
            @Singleton
            @Requires(condition = GraalVMCondition.class)
            public class NativeImageOptimizedService {
                // 仅在GraalVM Native Image中创建
            }

            import io.micronaut.context.condition.Condition;
            import io.micronaut.context.condition.ConditionContext;

            public class GraalVMCondition implements Condition {
                @Override
                public boolean matches(ConditionContext context) {
                    // 检测是否运行在GraalVM Native Image
                    String vmName = System.getProperty("java.vm.name");
                    return vmName != null && vmName.contains("Substrate VM");
                }
            }
            ---
    b.运行时条件
        a.@Requires(condition)
            通过自定义Condition实现复杂的运行时判断逻辑。
        b.自定义条件示例
            ---
            import io.micronaut.context.condition.Condition;
            import io.micronaut.context.condition.ConditionContext;

            // 条件1:工作日条件
            public class WorkdayCondition implements Condition {
                @Override
                public boolean matches(ConditionContext context) {
                    LocalDate today = LocalDate.now();
                    DayOfWeek day = today.getDayOfWeek();
                    boolean isWorkday = day != DayOfWeek.SATURDAY &&
                                       day != DayOfWeek.SUNDAY;
                    System.out.println("今天是" + (isWorkday ? "工作日" : "周末"));
                    return isWorkday;
                }
            }

            @Singleton
            @Requires(condition = WorkdayCondition.class)
            public class BusinessHoursService {
                // 仅在工作日创建
                public BusinessHoursService() {
                    System.out.println("工作日服务已启动");
                }
            }

            // 条件2:文件存在条件
            public class LicenseFileCondition implements Condition {
                @Override
                public boolean matches(ConditionContext context) {
                    Path licensePath = Paths.get("/etc/app/license.key");
                    boolean exists = Files.exists(licensePath);
                    System.out.println("许可证文件" +
                                     (exists ? "存在" : "不存在"));
                    return exists;
                }
            }

            @Singleton
            @Requires(condition = LicenseFileCondition.class)
            public class EnterpriseFeatures {
                // 仅当许可证文件存在时启用企业功能
                public EnterpriseFeatures() {
                    System.out.println("企业版功能已启用");
                }

                public void advancedAnalytics() {
                    // 高级分析功能
                }
            }

            // 条件3:网络连接条件
            public class InternetConnectivityCondition implements Condition {
                @Override
                public boolean matches(ConditionContext context) {
                    try {
                        URL url = new URL("https://www.google.com");
                        HttpURLConnection conn =
                            (HttpURLConnection) url.openConnection();
                        conn.setRequestMethod("HEAD");
                        conn.setConnectTimeout(2000);
                        int responseCode = conn.getResponseCode();
                        return responseCode == 200;
                    } catch (IOException e) {
                        return false;
                    }
                }
            }

            @Singleton
            @Requires(condition = InternetConnectivityCondition.class)
            public class OnlineUpdateService {
                // 有网络连接时启用在线更新
            }

            @Singleton
            @Requires(condition = OfflineCondition.class)
            public class OfflineFallbackService {
                // 无网络连接时使用离线模式
            }
            ---

05.操作系统条件
    a.@Requires(os)
        a.平台特定Bean
            根据运行的操作系统决定是否创建Bean,实现跨平台适配。
        b.OS条件示例
            ---
            import io.micronaut.context.annotation.Requires;
            import io.micronaut.core.util.OperatingSystem;

            // 示例1:Linux特定实现
            @Singleton
            @Requires(os = Requires.Family.LINUX)
            public class LinuxSystemService implements SystemService {
                public LinuxSystemService() {
                    System.out.println("Linux系统服务已启动");
                }

                @Override
                public String getSystemInfo() {
                    // 使用Linux特定命令
                    return executeCommand("uname -a");
                }

                @Override
                public void optimizePerformance() {
                    // Linux性能优化
                    executeCommand("sysctl -w net.core.somaxconn=1024");
                }

                private String executeCommand(String command) {
                    // 执行shell命令
                    return "";
                }
            }

            // 示例2:Windows特定实现
            @Singleton
            @Requires(os = Requires.Family.WINDOWS)
            public class WindowsSystemService implements SystemService {
                public WindowsSystemService() {
                    System.out.println("Windows系统服务已启动");
                }

                @Override
                public String getSystemInfo() {
                    // 使用Windows特定命令
                    return executeCommand("systeminfo");
                }

                @Override
                public void optimizePerformance() {
                    // Windows性能优化
                    executeCommand("netsh int tcp set global autotuninglevel=normal");
                }

                private String executeCommand(String command) {
                    // 执行cmd命令
                    return "";
                }
            }

            // 示例3:macOS特定实现
            @Singleton
            @Requires(os = Requires.Family.MAC_OS)
            public class MacSystemService implements SystemService {
                public MacSystemService() {
                    System.out.println("macOS系统服务已启动");
                }

                @Override
                public String getSystemInfo() {
                    return executeCommand("sw_vers");
                }

                @Override
                public void optimizePerformance() {
                    // macOS性能优化
                }

                private String executeCommand(String command) {
                    return "";
                }
            }

            // 示例4:多平台支持
            @Singleton
            @Requires(os = {Requires.Family.LINUX, Requires.Family.MAC_OS})
            public class UnixFileWatcher {
                // Linux和macOS都支持inotify/fsevents
                public UnixFileWatcher() {
                    System.out.println("Unix文件监控已启用");
                }
            }

            // 跨平台最佳实践
            // 1. 定义统一接口
            public interface SystemService {
                String getSystemInfo();
                void optimizePerformance();
            }

            // 2. 为每个平台提供实现,使用@Requires(os)
            // 3. 业务代码依赖接口,运行时自动注入对应平台实现
            @Controller("/system")
            public class SystemController {
                private final SystemService systemService;

                public SystemController(SystemService systemService) {
                    // 根据运行平台自动注入对应实现
                    this.systemService = systemService;
                }

                @Get("/info")
                public String getInfo() {
                    return systemService.getSystemInfo();
                }
            }
            ---
    b.云平台条件
        a.@Requires(cloudPlatform)
            根据云平台环境(AWS、GCP、Azure等)决定是否创建Bean。
        b.云平台示例
            ---
            import io.micronaut.context.annotation.Requires;
            import io.micronaut.core.util.CloudPlatform;

            // AWS特定服务
            @Singleton
            @Requires(cloudPlatform = CloudPlatform.AMAZON_EC2)
            public class AwsS3StorageService implements StorageService {
                public AwsS3StorageService() {
                    System.out.println("AWS S3存储服务已启用");
                }

                @Override
                public void upload(String key, byte[] data) {
                    // 使用AWS SDK上传到S3
                    AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
                    s3Client.putObject("my-bucket", key, new ByteArrayInputStream(data));
                }
            }

            // GCP特定服务
            @Singleton
            @Requires(cloudPlatform = CloudPlatform.GOOGLE_COMPUTE)
            public class GcsStorageService implements StorageService {
                public GcsStorageService() {
                    System.out.println("Google Cloud Storage服务已启用");
                }

                @Override
                public void upload(String key, byte[] data) {
                    // 使用GCP SDK上传到GCS
                    Storage storage = StorageOptions.getDefaultInstance().getService();
                    storage.create(BlobInfo.newBuilder("my-bucket", key).build(), data);
                }
            }

            // Azure特定服务
            @Singleton
            @Requires(cloudPlatform = CloudPlatform.AZURE)
            public class AzureBlobStorageService implements StorageService {
                public AzureBlobStorageService() {
                    System.out.println("Azure Blob Storage服务已启用");
                }

                @Override
                public void upload(String key, byte[] data) {
                    // 使用Azure SDK上传到Blob Storage
                }
            }

            // 本地开发环境(无云平台)
            @Singleton
            @Requires(missingProperty = "KUBERNETES_SERVICE_HOST")
            @Requires(notEnv = Environment.CLOUD)
            public class LocalFileStorageService implements StorageService {
                public LocalFileStorageService() {
                    System.out.println("本地文件存储服务已启用");
                }

                @Override
                public void upload(String key, byte[] data) throws IOException {
                    Path path = Paths.get("/tmp/storage", key);
                    Files.createDirectories(path.getParent());
                    Files.write(path, data);
                }
            }

            // 云平台检测原理
            // AWS: 检测EC2元数据服务 http://169.254.169.254
            // GCP: 检测元数据服务器 metadata.google.internal
            // Azure: 检测环境变量 WEBSITE_INSTANCE_ID
            // Kubernetes: 检测环境变量 KUBERNETES_SERVICE_HOST
            ---

06.组合条件
    a.复杂条件组合
        a.AND条件
            多个@Requires注解默认是AND关系,所有条件都满足才创建Bean。
        b.AND条件示例
            ---
            // 示例:企业版功能
            @Singleton
            @Requires(property = "app.edition", value = "enterprise")
            @Requires(property = "license.valid", value = "true")
            @Requires(beans = DatabaseConnectionPool.class)
            @Requires(env = Environment.PRODUCTION)
            public class EnterpriseAnalytics {
                // 必须同时满足:
                // 1. 版本为企业版
                // 2. 许可证有效
                // 3. 数据库连接池存在
                // 4. 生产环境
                public EnterpriseAnalytics() {
                    System.out.println("企业分析功能已启用");
                }

                public Report generateAdvancedReport() {
                    // 高级报表功能
                    return new Report();
                }
            }

            // 示例:安全审计
            @Singleton
            @Requires(property = "security.audit.enabled", value = "true")
            @Requires(beans = {AuditLogger.class, SecurityEventPublisher.class})
            @Requires(classes = "org.springframework.security.core.Authentication")
            public class SecurityAuditService {
                private final AuditLogger auditLogger;
                private final SecurityEventPublisher eventPublisher;

                public SecurityAuditService(AuditLogger auditLogger,
                                          SecurityEventPublisher eventPublisher) {
                    this.auditLogger = auditLogger;
                    this.eventPublisher = eventPublisher;
                    System.out.println("安全审计服务已启用");
                }

                public void auditLogin(String username) {
                    auditLogger.log("用户登录: " + username);
                    eventPublisher.publishLoginEvent(username);
                }
            }
            ---
    b.条件优先级
        a.条件求值顺序
            Micronaut按照特定顺序求值条件,优先检查快速失败的条件以提高性能。
        b.优先级示例
            ---
            // 条件求值顺序
            // 1. 环境条件(env, notEnv)
            // 2. 配置属性条件(property, missingProperty)
            // 3. Bean条件(beans, missingBeans)
            // 4. 类条件(classes, missingClasses)
            // 5. SDK条件(sdk)
            // 6. 自定义条件(condition)

            @Singleton
            @Requires(env = Environment.PRODUCTION)          // 1. 首先检查环境
            @Requires(property = "feature.enabled")          // 2. 然后检查配置
            @Requires(beans = DataSource.class)              // 3. 检查Bean存在
            @Requires(classes = "com.example.AdvancedLib")   // 4. 检查类存在
            @Requires(sdk = Requires.Sdk.JAVA, value = "17") // 5. 检查JDK版本
            @Requires(condition = CustomCondition.class)     // 6. 最后执行自定义条件
            public class ComplexFeature {
                // 按顺序求值,任一条件不满足即停止检查
            }

            // 性能优化建议
            @Singleton
            @Requires(property = "expensive.feature.enabled", value = "true")  // 快速检查
            @Requires(condition = ExpensiveCondition.class)  // 耗时检查放后面
            public class ExpensiveFeature {
                // 如果配置未启用,不会执行ExpensiveCondition
            }

            public class ExpensiveCondition implements Condition {
                @Override
                public boolean matches(ConditionContext context) {
                    // 耗时的条件检查(网络请求、文件扫描等)
                    return checkLicenseServer();
                }

                private boolean checkLicenseServer() {
                    // 网络请求验证许可证
                    return true;
                }
            }
            ---

07.条件化配置
    a.@RequiresConfiguration
        a.配置类条件
            为整个@ConfigurationProperties类添加条件,仅在满足条件时加载配置。
        b.配置条件示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import io.micronaut.context.annotation.Requires;

            // 示例1:Redis配置(仅在启用时加载)
            @ConfigurationProperties("redis")
            @Requires(property = "redis.enabled", value = "true")
            public class RedisConfiguration {
                private String host;
                private int port;
                private String password;
                private int database;

                public RedisConfiguration() {
                    System.out.println("加载Redis配置");
                }

                // Getter和Setter
                public String getHost() { return host; }
                public void setHost(String host) { this.host = host; }
                public int getPort() { return port; }
                public void setPort(int port) { this.port = port; }
                public String getPassword() { return password; }
                public void setPassword(String password) { this.password = password; }
                public int getDatabase() { return database; }
                public void setDatabase(int database) { this.database = database; }
            }

            // 示例2:Kafka配置(仅在类存在时加载)
            @ConfigurationProperties("kafka")
            @Requires(classes = "org.apache.kafka.clients.producer.KafkaProducer")
            public class KafkaConfiguration {
                private String bootstrapServers;
                private String groupId;
                private Map<String, Object> producerConfig;
                private Map<String, Object> consumerConfig;

                public KafkaConfiguration() {
                    System.out.println("加载Kafka配置");
                }

                // Getter和Setter省略
            }

            // 示例3:多条件配置
            @ConfigurationProperties("monitoring.prometheus")
            @Requires(property = "monitoring.enabled", value = "true")
            @Requires(property = "monitoring.type", value = "prometheus")
            @Requires(classes = "io.micrometer.prometheus.PrometheusMeterRegistry")
            public class PrometheusConfiguration {
                private int port;
                private String path;
                private boolean enabled;

                public PrometheusConfiguration() {
                    System.out.println("加载Prometheus监控配置");
                }

                // Getter和Setter省略
            }

            // application.yml
            // redis:
            //   enabled: true
            //   host: localhost
            //   port: 6379
            //
            // monitoring:
            //   enabled: true
            //   type: prometheus
            //   prometheus:
            //     port: 9090
            //     path: /metrics

            // 结果:
            // - RedisConfiguration加载(redis.enabled=true)
            // - KafkaConfiguration不加载(类不存在)
            // - PrometheusConfiguration加载(所有条件满足)
            ---
    b.条件化Bean工厂
        a.@Factory方法条件
            @Factory中的@Bean方法也可以使用@Requires,实现条件化Bean创建。
        b.工厂条件示例
            ---
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;
            import io.micronaut.context.annotation.Requires;

            @Factory
            public class DataSourceFactory {
                // 开发环境:H2内存数据库
                @Bean
                @Singleton
                @Requires(env = Environment.DEVELOPMENT)
                public DataSource h2DataSource() {
                    System.out.println("创建H2内存数据库");
                    return new EmbeddedDatabaseBuilder()
                        .setType(EmbeddedDatabaseType.H2)
                        .build();
                }

                // 测试环境:PostgreSQL测试库
                @Bean
                @Singleton
                @Requires(env = Environment.TEST)
                @Requires(property = "test.db.url")
                public DataSource testDataSource(@Value("${test.db.url}") String url) {
                    System.out.println("连接测试数据库: " + url);
                    HikariConfig config = new HikariConfig();
                    config.setJdbcUrl(url);
                    return new HikariDataSource(config);
                }

                // 生产环境:MySQL主从集群
                @Bean
                @Singleton
                @Requires(env = Environment.PRODUCTION)
                @Requires(property = "datasource.master.url")
                @Requires(property = "datasource.slave.url")
                public DataSource productionDataSource(
                    @Value("${datasource.master.url}") String masterUrl,
                    @Value("${datasource.slave.url}") String slaveUrl) {

                    System.out.println("创建主从数据源");
                    return createMasterSlaveDataSource(masterUrl, slaveUrl);
                }

                private DataSource createMasterSlaveDataSource(
                    String masterUrl, String slaveUrl) {
                    // 创建读写分离数据源
                    return null;
                }
            }

            // 不同环境启动结果
            // 开发环境: 创建H2内存数据库
            // 测试环境: 连接测试数据库: jdbc:postgresql://test-db:5432/testdb
            // 生产环境: 创建主从数据源
            ---

3.6 Bean工厂与Provider

01.@Factory工厂类
    a.工厂模式
        a.Bean工厂定义
            @Factory类用于创建和配置Bean,通过@Bean方法返回Bean实例,适合需要复杂初始化逻辑或第三方类的Bean创建。
        b.基础工厂示例
            ---
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;
            import jakarta.inject.Singleton;
            import com.zaxxer.hikari.HikariConfig;
            import com.zaxxer.hikari.HikariDataSource;

            @Factory
            public class DataSourceFactory {
                // 创建数据源Bean
                @Bean
                @Singleton
                public DataSource dataSource(
                    @Value("${datasource.url}") String url,
                    @Value("${datasource.username}") String username,
                    @Value("${datasource.password}") String password) {

                    System.out.println("创建数据源: " + url);

                    HikariConfig config = new HikariConfig();
                    config.setJdbcUrl(url);
                    config.setUsername(username);
                    config.setPassword(password);
                    config.setMaximumPoolSize(10);
                    config.setMinimumIdle(2);
                    config.setConnectionTimeout(30000);

                    return new HikariDataSource(config);
                }

                // 创建多个相关Bean
                @Bean
                @Singleton
                public JdbcTemplate jdbcTemplate(DataSource dataSource) {
                    System.out.println("创建JdbcTemplate");
                    return new JdbcTemplate(dataSource);
                }

                @Bean
                @Singleton
                public TransactionManager transactionManager(DataSource dataSource) {
                    System.out.println("创建事务管理器");
                    return new DataSourceTransactionManager(dataSource);
                }
            }

            // 使用工厂创建的Bean
            @Singleton
            public class UserRepository {
                private final JdbcTemplate jdbcTemplate;

                public UserRepository(JdbcTemplate jdbcTemplate) {
                    this.jdbcTemplate = jdbcTemplate;
                }

                public User findById(Long id) {
                    return jdbcTemplate.queryForObject(
                        "SELECT * FROM users WHERE id = ?",
                        new Object[]{id},
                        new UserRowMapper()
                    );
                }
            }

            // Bean创建流程
            // 1. BeanContext扫描到DataSourceFactory
            // 2. 调用dataSource()方法创建DataSource
            // 3. 调用jdbcTemplate()方法,注入DataSource
            // 4. 调用transactionManager()方法,注入DataSource
            // 5. UserRepository注入JdbcTemplate
            ---
    b.工厂方法依赖注入
        a.方法参数注入
            @Factory中的@Bean方法可以声明参数,Micronaut会自动注入所需依赖。
        b.依赖注入示例
            ---
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;

            @Factory
            public class MessagingFactory {
                // 无参数工厂方法
                @Bean
                @Singleton
                public MessageQueue messageQueue() {
                    System.out.println("创建消息队列");
                    return new InMemoryMessageQueue();
                }

                // 单个依赖
                @Bean
                @Singleton
                public MessageProducer messageProducer(MessageQueue queue) {
                    System.out.println("创建消息生产者");
                    return new DefaultMessageProducer(queue);
                }

                // 多个依赖
                @Bean
                @Singleton
                public MessageConsumer messageConsumer(
                    MessageQueue queue,
                    MessageHandler handler,
                    @Value("${consumer.threads:4}") int threads) {

                    System.out.println("创建消息消费者,线程数: " + threads);
                    return new DefaultMessageConsumer(queue, handler, threads);
                }

                // 可选依赖
                @Bean
                @Singleton
                public MessageRouter messageRouter(
                    MessageQueue queue,
                    @Nullable RetryPolicy retryPolicy,
                    @Nullable DeadLetterQueue deadLetterQueue) {

                    System.out.println("创建消息路由");

                    MessageRouter router = new MessageRouter(queue);

                    if (retryPolicy != null) {
                        router.setRetryPolicy(retryPolicy);
                        System.out.println("  - 重试策略已配置");
                    }

                    if (deadLetterQueue != null) {
                        router.setDeadLetterQueue(deadLetterQueue);
                        System.out.println("  - 死信队列已配置");
                    }

                    return router;
                }
            }

            // Bean创建顺序
            // 1. messageQueue()           → MessageQueue
            // 2. messageProducer(queue)   → MessageProducer(依赖MessageQueue)
            // 3. messageConsumer(...)     → MessageConsumer(依赖多个Bean)
            // 4. messageRouter(...)       → MessageRouter(包含可选依赖)
            ---

02.@Bean方法特性
    a.返回类型与泛型
        a.泛型Bean创建
            @Bean方法可以返回泛型类型,Micronaut会保留完整的泛型信息用于依赖注入。
        b.泛型Bean示例
            ---
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Bean;

            @Factory
            public class ConverterFactory {
                // 创建String到Integer的转换器
                @Bean
                @Singleton
                @Named("stringToInteger")
                public Converter<String, Integer> stringToIntegerConverter() {
                    return new Converter<String, Integer>() {
                        @Override
                        public Integer convert(String source) {
                            return Integer.parseInt(source);
                        }
                    };
                }

                // 创建String到Date的转换器
                @Bean
                @Singleton
                @Named("stringToDate")
                public Converter<String, Date> stringToDateConverter() {
                    return new Converter<String, Date>() {
                        @Override
                        public Date convert(String source) {
                            return new SimpleDateFormat("yyyy-MM-dd").parse(source);
                        }
                    };
                }

                // 创建泛型集合Bean
                @Bean
                @Singleton
                @Named("userValidators")
                public List<Validator<User>> userValidators() {
                    return Arrays.asList(
                        new EmailValidator(),
                        new PasswordValidator(),
                        new AgeValidator()
                    );
                }

                // 创建泛型Map Bean
                @Bean
                @Singleton
                public Map<String, CommandHandler> commandHandlers(
                    List<CommandHandler> handlers) {

                    Map<String, CommandHandler> map = new HashMap<>();
                    for (CommandHandler handler : handlers) {
                        map.put(handler.getCommandName(), handler);
                    }
                    return map;
                }
            }

            // 注入泛型Bean
            @Singleton
            public class DataProcessor {
                private final Converter<String, Integer> intConverter;
                private final Converter<String, Date> dateConverter;
                private final List<Validator<User>> validators;

                public DataProcessor(
                    @Named("stringToInteger") Converter<String, Integer> intConverter,
                    @Named("stringToDate") Converter<String, Date> dateConverter,
                    @Named("userValidators") List<Validator<User>> validators) {

                    this.intConverter = intConverter;
                    this.dateConverter = dateConverter;
                    this.validators = validators;
                }

                public void process(String input) {
                    Integer number = intConverter.convert(input);
                    System.out.println("转换的数字: " + number);
                }

                public void validateUser(User user) {
                    for (Validator<User> validator : validators) {
                        validator.validate(user);
                    }
                }
            }
            ---
    b.Bean方法作用域
        a.方法级作用域
            @Bean方法可以指定不同的作用域,独立于工厂类的作用域。
        b.作用域组合示例
            ---
            @Factory
            public class MixedScopeFactory {
                // Singleton Bean
                @Bean
                @Singleton
                public CacheService cacheService() {
                    System.out.println("创建单例缓存服务");
                    return new RedisCacheService();
                }

                // Prototype Bean
                @Bean
                @Prototype
                public TaskExecutor taskExecutor() {
                    System.out.println("创建任务执行器实例");
                    return new TaskExecutor(UUID.randomUUID().toString());
                }

                // RequestScope Bean
                @Bean
                @RequestScope
                public RequestLogger requestLogger() {
                    System.out.println("创建请求日志记录器");
                    return new RequestLogger();
                }

                // Refreshable Bean
                @Bean
                @Refreshable
                public FeatureToggle featureToggle(
                    @Value("${features.new-ui:false}") boolean newUI,
                    @Value("${features.beta:false}") boolean beta) {

                    System.out.println("创建特性开关");
                    return new FeatureToggle(newUI, beta);
                }
            }

            // 使用不同作用域的Bean
            @Singleton
            public class ApplicationService {
                private final CacheService cacheService;              // Singleton
                private final Provider<TaskExecutor> executorProvider; // Prototype
                private final Provider<RequestLogger> loggerProvider;  // RequestScope

                public ApplicationService(
                    CacheService cacheService,
                    Provider<TaskExecutor> executorProvider,
                    Provider<RequestLogger> loggerProvider) {

                    this.cacheService = cacheService;
                    this.executorProvider = executorProvider;
                    this.loggerProvider = loggerProvider;
                }

                public void executeTask(String taskData) {
                    // 获取新的Prototype实例
                    TaskExecutor executor = executorProvider.get();
                    executor.execute(taskData);

                    // 获取当前请求的Logger
                    RequestLogger logger = loggerProvider.get();
                    logger.log("Task executed");
                }
            }
            ---

03.Provider模式
    a.jakarta.inject.Provider
        a.延迟获取Bean
            Provider<T>接口提供延迟获取Bean的能力,调用get()方法时才实例化Bean,适合循环依赖和作用域不匹配场景。
        b.Provider基础示例
            ---
            import jakarta.inject.Provider;
            import jakarta.inject.Singleton;

            @Singleton
            public class ReportService {
                private final Provider<ReportGenerator> generatorProvider;

                public ReportService(Provider<ReportGenerator> generatorProvider) {
                    // 构造器执行时不创建ReportGenerator
                    this.generatorProvider = generatorProvider;
                    System.out.println("ReportService创建(ReportGenerator未创建)");
                }

                public Report generateReport(ReportRequest request) {
                    // 调用时才获取ReportGenerator实例
                    ReportGenerator generator = generatorProvider.get();
                    System.out.println("获取ReportGenerator: " +
                                     System.identityHashCode(generator));

                    return generator.generate(request);
                }
            }

            @Prototype
            public class ReportGenerator {
                private final String generatorId = UUID.randomUUID().toString();

                public ReportGenerator() {
                    System.out.println("创建ReportGenerator: " + generatorId);
                }

                public Report generate(ReportRequest request) {
                    System.out.println("生成报告: " + generatorId);
                    return new Report();
                }
            }

            // 使用流程
            // 1. 应用启动:创建ReportService(ReportGenerator未创建)
            // 2. 调用generateReport()
            //    → 调用generatorProvider.get()
            //    → 创建新的ReportGenerator实例
            //    → 生成报告
            // 3. 再次调用generateReport()
            //    → 再次调用generatorProvider.get()
            //    → 创建新的ReportGenerator实例(Prototype作用域)
            ---
    b.Provider解决循环依赖
        a.循环依赖问题
            当两个Bean相互依赖时会形成循环,使用Provider可以打破循环,延迟一方的依赖获取。
        b.循环依赖解决示例
            ---
            // ❌ 错误:循环依赖
            @Singleton
            public class ServiceA {
                private final ServiceB serviceB;

                public ServiceA(ServiceB serviceB) {
                    this.serviceB = serviceB;
                }
            }

            @Singleton
            public class ServiceB {
                private final ServiceA serviceA;

                public ServiceB(ServiceA serviceA) {
                    this.serviceA = serviceA;
                }
            }
            // 错误:BeanInstantiationException: Circular dependency

            // ✅ 解决方案1:使用Provider
            @Singleton
            public class FixedServiceA {
                private final Provider<ServiceB> serviceBProvider;

                public FixedServiceA(Provider<ServiceB> serviceBProvider) {
                    this.serviceBProvider = serviceBProvider;
                    System.out.println("ServiceA创建");
                }

                public void doSomething() {
                    // 使用时才获取ServiceB
                    ServiceB serviceB = serviceBProvider.get();
                    serviceB.process();
                }
            }

            @Singleton
            public class FixedServiceB {
                private final FixedServiceA serviceA;

                public FixedServiceB(FixedServiceA serviceA) {
                    this.serviceA = serviceA;
                    System.out.println("ServiceB创建");
                }

                public void process() {
                    System.out.println("ServiceB处理");
                }
            }

            // 创建顺序
            // 1. 创建ServiceA(注入Provider<ServiceB>,ServiceB未创建)
            // 2. 创建ServiceB(注入ServiceA)
            // 3. 循环打破

            // ✅ 解决方案2:重新设计(推荐)
            // 循环依赖通常表明设计问题,应考虑重构
            @Singleton
            public class ServiceA {
                private final SharedComponent sharedComponent;

                public ServiceA(SharedComponent sharedComponent) {
                    this.sharedComponent = sharedComponent;
                }
            }

            @Singleton
            public class ServiceB {
                private final SharedComponent sharedComponent;

                public ServiceB(SharedComponent sharedComponent) {
                    this.sharedComponent = sharedComponent;
                }
            }

            @Singleton
            public class SharedComponent {
                // 提取公共逻辑,消除循环依赖
            }
            ---

04.高级Provider用法
    a.条件化获取
        a.动态Bean选择
            通过Provider配合运行时条件动态选择Bean实例。
        b.动态选择示例
            ---
            import jakarta.inject.Provider;
            import jakarta.inject.Named;

            @Singleton
            public class StorageService {
                private final Provider<CloudStorage> s3Provider;
                private final Provider<CloudStorage> ossProvider;
                private final Provider<CloudStorage> localProvider;

                public StorageService(
                    @Named("s3") Provider<CloudStorage> s3Provider,
                    @Named("oss") Provider<CloudStorage> ossProvider,
                    @Named("local") Provider<CloudStorage> localProvider) {

                    this.s3Provider = s3Provider;
                    this.ossProvider = ossProvider;
                    this.localProvider = localProvider;
                }

                public void upload(String key, byte[] data, String region) {
                    // 根据区域动态选择存储
                    CloudStorage storage = selectStorage(region);
                    storage.upload(key, data);
                }

                private CloudStorage selectStorage(String region) {
                    switch (region) {
                        case "us":
                        case "eu":
                            return s3Provider.get();  // 使用AWS S3
                        case "cn":
                            return ossProvider.get(); // 使用阿里云OSS
                        default:
                            return localProvider.get(); // 使用本地存储
                    }
                }
            }

            // 定义各个存储实现
            @Singleton
            @Named("s3")
            public class S3Storage implements CloudStorage {
                @Override
                public void upload(String key, byte[] data) {
                    System.out.println("上传到S3: " + key);
                }
            }

            @Singleton
            @Named("oss")
            public class OssStorage implements CloudStorage {
                @Override
                public void upload(String key, byte[] data) {
                    System.out.println("上传到OSS: " + key);
                }
            }

            @Singleton
            @Named("local")
            public class LocalStorage implements CloudStorage {
                @Override
                public void upload(String key, byte[] data) throws IOException {
                    System.out.println("保存到本地: " + key);
                    Files.write(Paths.get("/tmp", key), data);
                }
            }
            ---
    b.懒加载优化
        a.按需创建
            使用Provider延迟创建重量级Bean,减少应用启动时间和内存占用。
        b.懒加载示例
            ---
            @Singleton
            public class ApplicationInitializer {
                private final Provider<HeavyAnalyticsEngine> analyticsProvider;
                private final Provider<MachineLearningModel> mlModelProvider;
                private final Provider<BigDataProcessor> bigDataProvider;

                public ApplicationInitializer(
                    Provider<HeavyAnalyticsEngine> analyticsProvider,
                    Provider<MachineLearningModel> mlModelProvider,
                    Provider<BigDataProcessor> bigDataProvider) {

                    this.analyticsProvider = analyticsProvider;
                    this.mlModelProvider = mlModelProvider;
                    this.bigDataProvider = bigDataProvider;

                    System.out.println("ApplicationInitializer创建完成");
                    System.out.println("重量级组件未初始化,应用快速启动");
                }

                public void runAnalytics(AnalyticsRequest request) {
                    // 首次调用时才创建HeavyAnalyticsEngine
                    HeavyAnalyticsEngine engine = analyticsProvider.get();
                    engine.analyze(request);
                }

                public void runPrediction(PredictionRequest request) {
                    // 首次调用时才加载机器学习模型
                    MachineLearningModel model = mlModelProvider.get();
                    model.predict(request);
                }
            }

            @Singleton
            public class HeavyAnalyticsEngine {
                public HeavyAnalyticsEngine() {
                    System.out.println("初始化分析引擎(耗时3秒)");
                    // 模拟耗时初始化
                    try {
                        Thread.sleep(3000);
                    } catch (InterruptedException e) {}
                }

                public AnalyticsResult analyze(AnalyticsRequest request) {
                    return new AnalyticsResult();
                }
            }

            @Singleton
            public class MachineLearningModel {
                public MachineLearningModel() {
                    System.out.println("加载机器学习模型(耗时5秒)");
                    // 加载大型模型文件
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {}
                }

                public PredictionResult predict(PredictionRequest request) {
                    return new PredictionResult();
                }
            }

            // 启动时间对比
            // 不使用Provider: 应用启动耗时8秒(3+5)
            // 使用Provider: 应用启动耗时<1秒,按需加载组件
            ---

05.@EachBean动态Bean
    a.基于配置创建多个Bean
        a.@EachBean注解
            @EachBean根据配置中的每个条目创建对应的Bean实例,适合多数据源、多租户等场景。
        b.EachBean示例
            ---
            import io.micronaut.context.annotation.EachBean;
            import io.micronaut.context.annotation.ConfigurationProperties;

            // 1. 定义数据源配置类
            @ConfigurationProperties("datasources")
            public class DataSourceConfiguration {
                private Map<String, DataSourceSettings> datasources;

                public Map<String, DataSourceSettings> getDatasources() {
                    return datasources;
                }

                public void setDatasources(Map<String, DataSourceSettings> datasources) {
                    this.datasources = datasources;
                }

                public static class DataSourceSettings {
                    private String url;
                    private String username;
                    private String password;
                    private int maxPoolSize;

                    // Getter和Setter省略
                }
            }

            // 2. 为每个数据源创建Bean
            @EachBean(DataSourceConfiguration.DataSourceSettings.class)
            public class DynamicDataSource {
                private final String name;
                private final HikariDataSource dataSource;

                public DynamicDataSource(
                    BeanIdentifier identifier,
                    DataSourceConfiguration.DataSourceSettings settings) {

                    this.name = identifier.getName();
                    System.out.println("创建数据源: " + name);

                    HikariConfig config = new HikariConfig();
                    config.setJdbcUrl(settings.getUrl());
                    config.setUsername(settings.getUsername());
                    config.setPassword(settings.getPassword());
                    config.setMaximumPoolSize(settings.getMaxPoolSize());

                    this.dataSource = new HikariDataSource(config);
                }

                public Connection getConnection() throws SQLException {
                    return dataSource.getConnection();
                }

                public String getName() {
                    return name;
                }

                @PreDestroy
                public void close() {
                    System.out.println("关闭数据源: " + name);
                    dataSource.close();
                }
            }

            // application.yml配置
            // datasources:
            //   primary:
            //     url: jdbc:mysql://localhost:3306/main
            //     username: root
            //     password: secret
            //     max-pool-size: 10
            //   secondary:
            //     url: jdbc:mysql://localhost:3306/backup
            //     username: root
            //     password: secret
            //     max-pool-size: 5
            //   analytics:
            //     url: jdbc:postgresql://localhost:5432/analytics
            //     username: analyst
            //     password: secret
            //     max-pool-size: 20

            // 创建结果
            // 创建数据源: primary
            // 创建数据源: secondary
            // 创建数据源: analytics

            // 使用动态创建的数据源
            @Singleton
            public class MultiDataSourceManager {
                private final Map<String, DynamicDataSource> dataSources;

                public MultiDataSourceManager(List<DynamicDataSource> dataSourceList) {
                    this.dataSources = new HashMap<>();
                    for (DynamicDataSource ds : dataSourceList) {
                        dataSources.put(ds.getName(), ds);
                    }
                    System.out.println("管理 " + dataSources.size() + " 个数据源");
                }

                public Connection getConnection(String name) throws SQLException {
                    DynamicDataSource ds = dataSources.get(name);
                    if (ds == null) {
                        throw new IllegalArgumentException("数据源不存在: " + name);
                    }
                    return ds.getConnection();
                }
            }
            ---
    b.@EachProperty详解
        a.配置项遍历
            @EachProperty遍历配置中的每个子项,为每个子项创建Bean实例。
        b.EachProperty示例
            ---
            import io.micronaut.context.annotation.EachProperty;
            import io.micronaut.context.annotation.Parameter;

            // 1. 定义租户配置Bean
            @EachProperty("tenants")
            public class TenantConfiguration {
                private final String tenantId;
                private String name;
                private String database;
                private String schema;
                private boolean enabled;

                public TenantConfiguration(@Parameter String tenantId) {
                    this.tenantId = tenantId;
                    System.out.println("加载租户配置: " + tenantId);
                }

                public String getTenantId() { return tenantId; }
                public String getName() { return name; }
                public void setName(String name) { this.name = name; }
                public String getDatabase() { return database; }
                public void setDatabase(String database) { this.database = database; }
                public String getSchema() { return schema; }
                public void setSchema(String schema) { this.schema = schema; }
                public boolean isEnabled() { return enabled; }
                public void setEnabled(boolean enabled) { this.enabled = enabled; }
            }

            // 2. 为每个租户创建数据源
            @EachBean(TenantConfiguration.class)
            public class TenantDataSource {
                private final TenantConfiguration config;
                private final HikariDataSource dataSource;

                public TenantDataSource(TenantConfiguration config) {
                    this.config = config;

                    if (!config.isEnabled()) {
                        System.out.println("租户未启用: " + config.getTenantId());
                        this.dataSource = null;
                        return;
                    }

                    System.out.println("创建租户数据源: " + config.getTenantId());

                    HikariConfig hikariConfig = new HikariConfig();
                    hikariConfig.setJdbcUrl(config.getDatabase());
                    hikariConfig.setSchema(config.getSchema());
                    this.dataSource = new HikariDataSource(hikariConfig);
                }

                public Connection getConnection() throws SQLException {
                    if (dataSource == null) {
                        throw new IllegalStateException("租户未启用");
                    }
                    return dataSource.getConnection();
                }

                public String getTenantId() {
                    return config.getTenantId();
                }
            }

            // application.yml配置
            // tenants:
            //   tenant-001:
            //     name: "客户A"
            //     database: "jdbc:mysql://localhost:3306/tenant_001"
            //     schema: "public"
            //     enabled: true
            //   tenant-002:
            //     name: "客户B"
            //     database: "jdbc:mysql://localhost:3306/tenant_002"
            //     schema: "public"
            //     enabled: true
            //   tenant-003:
            //     name: "客户C"
            //     database: "jdbc:mysql://localhost:3306/tenant_003"
            //     schema: "public"
            //     enabled: false

            // 创建结果
            // 加载租户配置: tenant-001
            // 创建租户数据源: tenant-001
            // 加载租户配置: tenant-002
            // 创建租户数据源: tenant-002
            // 加载租户配置: tenant-003
            // 租户未启用: tenant-003

            // 3. 使用租户数据源
            @Singleton
            public class MultiTenantService {
                private final Map<String, TenantDataSource> tenantDataSources;

                public MultiTenantService(List<TenantDataSource> dataSourceList) {
                    this.tenantDataSources = new HashMap<>();
                    for (TenantDataSource ds : dataSourceList) {
                        tenantDataSources.put(ds.getTenantId(), ds);
                    }
                    System.out.println("管理 " + tenantDataSources.size() + " 个租户");
                }

                public List<User> getUsersByTenant(String tenantId) throws SQLException {
                    TenantDataSource ds = tenantDataSources.get(tenantId);
                    if (ds == null) {
                        throw new IllegalArgumentException("租户不存在: " + tenantId);
                    }

                    try (Connection conn = ds.getConnection();
                         Statement stmt = conn.createStatement();
                         ResultSet rs = stmt.executeQuery("SELECT * FROM users")) {

                        List<User> users = new ArrayList<>();
                        while (rs.next()) {
                            users.add(mapUser(rs));
                        }
                        return users;
                    }
                }

                private User mapUser(ResultSet rs) throws SQLException {
                    return new User();
                }
            }
            ---

06.Bean替换
    a.@Replaces注解
        a.Bean覆盖
            @Replaces允许新Bean替换已存在的Bean,常用于测试、自定义实现或库的默认Bean覆盖。
        b.Bean替换示例
            ---
            import io.micronaut.context.annotation.Replaces;

            // 原始Bean
            @Singleton
            public class DefaultEmailService implements EmailService {
                public DefaultEmailService() {
                    System.out.println("创建默认邮件服务");
                }

                @Override
                public void send(String to, String subject, String body) {
                    System.out.println("发送邮件到: " + to);
                    // SMTP发送逻辑
                }
            }

            // 测试环境替换为Mock实现
            @Singleton
            @Replaces(DefaultEmailService.class)
            @Requires(env = Environment.TEST)
            public class MockEmailService implements EmailService {
                private final List<Email> sentEmails = new ArrayList<>();

                public MockEmailService() {
                    System.out.println("创建Mock邮件服务(测试环境)");
                }

                @Override
                public void send(String to, String subject, String body) {
                    System.out.println("Mock发送邮件到: " + to);
                    sentEmails.add(new Email(to, subject, body));
                }

                public List<Email> getSentEmails() {
                    return sentEmails;
                }
            }

            // 使用场景
            @Singleton
            public class UserService {
                private final EmailService emailService;

                public UserService(EmailService emailService) {
                    this.emailService = emailService;
                    // 开发/生产环境: 注入DefaultEmailService
                    // 测试环境: 注入MockEmailService
                }

                public void registerUser(User user) {
                    // 保存用户
                    saveUser(user);

                    // 发送欢迎邮件
                    emailService.send(
                        user.getEmail(),
                        "欢迎注册",
                        "欢迎加入我们的平台!"
                    );
                }

                private void saveUser(User user) {
                    // 保存逻辑
                }
            }

            // 测试代码
            @MicronautTest(environments = Environment.TEST)
            class UserServiceTest {
                @Inject
                UserService userService;

                @Inject
                MockEmailService mockEmailService;  // 可以注入Mock服务验证

                @Test
                void testRegisterUser() {
                    User user = new User();
                    user.setEmail("test@example.com");

                    userService.registerUser(user);

                    // 验证邮件已发送
                    List<Email> emails = mockEmailService.getSentEmails();
                    assertEquals(1, emails.size());
                    assertEquals("test@example.com", emails.get(0).getTo());
                }
            }
            ---
    b.@Replaces工厂方法
        a.替换工厂Bean
            可以替换@Factory中的@Bean方法创建的Bean。
        b.工厂替换示例
            ---
            // 原始工厂
            @Factory
            public class DefaultCacheFactory {
                @Bean
                @Singleton
                @Named("userCache")
                public Cache userCache() {
                    System.out.println("创建默认用户缓存(Caffeine)");
                    return Caffeine.newBuilder()
                        .maximumSize(1000)
                        .expireAfterWrite(10, TimeUnit.MINUTES)
                        .build();
                }
            }

            // 生产环境替换为Redis缓存
            @Factory
            @Requires(env = Environment.PRODUCTION)
            public class ProductionCacheFactory {
                @Bean
                @Singleton
                @Named("userCache")
                @Replaces(bean = Cache.class, named = "userCache")
                public Cache redisUserCache(RedisClient redisClient) {
                    System.out.println("创建Redis用户缓存(生产环境)");
                    return new RedisCache(redisClient, "users");
                }
            }

            // 使用Bean
            @Singleton
            public class UserService {
                private final Cache userCache;

                public UserService(@Named("userCache") Cache userCache) {
                    this.userCache = userCache;
                    // 开发环境: Caffeine缓存
                    // 生产环境: Redis缓存
                }

                public User findUser(Long userId) {
                    // 从缓存获取
                    User user = userCache.getIfPresent(userId);
                    if (user != null) {
                        return user;
                    }

                    // 从数据库查询
                    user = userRepository.findById(userId);
                    userCache.put(userId, user);
                    return user;
                }
            }
            ---

07.工厂与Provider最佳实践
    a.使用场景选择
        a.选择指南
            @Factory适合第三方类、复杂初始化、多Bean创建,Provider适合循环依赖、懒加载、作用域不匹配。
        b.场景对比
            ---
            // 场景1:第三方类 → 使用@Factory
            @Factory
            public class ThirdPartyFactory {
                @Bean
                @Singleton
                public ObjectMapper objectMapper() {
                    ObjectMapper mapper = new ObjectMapper();
                    mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
                    mapper.registerModule(new JavaTimeModule());
                    return mapper;
                }
            }

            // 场景2:循环依赖 → 使用Provider
            @Singleton
            public class ServiceWithCircular {
                private final Provider<DependentService> dependentProvider;

                public ServiceWithCircular(Provider<DependentService> dependentProvider) {
                    this.dependentProvider = dependentProvider;
                }
            }

            // 场景3:Prototype懒加载 → 使用Provider
            @Singleton
            public class TaskManager {
                private final Provider<TaskHandler> handlerProvider;

                public TaskManager(Provider<TaskHandler> handlerProvider) {
                    this.handlerProvider = handlerProvider;
                }

                public void handleTask() {
                    TaskHandler handler = handlerProvider.get();  // 每次新实例
                    handler.handle();
                }
            }

            // 场景4:条件化创建 → 使用@Requires + @Factory
            @Factory
            public class ConditionalBeanFactory {
                @Bean
                @Singleton
                @Requires(property = "cache.type", value = "redis")
                public CacheService redisCache() {
                    return new RedisCacheService();
                }

                @Bean
                @Singleton
                @Requires(property = "cache.type", value = "memcached")
                public CacheService memcachedCache() {
                    return new MemcachedCacheService();
                }
            }

            // 场景5:多实例管理 → 使用@EachBean
            @EachProperty("services")
            public class ServiceConfiguration {
                private String endpoint;
                private int timeout;
                // 配置省略
            }

            @EachBean(ServiceConfiguration.class)
            public class ExternalServiceClient {
                // 为每个配置项创建客户端
            }
            ---
    b.性能考虑
        a.工厂方法性能
            @Factory方法在Bean首次创建时执行,Singleton Bean只执行一次,性能影响可忽略。
        b.Provider性能
            ---
            // Provider性能测试
            @Singleton
            public class ProviderPerformanceTest {
                private final SingletonBean singletonBean;
                private final Provider<SingletonBean> singletonProvider;
                private final Provider<PrototypeBean> prototypeProvider;

                public ProviderPerformanceTest(
                    SingletonBean singletonBean,
                    Provider<SingletonBean> singletonProvider,
                    Provider<PrototypeBean> prototypeProvider) {

                    this.singletonBean = singletonBean;
                    this.singletonProvider = singletonProvider;
                    this.prototypeProvider = prototypeProvider;
                }

                public void testPerformance() {
                    // 测试1:直接访问Singleton
                    long start1 = System.nanoTime();
                    for (int i = 0; i < 1_000_000; i++) {
                        singletonBean.doSomething();
                    }
                    long duration1 = System.nanoTime() - start1;
                    System.out.println("直接访问: " + duration1 / 1_000_000 + "ms");

                    // 测试2:通过Provider访问Singleton
                    long start2 = System.nanoTime();
                    for (int i = 0; i < 1_000_000; i++) {
                        singletonProvider.get().doSomething();
                    }
                    long duration2 = System.nanoTime() - start2;
                    System.out.println("Provider访问Singleton: " +
                                     duration2 / 1_000_000 + "ms");

                    // 测试3:通过Provider创建Prototype
                    long start3 = System.nanoTime();
                    for (int i = 0; i < 10000; i++) {
                        PrototypeBean bean = prototypeProvider.get();
                        bean.doSomething();
                    }
                    long duration3 = System.nanoTime() - start3;
                    System.out.println("Provider创建Prototype: " +
                                     duration3 / 1_000_000 + "ms");
                }
            }

            // 测试结果
            // 直接访问: 15ms
            // Provider访问Singleton: 18ms(略慢,因为多一次方法调用)
            // Provider创建Prototype: 580ms(每次创建实例)

            // 性能建议
            // ✅ Singleton直接依赖性能最优
            // ✅ Provider<Singleton>开销很小,可以使用
            // ⚠️ Provider<Prototype>频繁调用会影响性能
            // ❌ 避免在循环中频繁调用prototypeProvider.get()
            ---

08.工厂最佳实践
    a.工厂设计原则
        a.单一职责
            每个@Factory类应该只负责创建相关的一组Bean,遵循单一职责原则。
        b.工厂组织示例
            ---
            // ✅ 推荐:按功能组织工厂
            @Factory
            public class DatabaseFactory {
                @Bean
                @Singleton
                public DataSource dataSource() { return null; }

                @Bean
                @Singleton
                public JdbcTemplate jdbcTemplate(DataSource ds) { return null; }

                @Bean
                @Singleton
                public TransactionManager transactionManager(DataSource ds) { return null; }
            }

            @Factory
            public class CacheFactory {
                @Bean
                @Singleton
                public CacheManager cacheManager() { return null; }

                @Bean
                @Singleton
                public Cache userCache() { return null; }

                @Bean
                @Singleton
                public Cache productCache() { return null; }
            }

            // ❌ 不推荐:混合不相关的Bean
            @Factory
            public class MixedFactory {
                @Bean public DataSource dataSource() { return null; }
                @Bean public EmailService emailService() { return null; }
                @Bean public FileStorage fileStorage() { return null; }
                @Bean public MessageQueue messageQueue() { return null; }
                // 职责混乱,难以维护
            }
            ---
    b.资源管理
        a.PreDestroy处理
            @Factory创建的Bean应该正确处理资源释放,通过@PreDestroy或实现Closeable接口。
        b.资源管理示例
            ---
            @Factory
            public class ResourceFactory {
                // 方案1:返回实现Closeable的Bean
                @Bean
                @Singleton
                public CloseableHttpClient httpClient() {
                    System.out.println("创建HTTP客户端");
                    return HttpClients.custom()
                        .setMaxConnTotal(100)
                        .setMaxConnPerRoute(20)
                        .build();
                    // BeanContext关闭时自动调用close()
                }

                // 方案2:创建包装类处理清理
                @Bean
                @Singleton
                public ExecutorServiceWrapper executorService() {
                    System.out.println("创建线程池");
                    ExecutorService executor = Executors.newFixedThreadPool(10);
                    return new ExecutorServiceWrapper(executor);
                }
            }

            public class ExecutorServiceWrapper implements Closeable {
                private final ExecutorService executor;

                public ExecutorServiceWrapper(ExecutorService executor) {
                    this.executor = executor;
                }

                public void execute(Runnable task) {
                    executor.execute(task);
                }

                @Override
                public void close() throws IOException {
                    System.out.println("关闭线程池");
                    executor.shutdown();
                    try {
                        if (!executor.awaitTermination(30, TimeUnit.SECONDS)) {
                            executor.shutdownNow();
                        }
                    } catch (InterruptedException e) {
                        executor.shutdownNow();
                    }
                }
            }

            // 方案3:使用@PreDestroy方法
            @Factory
            public class ConnectionFactory {
                private Connection connection;

                @Bean
                @Singleton
                public Connection databaseConnection() throws SQLException {
                    System.out.println("创建数据库连接");
                    this.connection = DriverManager.getConnection("jdbc:...");
                    return connection;
                }

                @PreDestroy
                public void cleanup() throws SQLException {
                    if (connection != null && !connection.isClosed()) {
                        System.out.println("关闭数据库连接");
                        connection.close();
                    }
                }
            }
            ---

09.总结与对比
    a.工厂vs构造器
        a.使用场景
            构造器注入适合自有类,@Factory适合第三方类、需要复杂配置或条件化创建的Bean。
        b.对比示例
            ---
            // 场景1:自有类 → 直接使用@Singleton
            @Singleton
            public class UserService {
                private final UserRepository repository;

                public UserService(UserRepository repository) {
                    this.repository = repository;
                }
            }

            // 场景2:第三方类 → 使用@Factory
            @Factory
            public class JacksonFactory {
                @Bean
                @Singleton
                public ObjectMapper objectMapper() {
                    ObjectMapper mapper = new ObjectMapper();
                    // 无法在第三方类上添加@Singleton
                    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
                    return mapper;
                }
            }

            // 场景3:复杂初始化 → 使用@Factory
            @Factory
            public class SecurityFactory {
                @Bean
                @Singleton
                public SecurityManager securityManager() {
                    SecurityManager manager = new SecurityManager();

                    // 复杂配置
                    manager.setRealm(new JdbcRealm());
                    manager.setSessionManager(new DefaultSessionManager());
                    manager.setCacheManager(new RedisCacheManager());

                    // 初始化
                    manager.init();

                    return manager;
                }
            }

            // 场景4:条件化创建 → 使用@Factory + @Requires
            @Factory
            public class StorageFactory {
                @Bean
                @Singleton
                @Requires(property = "storage.type", value = "s3")
                public Storage s3Storage() {
                    return new S3Storage();
                }

                @Bean
                @Singleton
                @Requires(property = "storage.type", value = "local")
                public Storage localStorage() {
                    return new LocalStorage();
                }
            }
            ---
    b.Provider最佳实践
        a.使用时机
            仅在确实需要延迟获取或解决循环依赖时使用Provider,过度使用会降低代码可读性。
        b.Provider建议
            ---
            // ✅ 推荐:解决循环依赖
            @Singleton
            public class ServiceA {
                private final Provider<ServiceB> serviceBProvider;

                public ServiceA(Provider<ServiceB> serviceBProvider) {
                    this.serviceBProvider = serviceBProvider;
                }
            }

            // ✅ 推荐:Singleton依赖Prototype
            @Singleton
            public class TaskManager {
                private final Provider<TaskHandler> handlerProvider;

                public TaskManager(Provider<TaskHandler> handlerProvider) {
                    this.handlerProvider = handlerProvider;
                }

                public void executeTask() {
                    TaskHandler handler = handlerProvider.get();  // 每次新实例
                    handler.handle();
                }
            }

            // ✅ 推荐:懒加载重量级Bean
            @Singleton
            public class Application {
                private final Provider<HeavyEngine> engineProvider;

                public Application(Provider<HeavyEngine> engineProvider) {
                    this.engineProvider = engineProvider;
                }

                public void startEngine() {
                    HeavyEngine engine = engineProvider.get();  // 仅在需要时创建
                    engine.start();
                }
            }

            // ❌ 不推荐:Singleton依赖Singleton使用Provider
            @Singleton
            public class ServiceX {
                private final Provider<ServiceY> serviceYProvider;  // 不必要

                public ServiceX(Provider<ServiceY> serviceYProvider) {
                    this.serviceYProvider = serviceYProvider;
                }

                public void doSomething() {
                    ServiceY serviceY = serviceYProvider.get();  // 多余的间接访问
                    serviceY.process();
                }
            }

            // ✅ 推荐:Singleton直接依赖Singleton
            @Singleton
            public class ImprovedServiceX {
                private final ServiceY serviceY;  // 直接注入

                public ImprovedServiceX(ServiceY serviceY) {
                    this.serviceY = serviceY;
                }

                public void doSomething() {
                    serviceY.process();  // 直接访问
                }
            }

            // 总结
            // Provider使用场景:
            // ✅ 解决循环依赖
            // ✅ 长生命周期依赖短生命周期(Singleton → Prototype/RequestScope)
            // ✅ 懒加载优化
            // ✅ 运行时动态选择Bean
            // ❌ 避免无意义的Provider使用
            ---

4 HTTP服务开发

4.1 @Controller控制器

01.控制器基础
    a.@Controller注解
        a.控制器定义
            @Controller注解将类标记为HTTP端点处理器,通过路径映射接收HTTP请求并返回响应,是构建REST API的核心组件。
        b.基础控制器示例
            ---
            import io.micronaut.http.annotation.*;
            import io.micronaut.http.HttpStatus;
            import jakarta.inject.Singleton;

            @Controller("/api/users")
            public class UserController {
                private final UserService userService;

                public UserController(UserService userService) {
                    this.userService = userService;
                }

                // GET请求
                @Get("/{id}")
                public User getUser(Long id) {
                    System.out.println("GET /api/users/" + id);
                    return userService.findById(id);
                }

                // POST请求
                @Post
                public User createUser(@Body User user) {
                    System.out.println("POST /api/users");
                    return userService.save(user);
                }

                // PUT请求
                @Put("/{id}")
                public User updateUser(Long id, @Body User user) {
                    System.out.println("PUT /api/users/" + id);
                    user.setId(id);
                    return userService.update(user);
                }

                // DELETE请求
                @Delete("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void deleteUser(Long id) {
                    System.out.println("DELETE /api/users/" + id);
                    userService.delete(id);
                }

                // 列表查询
                @Get
                public List<User> listUsers(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {

                    System.out.println("GET /api/users?page=" + page + "&size=" + size);
                    return userService.findAll(page, size);
                }
            }

            // URL映射示例
            // GET    /api/users/123         → getUser(123)
            // POST   /api/users             → createUser(user)
            // PUT    /api/users/123         → updateUser(123, user)
            // DELETE /api/users/123         → deleteUser(123)
            // GET    /api/users?page=0&size=10 → listUsers(0, 10)
            ---
    b.路径变量
        a.@PathVariable映射
            通过{}语法在路径中定义变量,方法参数自动接收路径中对应位置的值。
        b.路径变量示例
            ---
            @Controller("/api")
            public class ResourceController {
                // 单个路径变量
                @Get("/users/{userId}")
                public User getUser(Long userId) {
                    // userId自动从路径提取
                    return userService.findById(userId);
                }

                // 多个路径变量
                @Get("/users/{userId}/orders/{orderId}")
                public Order getUserOrder(Long userId, Long orderId) {
                    return orderService.findByUserAndOrder(userId, orderId);
                }

                // 字符串路径变量
                @Get("/categories/{category}/products/{productCode}")
                public Product getProduct(String category, String productCode) {
                    System.out.println("分类: " + category + ", 产品代码: " + productCode);
                    return productService.findByCode(category, productCode);
                }

                // 可选路径变量
                @Get("/search{/keyword}")
                public List<Product> search(@Nullable String keyword) {
                    if (keyword == null) {
                        // GET /api/search → 返回全部
                        return productService.findAll();
                    } else {
                        // GET /api/search/手机 → 搜索"手机"
                        return productService.search(keyword);
                    }
                }

                // 正则表达式约束
                @Get("/products/{id:[0-9]+}")
                public Product getProductById(Long id) {
                    // id必须是数字
                    return productService.findById(id);
                }

                @Get("/users/{username:[a-zA-Z0-9_]+}")
                public User getUserByUsername(String username) {
                    // username只能包含字母数字下划线
                    return userService.findByUsername(username);
                }

                // 路径变量类型转换
                @Get("/orders/{date}")
                public List<Order> getOrdersByDate(
                    @Format("yyyy-MM-dd") LocalDate date) {
                    // 自动将字符串转换为LocalDate
                    System.out.println("查询日期: " + date);
                    return orderService.findByDate(date);
                }
            }

            // URL示例
            // GET /api/users/123 → userId=123
            // GET /api/users/123/orders/456 → userId=123, orderId=456
            // GET /api/categories/electronics/products/P001 → category="electronics", productCode="P001"
            // GET /api/search → keyword=null
            // GET /api/search/手机 → keyword="手机"
            // GET /api/orders/2024-01-15 → date=LocalDate(2024-01-15)
            ---

02.请求方法映射
    a.HTTP方法注解
        a.RESTful方法
            Micronaut提供@Get、@Post、@Put、@Delete、@Patch、@Head、@Options等注解对应HTTP方法。
        b.方法注解示例
            ---
            @Controller("/api/products")
            public class ProductController {
                // GET: 查询单个资源
                @Get("/{id}")
                public Product getProduct(Long id) {
                    return productService.findById(id);
                }

                // GET: 查询资源列表
                @Get
                public List<Product> listProducts() {
                    return productService.findAll();
                }

                // POST: 创建资源
                @Post
                @Status(HttpStatus.CREATED)
                public Product createProduct(@Body Product product) {
                    return productService.create(product);
                }

                // PUT: 完整更新资源
                @Put("/{id}")
                public Product updateProduct(Long id, @Body Product product) {
                    product.setId(id);
                    return productService.update(product);
                }

                // PATCH: 部分更新资源
                @Patch("/{id}")
                public Product patchProduct(Long id, @Body Map<String, Object> updates) {
                    return productService.partialUpdate(id, updates);
                }

                // DELETE: 删除资源
                @Delete("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void deleteProduct(Long id) {
                    productService.delete(id);
                }

                // HEAD: 检查资源是否存在
                @Head("/{id}")
                public HttpResponse<?> checkProduct(Long id) {
                    boolean exists = productService.exists(id);
                    return exists ?
                        HttpResponse.ok() :
                        HttpResponse.notFound();
                }

                // OPTIONS: 获取支持的HTTP方法
                @Options("/{id}")
                public HttpResponse<?> options() {
                    return HttpResponse.ok()
                        .header("Allow", "GET, PUT, PATCH, DELETE, HEAD, OPTIONS");
                }
            }

            // RESTful API设计
            // GET    /api/products          → 列表查询
            // GET    /api/products/123      → 查询单个
            // POST   /api/products          → 创建
            // PUT    /api/products/123      → 完整更新
            // PATCH  /api/products/123      → 部分更新
            // DELETE /api/products/123      → 删除
            // HEAD   /api/products/123      → 检查存在
            // OPTIONS /api/products/123     → 查询支持的方法
            ---
    b.自定义HTTP方法
        a.@CustomHttpMethod
            支持自定义HTTP方法,用于扩展标准HTTP方法集。
        b.自定义方法示例
            ---
            import io.micronaut.http.annotation.CustomHttpMethod;
            import io.micronaut.http.HttpMethod;

            @Controller("/api/cache")
            public class CacheController {
                private final CacheService cacheService;

                public CacheController(CacheService cacheService) {
                    this.cacheService = cacheService;
                }

                // 自定义PURGE方法(清除缓存)
                @CustomHttpMethod(method = "PURGE")
                @Status(HttpStatus.NO_CONTENT)
                public void purgeCache(@QueryValue String key) {
                    System.out.println("PURGE /api/cache?key=" + key);
                    cacheService.invalidate(key);
                }

                // 自定义LOCK方法(锁定资源)
                @CustomHttpMethod(method = "LOCK", value = "/{resource}")
                public LockResponse lockResource(String resource) {
                    System.out.println("LOCK /api/cache/" + resource);
                    String lockToken = cacheService.lock(resource);
                    return new LockResponse(lockToken);
                }

                // 自定义UNLOCK方法(解锁资源)
                @CustomHttpMethod(method = "UNLOCK", value = "/{resource}")
                @Status(HttpStatus.NO_CONTENT)
                public void unlockResource(
                    String resource,
                    @Header("Lock-Token") String lockToken) {

                    System.out.println("UNLOCK /api/cache/" + resource);
                    cacheService.unlock(resource, lockToken);
                }
            }

            // 使用示例
            // PURGE /api/cache?key=user:123
            // LOCK /api/cache/report-123
            // UNLOCK /api/cache/report-123 (Header: Lock-Token: xxx)
            ---

03.请求参数绑定
    a.查询参数
        a.@QueryValue注解
            通过@QueryValue绑定URL查询参数,支持默认值、类型转换和可选参数。
        b.查询参数示例
            ---
            @Controller("/api/search")
            public class SearchController {
                // 必需参数
                @Get
                public List<Product> search(@QueryValue String keyword) {
                    // GET /api/search?keyword=手机
                    System.out.println("搜索: " + keyword);
                    return productService.search(keyword);
                }

                // 可选参数
                @Get("/advanced")
                public List<Product> advancedSearch(
                    @QueryValue @Nullable String keyword,
                    @QueryValue @Nullable String category,
                    @QueryValue @Nullable BigDecimal minPrice,
                    @QueryValue @Nullable BigDecimal maxPrice) {

                    System.out.println("高级搜索:");
                    System.out.println("  关键词: " + keyword);
                    System.out.println("  分类: " + category);
                    System.out.println("  价格区间: " + minPrice + " - " + maxPrice);

                    return productService.advancedSearch(
                        keyword, category, minPrice, maxPrice);
                }

                // 默认值
                @Get("/list")
                public List<Product> listProducts(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size,
                    @QueryValue(defaultValue = "id") String sortBy,
                    @QueryValue(defaultValue = "asc") String order) {

                    System.out.println("分页查询: page=" + page +
                                     ", size=" + size +
                                     ", sortBy=" + sortBy +
                                     ", order=" + order);

                    return productService.findAll(page, size, sortBy, order);
                }

                // 数组参数
                @Get("/filter")
                public List<Product> filterProducts(
                    @QueryValue("tag") List<String> tags,
                    @QueryValue("status") List<String> statuses) {

                    System.out.println("标签: " + tags);
                    System.out.println("状态: " + statuses);

                    return productService.filter(tags, statuses);
                }

                // 日期参数
                @Get("/orders")
                public List<Order> getOrders(
                    @QueryValue @Format("yyyy-MM-dd") LocalDate startDate,
                    @QueryValue @Format("yyyy-MM-dd") LocalDate endDate) {

                    System.out.println("查询订单: " + startDate + " 至 " + endDate);
                    return orderService.findByDateRange(startDate, endDate);
                }

                // Boolean参数
                @Get("/products")
                public List<Product> getProducts(
                    @QueryValue(defaultValue = "false") boolean includeDeleted,
                    @QueryValue(defaultValue = "true") boolean inStock) {

                    return productService.find(includeDeleted, inStock);
                }
            }

            // URL示例
            // GET /api/search?keyword=手机
            // GET /api/search/advanced?keyword=手机&category=电子&minPrice=1000&maxPrice=5000
            // GET /api/search/list (使用默认值: page=0, size=20, sortBy=id, order=asc)
            // GET /api/search/list?page=1&size=50&sortBy=price&order=desc
            // GET /api/search/filter?tag=hot&tag=new&status=active&status=promoted
            // GET /api/search/orders?startDate=2024-01-01&endDate=2024-12-31
            ---
    b.请求头参数
        a.@Header注解
            通过@Header绑定HTTP请求头,获取认证token、客户端信息等元数据。
        b.请求头示例
            ---
            @Controller("/api")
            public class SecureController {
                // 必需请求头
                @Get("/profile")
                public UserProfile getProfile(@Header String authorization) {
                    System.out.println("Authorization: " + authorization);

                    // 解析token
                    String token = authorization.replace("Bearer ", "");
                    Long userId = jwtService.getUserIdFromToken(token);

                    return userService.getProfile(userId);
                }

                // 可选请求头
                @Get("/content")
                public String getContent(
                    @Header("Accept-Language") @Nullable String language,
                    @Header("User-Agent") @Nullable String userAgent) {

                    System.out.println("语言: " + (language != null ? language : "default"));
                    System.out.println("客户端: " + userAgent);

                    return contentService.getContent(language);
                }

                // 自定义请求头
                @Post("/upload")
                public UploadResponse upload(
                    @Body byte[] data,
                    @Header("X-File-Name") String fileName,
                    @Header("X-File-Type") String fileType,
                    @Header(value = "X-Checksum", defaultValue = "") String checksum) {

                    System.out.println("上传文件: " + fileName);
                    System.out.println("文件类型: " + fileType);
                    System.out.println("校验和: " + checksum);

                    return fileService.upload(fileName, fileType, data, checksum);
                }

                // 多个请求头
                @Get("/api-call")
                public ApiResponse callApi(
                    @Header("X-API-Key") String apiKey,
                    @Header("X-Request-Id") String requestId,
                    @Header("X-Tenant-Id") String tenantId) {

                    System.out.println("API密钥: " + apiKey);
                    System.out.println("请求ID: " + requestId);
                    System.out.println("租户ID: " + tenantId);

                    return apiService.call(apiKey, requestId, tenantId);
                }

                // HttpHeaders对象(获取所有请求头)
                @Get("/headers")
                public Map<String, String> getAllHeaders(HttpHeaders headers) {
                    Map<String, String> result = new HashMap<>();

                    for (String name : headers.names()) {
                        result.put(name, headers.get(name));
                    }

                    System.out.println("接收到 " + result.size() + " 个请求头");
                    return result;
                }
            }

            // 请求示例
            // curl -H "Authorization: Bearer eyJhbGc..." http://localhost:8080/api/profile
            // curl -H "Accept-Language: zh-CN" http://localhost:8080/api/content
            // curl -X POST -H "X-File-Name: doc.pdf" -H "X-File-Type: application/pdf" \
            //      --data-binary @doc.pdf http://localhost:8080/api/upload
            ---

04.请求体处理
    a.@Body注解
        a.请求体绑定
            @Body注解将HTTP请求体自动反序列化为Java对象,支持JSON、XML等格式。
        b.请求体示例
            ---
            @Controller("/api/users")
            public class UserManagementController {
                // JSON请求体
                @Post
                public User createUser(@Body User user) {
                    System.out.println("创建用户: " + user.getUsername());
                    return userService.save(user);
                }

                // 嵌套对象
                @Post("/register")
                public RegistrationResponse register(@Body RegistrationRequest request) {
                    System.out.println("注册用户: " + request.getUsername());
                    System.out.println("邮箱: " + request.getEmail());
                    System.out.println("密码长度: " + request.getPassword().length());

                    User user = userService.register(request);
                    return new RegistrationResponse(user.getId(), "注册成功");
                }

                // 泛型请求体
                @Post("/batch")
                public BatchResponse<User> batchCreate(@Body List<User> users) {
                    System.out.println("批量创建 " + users.size() + " 个用户");

                    List<User> created = new ArrayList<>();
                    for (User user : users) {
                        created.add(userService.save(user));
                    }

                    return new BatchResponse<>(created.size(), created);
                }

                // Map请求体
                @Patch("/{id}")
                public User partialUpdate(Long id, @Body Map<String, Object> updates) {
                    System.out.println("更新用户 " + id + ": " + updates);

                    User user = userService.findById(id);
                    // 应用部分更新
                    if (updates.containsKey("email")) {
                        user.setEmail((String) updates.get("email"));
                    }
                    if (updates.containsKey("phone")) {
                        user.setPhone((String) updates.get("phone"));
                    }

                    return userService.update(user);
                }

                // 可选请求体
                @Post("/search")
                public List<User> search(@Body @Nullable SearchCriteria criteria) {
                    if (criteria == null) {
                        // 无请求体,返回所有用户
                        return userService.findAll();
                    }

                    return userService.search(criteria);
                }
            }

            // 请求体类定义
            public class RegistrationRequest {
                private String username;
                private String email;
                private String password;
                private UserProfile profile;

                // Getter和Setter省略
            }

            public class UserProfile {
                private String firstName;
                private String lastName;
                private LocalDate birthDate;

                // Getter和Setter省略
            }

            // JSON请求示例
            // POST /api/users
            // Content-Type: application/json
            // {
            //   "username": "john",
            //   "email": "john@example.com",
            //   "phone": "13800138000"
            // }

            // POST /api/users/register
            // {
            //   "username": "john",
            //   "email": "john@example.com",
            //   "password": "secret123",
            //   "profile": {
            //     "firstName": "John",
            //     "lastName": "Doe",
            //     "birthDate": "1990-01-15"
            //   }
            // }

            // PATCH /api/users/123
            // {
            //   "email": "newemail@example.com",
            //   "phone": "13900139000"
            // }
            ---
    b.内容类型协商
        a.@Consumes和@Produces
            通过@Consumes指定接受的请求类型,@Produces指定返回的响应类型。
        b.内容类型示例
            ---
            import io.micronaut.http.annotation.Consumes;
            import io.micronaut.http.annotation.Produces;
            import io.micronaut.http.MediaType;

            @Controller("/api/data")
            public class DataController {
                // 接受JSON,返回JSON(默认)
                @Post("/json")
                @Consumes(MediaType.APPLICATION_JSON)
                @Produces(MediaType.APPLICATION_JSON)
                public DataResponse processJson(@Body DataRequest request) {
                    return new DataResponse(request.getData());
                }

                // 接受XML,返回XML
                @Post("/xml")
                @Consumes(MediaType.APPLICATION_XML)
                @Produces(MediaType.APPLICATION_XML)
                public DataResponse processXml(@Body DataRequest request) {
                    return new DataResponse(request.getData());
                }

                // 接受表单数据
                @Post("/form")
                @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
                public String processForm(
                    @Body("username") String username,
                    @Body("email") String email) {

                    System.out.println("用户名: " + username);
                    System.out.println("邮箱: " + email);
                    return "表单已提交";
                }

                // 文件上传
                @Post("/upload")
                @Consumes(MediaType.MULTIPART_FORM_DATA)
                public UploadResponse uploadFile(
                    @Part("file") CompletedFileUpload file,
                    @Part("description") @Nullable String description) throws IOException {

                    System.out.println("文件名: " + file.getFilename());
                    System.out.println("大小: " + file.getSize() + " bytes");
                    System.out.println("描述: " + description);

                    byte[] bytes = file.getBytes();
                    String fileId = fileService.save(file.getFilename(), bytes);

                    return new UploadResponse(fileId, file.getFilename(), file.getSize());
                }

                // 返回纯文本
                @Get("/text")
                @Produces(MediaType.TEXT_PLAIN)
                public String getText() {
                    return "这是纯文本响应";
                }

                // 返回HTML
                @Get("/page")
                @Produces(MediaType.TEXT_HTML)
                public String getPage() {
                    return "<html><body><h1>Hello Micronaut</h1></body></html>";
                }

                // 返回二进制数据
                @Get("/download/{fileId}")
                @Produces(MediaType.APPLICATION_OCTET_STREAM)
                public byte[] downloadFile(String fileId) {
                    return fileService.load(fileId);
                }
            }

            // 请求示例
            // POST /api/data/json
            // Content-Type: application/json
            // {"data": "test"}

            // POST /api/data/form
            // Content-Type: application/x-www-form-urlencoded
            // username=john&email=john@example.com

            // POST /api/data/upload
            // Content-Type: multipart/form-data
            // file=@document.pdf
            // description=重要文档
            ---

05.响应处理
    a.返回类型
        a.多种返回方式
            控制器方法可以返回对象、HttpResponse、CompletableFuture等多种类型。
        b.返回类型示例
            ---
            import io.micronaut.http.HttpResponse;
            import io.micronaut.http.MutableHttpResponse;

            @Controller("/api/responses")
            public class ResponseController {
                // 1. 返回对象(自动序列化为JSON)
                @Get("/user/{id}")
                public User getUser(Long id) {
                    return userService.findById(id);
                }

                // 2. 返回HttpResponse(自定义状态码和头)
                @Post("/users")
                public HttpResponse<User> createUser(@Body User user) {
                    User created = userService.save(user);

                    return HttpResponse.created(created)
                        .header("X-User-Id", created.getId().toString())
                        .header("Location", "/api/users/" + created.getId());
                }

                // 3. 返回MutableHttpResponse(构建响应)
                @Get("/download/{fileId}")
                public MutableHttpResponse<byte[]> downloadFile(String fileId) {
                    byte[] data = fileService.load(fileId);
                    String fileName = fileService.getFileName(fileId);

                    return HttpResponse.ok(data)
                        .contentType(MediaType.APPLICATION_OCTET_STREAM)
                        .header("Content-Disposition",
                               "attachment; filename=\"" + fileName + "\"");
                }

                // 4. 返回Optional(404处理)
                @Get("/optional/{id}")
                public Optional<User> getUserOptional(Long id) {
                    // 返回Optional.empty()时自动返回404
                    return userService.findByIdOptional(id);
                }

                // 5. 返回CompletableFuture(异步响应)
                @Get("/async/{id}")
                public CompletableFuture<User> getUserAsync(Long id) {
                    return CompletableFuture.supplyAsync(() ->
                        userService.findById(id));
                }

                // 6. 返回void(204 No Content)
                @Delete("/{id}")
                public void deleteUser(Long id) {
                    userService.delete(id);
                    // 自动返回204 No Content
                }

                // 7. 返回String(纯文本)
                @Get("/hello")
                @Produces(MediaType.TEXT_PLAIN)
                public String hello() {
                    return "Hello World";
                }

                // 8. 返回流式数据
                @Get("/stream")
                @Produces(MediaType.APPLICATION_JSON_STREAM)
                public Publisher<Product> streamProducts() {
                    return productService.streamAll();
                }
            }

            // 响应示例
            // GET /api/responses/user/123
            // 200 OK
            // Content-Type: application/json
            // {"id": 123, "username": "john"}

            // POST /api/responses/users
            // 201 Created
            // X-User-Id: 456
            // Location: /api/users/456
            // {"id": 456, "username": "jane"}

            // GET /api/responses/optional/999 (不存在)
            // 404 Not Found
            ---
    b.状态码控制
        a.@Status注解
            通过@Status注解指定成功响应的HTTP状态码。
        b.状态码示例
            ---
            @Controller("/api/resources")
            public class ResourceController {
                // 201 Created
                @Post
                @Status(HttpStatus.CREATED)
                public Resource createResource(@Body Resource resource) {
                    return resourceService.create(resource);
                }

                // 202 Accepted(异步处理)
                @Post("/async")
                @Status(HttpStatus.ACCEPTED)
                public TaskResponse submitTask(@Body Task task) {
                    String taskId = taskService.submitAsync(task);
                    return new TaskResponse(taskId, "任务已提交");
                }

                // 204 No Content
                @Put("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void updateResource(Long id, @Body Resource resource) {
                    resourceService.update(id, resource);
                }

                // 206 Partial Content
                @Get("/{id}/partial")
                @Status(HttpStatus.PARTIAL_CONTENT)
                public PartialData getPartialData(
                    Long id,
                    @Header("Range") String range) {

                    return resourceService.getPartial(id, range);
                }

                // 动态状态码
                @Get("/{id}")
                public HttpResponse<Resource> getResource(Long id) {
                    Optional<Resource> resource = resourceService.findById(id);

                    if (resource.isPresent()) {
                        return HttpResponse.ok(resource.get());  // 200
                    } else {
                        return HttpResponse.notFound();  // 404
                    }
                }

                // 条件化状态码
                @Delete("/{id}")
                public HttpResponse<?> deleteResource(Long id) {
                    boolean deleted = resourceService.delete(id);

                    if (deleted) {
                        return HttpResponse.noContent();  // 204
                    } else {
                        return HttpResponse.notFound();  // 404
                    }
                }
            }
            ---

06.异常处理
    a.@Error注解
        a.异常映射
            通过@Error注解捕获特定异常,返回自定义错误响应。
        b.异常处理示例
            ---
            import io.micronaut.http.annotation.Error;
            import io.micronaut.http.HttpRequest;
            import io.micronaut.http.HttpResponse;

            @Controller("/api/products")
            public class ProductController {
                private final ProductService productService;

                public ProductController(ProductService productService) {
                    this.productService = productService;
                }

                @Get("/{id}")
                public Product getProduct(Long id) {
                    // 可能抛出ProductNotFoundException
                    return productService.findById(id);
                }

                // 处理特定异常
                @Error(exception = ProductNotFoundException.class)
                public HttpResponse<ErrorResponse> handleNotFound(
                    HttpRequest request,
                    ProductNotFoundException ex) {

                    System.out.println("产品未找到: " + ex.getMessage());

                    ErrorResponse error = new ErrorResponse(
                        "PRODUCT_NOT_FOUND",
                        ex.getMessage(),
                        request.getPath()
                    );

                    return HttpResponse.notFound(error);
                }

                // 处理验证异常
                @Error(exception = ValidationException.class)
                public HttpResponse<ErrorResponse> handleValidation(
                    HttpRequest request,
                    ValidationException ex) {

                    System.out.println("验证失败: " + ex.getErrors());

                    ErrorResponse error = new ErrorResponse(
                        "VALIDATION_ERROR",
                        "请求数据验证失败",
                        ex.getErrors()
                    );

                    return HttpResponse.badRequest(error);
                }

                // 处理所有异常
                @Error
                public HttpResponse<ErrorResponse> handleGenericError(
                    HttpRequest request,
                    Throwable ex) {

                    System.err.println("未处理的异常: " + ex.getMessage());
                    ex.printStackTrace();

                    ErrorResponse error = new ErrorResponse(
                        "INTERNAL_ERROR",
                        "服务器内部错误",
                        request.getPath()
                    );

                    return HttpResponse.serverError(error);
                }
            }

            // 错误响应类
            public class ErrorResponse {
                private String code;
                private String message;
                private String path;
                private Object details;
                private long timestamp;

                public ErrorResponse(String code, String message, String path) {
                    this.code = code;
                    this.message = message;
                    this.path = path;
                    this.timestamp = System.currentTimeMillis();
                }

                public ErrorResponse(String code, String message, Object details) {
                    this.code = code;
                    this.message = message;
                    this.details = details;
                    this.timestamp = System.currentTimeMillis();
                }

                // Getter省略
            }

            // 错误响应示例
            // GET /api/products/999 (不存在)
            // 404 Not Found
            // {
            //   "code": "PRODUCT_NOT_FOUND",
            //   "message": "产品不存在: 999",
            //   "path": "/api/products/999",
            //   "timestamp": 1704096000000
            // }
            ---
    b.全局异常处理
        a.@ServerFilter异常处理
            通过全局异常处理器统一处理所有控制器的异常。
        b.全局处理器示例
            ---
            import io.micronaut.http.annotation.ServerFilter;
            import io.micronaut.http.filter.HttpServerFilter;
            import io.micronaut.http.filter.ServerFilterChain;
            import org.reactivestreams.Publisher;

            @Singleton
            public class GlobalExceptionHandler implements ExceptionHandler<Exception, HttpResponse<?>> {
                private static final Logger log =
                    LoggerFactory.getLogger(GlobalExceptionHandler.class);

                @Override
                public HttpResponse<?> handle(HttpRequest request, Exception exception) {
                    log.error("全局异常处理", exception);

                    // 业务异常
                    if (exception instanceof BusinessException) {
                        BusinessException bex = (BusinessException) exception;
                        return HttpResponse.badRequest(new ErrorResponse(
                            bex.getCode(),
                            bex.getMessage()
                        ));
                    }

                    // 认证异常
                    if (exception instanceof UnauthorizedException) {
                        return HttpResponse.unauthorized();
                    }

                    // 权限异常
                    if (exception instanceof ForbiddenException) {
                        return HttpResponse.forbidden();
                    }

                    // 资源未找到
                    if (exception instanceof ResourceNotFoundException) {
                        return HttpResponse.notFound(new ErrorResponse(
                            "NOT_FOUND",
                            exception.getMessage()
                        ));
                    }

                    // 其他异常
                    return HttpResponse.serverError(new ErrorResponse(
                        "INTERNAL_ERROR",
                        "服务器内部错误"
                    ));
                }
            }
            ---

4.2 路由与请求映射

01.路由配置
    a.路由规则
        a.路径匹配机制
            Micronaut使用URI模板语法定义路由规则,支持静态路径、路径变量、可选路径段和正则表达式约束,实现灵活的URL映射。路径匹配采用前缀匹配和精确匹配相结合的方式,确保请求正确路由到对应的处理器方法。
        b.路由规则示例
            ---
            import io.micronaut.http.annotation.*;

            @Controller("/api")
            public class RouteController {
                // 静态路径 - 精确匹配
                @Get("/products")
                public List<Product> getAllProducts() {
                    System.out.println("匹配: /api/products");
                    return productService.findAll();
                }

                // 路径变量 - 动态匹配
                @Get("/products/{id}")
                public Product getProduct(Long id) {
                    System.out.println("匹配: /api/products/" + id);
                    return productService.findById(id);
                }

                // 多级路径变量
                @Get("/categories/{category}/products/{id}")
                public Product getProductByCategory(String category, Long id) {
                    System.out.println("匹配: /api/categories/" + category + "/products/" + id);
                    return productService.findByCategoryAndId(category, id);
                }

                // 可选路径段 - {/variable} 语法
                @Get("/search{/keyword}")
                public List<Product> search(@Nullable String keyword) {
                    if (keyword == null) {
                        System.out.println("匹配: /api/search (无关键词)");
                        return productService.findAll();
                    }
                    System.out.println("匹配: /api/search/" + keyword);
                    return productService.search(keyword);
                }

                // 正则表达式约束 - 只匹配数字ID
                @Get("/orders/{orderId:[0-9]+}")
                public Order getOrder(Long orderId) {
                    System.out.println("匹配: /api/orders/" + orderId + " (数字ID)");
                    return orderService.findById(orderId);
                }

                // 正则表达式约束 - 匹配用户名格式
                @Get("/users/{username:[a-zA-Z0-9_]{3,20}}")
                public User getUserByUsername(String username) {
                    System.out.println("匹配: /api/users/" + username + " (用户名格式)");
                    return userService.findByUsername(username);
                }
            }

            // URL匹配示例
            // GET /api/products              → getAllProducts()
            // GET /api/products/123          → getProduct(123)
            // GET /api/categories/electronics/products/456 → getProductByCategory("electronics", 456)
            // GET /api/search                → search(null)
            // GET /api/search/手机            → search("手机")
            // GET /api/orders/789            → getOrder(789) ✓
            // GET /api/orders/abc            → 404 (不匹配正则) ✗
            // GET /api/users/john_doe        → getUserByUsername("john_doe") ✓
            // GET /api/users/ab              → 404 (用户名太短) ✗
            ---
    b.路由优先级
        a.匹配优先级规则
            当多个路由规则匹配同一请求时,Micronaut按照路径具体程度、HTTP方法、参数数量等因素确定优先级。优先级从高到低依次为:静态路径>带约束的路径变量>普通路径变量>通配符,具体匹配>泛型匹配,确保最精确的路由被选中执行。
        b.优先级示例
            ---
            @Controller("/api")
            public class PriorityController {
                // 优先级1: 静态路径 (最高优先级)
                @Get("/products/featured")
                public List<Product> getFeaturedProducts() {
                    System.out.println("路由1: 静态路径 /products/featured");
                    return productService.findFeatured();
                }

                // 优先级2: 带正则约束的路径变量
                @Get("/products/{id:[0-9]+}")
                public Product getProductById(Long id) {
                    System.out.println("路由2: 数字ID /products/" + id);
                    return productService.findById(id);
                }

                // 优先级3: 普通路径变量 (最低优先级)
                @Get("/products/{slug}")
                public Product getProductBySlug(String slug) {
                    System.out.println("路由3: 文字标识符 /products/" + slug);
                    return productService.findBySlug(slug);
                }

                // HTTP方法优先级: 具体方法>泛型方法
                @Get("/users/{id}")
                public User getUser(Long id) {
                    System.out.println("GET /users/" + id);
                    return userService.findById(id);
                }

                @Post("/users/{id}")
                public User updateUser(Long id, @Body User user) {
                    System.out.println("POST /users/" + id);
                    return userService.update(id, user);
                }

                // 参数数量影响优先级
                @Get("/search")
                public List<Product> searchAll() {
                    System.out.println("搜索: 无参数");
                    return productService.findAll();
                }

                @Get("/search")
                public List<Product> searchWithKeyword(
                    @QueryValue String keyword) {
                    System.out.println("搜索: 关键词=" + keyword);
                    return productService.search(keyword);
                }
            }

            // 路由选择示例
            // GET /api/products/featured    → 路由1 (静态路径优先)
            // GET /api/products/123         → 路由2 (数字匹配正则约束)
            // GET /api/products/gaming-mouse → 路由3 (字符串作为slug)
            // GET /api/users/456            → getUser(456)
            // POST /api/users/456           → updateUser(456, user)
            // GET /api/search               → searchAll() (无参数版本)
            // GET /api/search?keyword=手机   → searchWithKeyword("手机")
            ---

02.URI模板高级特性
    a.多路径映射
        a.路径别名
            单个方法可以映射多个路径,通过在注解中使用数组定义多个路径字符串,实现路径别名和版本兼容。这对于API版本演进、保持向后兼容性、提供简写路径等场景非常有用。
        b.多路��示例
            ---
            @Controller("/api")
            public class MultiPathController {
                // 多个路径映射到同一方法
                @Get({"/products", "/items"})
                public List<Product> getProducts() {
                    System.out.println("访问产品列表 (支持两个路径)");
                    return productService.findAll();
                }

                // API版本兼容
                @Get({"/v1/users/{id}", "/v2/users/{id}"})
                public User getUser(Long id) {
                    System.out.println("获取用户 (v1和v2都支持)");
                    return userService.findById(id);
                }

                // 简写路径和完整路径
                @Post({"/register", "/users/register"})
                public User register(@Body RegistrationRequest request) {
                    System.out.println("用户注册 (支持简写和完整路径)");
                    return userService.register(request);
                }

                // 国际化路径
                @Get({"/profile", "/zh/个人资料", "/en/profile"})
                public UserProfile getProfile(
                    @Header("Authorization") String token) {
                    System.out.println("获取个人资料 (支持多语言路径)");
                    Long userId = authService.getUserIdFromToken(token);
                    return userService.getProfile(userId);
                }

                // 移动端和Web端路径统一
                @Post({"/mobile/orders", "/web/orders", "/orders"})
                public Order createOrder(@Body OrderRequest request) {
                    System.out.println("创建订单 (移动/Web/通用路径)");
                    return orderService.create(request);
                }
            }

            // 路由映射示例
            // GET /api/products    → getProducts() ✓
            // GET /api/items       → getProducts() ✓
            // GET /api/v1/users/1  → getUser(1) ✓
            // GET /api/v2/users/1  → getUser(1) ✓
            // POST /api/register   → register(...) ✓
            // POST /api/users/register → register(...) ✓
            ---
    b.路径前缀与组合
        a.控制器级前缀
            @Controller注解的value参数定义所有方法的公共路径前缀,方法级注解的路径与控制器级路径拼接形成完整请求路径,实现路径的层次化管理和逻辑分组。
        b.路径组合示例
            ---
            // 控制器级前缀: /api/v1
            @Controller("/api/v1")
            public class UserManagementController {
                // 完整路径: /api/v1/users
                @Get("/users")
                public List<User> listUsers() {
                    System.out.println("GET /api/v1/users");
                    return userService.findAll();
                }

                // 完整路径: /api/v1/users/{id}
                @Get("/users/{id}")
                public User getUser(Long id) {
                    System.out.println("GET /api/v1/users/" + id);
                    return userService.findById(id);
                }

                // 完整路径: /api/v1/users
                @Post("/users")
                public User createUser(@Body User user) {
                    System.out.println("POST /api/v1/users");
                    return userService.create(user);
                }

                // 空路径 - 完整路径: /api/v1
                @Get
                public ApiInfo getApiInfo() {
                    System.out.println("GET /api/v1 (API信息)");
                    return new ApiInfo("User API", "v1");
                }
            }

            // 嵌套资源路径
            @Controller("/api/users/{userId}")
            public class UserOrderController {
                // 完整路径: /api/users/{userId}/orders
                @Get("/orders")
                public List<Order> getUserOrders(Long userId) {
                    System.out.println("GET /api/users/" + userId + "/orders");
                    return orderService.findByUserId(userId);
                }

                // 完整路径: /api/users/{userId}/orders/{orderId}
                @Get("/orders/{orderId}")
                public Order getUserOrder(Long userId, Long orderId) {
                    System.out.println("GET /api/users/" + userId + "/orders/" + orderId);
                    return orderService.findByUserAndOrder(userId, orderId);
                }

                // 完整路径: /api/users/{userId}/orders
                @Post("/orders")
                public Order createUserOrder(
                    Long userId,
                    @Body OrderRequest request) {
                    System.out.println("POST /api/users/" + userId + "/orders");
                    request.setUserId(userId);
                    return orderService.create(request);
                }
            }

            // 路由示例
            // GET  /api/v1                     → getApiInfo()
            // GET  /api/v1/users               → listUsers()
            // GET  /api/v1/users/123           → getUser(123)
            // POST /api/v1/users               → createUser(user)
            // GET  /api/users/123/orders       → getUserOrders(123)
            // GET  /api/users/123/orders/456   → getUserOrder(123, 456)
            // POST /api/users/123/orders       → createUserOrder(123, request)
            ---

03.HTTP方法路由
    a.标准HTTP方法
        a.RESTful方法映射
            Micronaut提供@Get、@Post、@Put、@Delete、@Patch、@Head、@Options、@Trace等注解对应HTTP标准方法,实现完整的RESTful API支持。每个方法有明确的语义:GET查询资源、POST创建资源、PUT完整更新、PATCH部分更新、DELETE删除资源。
        b.方法路由示例
            ---
            @Controller("/api/articles")
            public class ArticleController {
                private final ArticleService articleService;

                public ArticleController(ArticleService articleService) {
                    this.articleService = articleService;
                }

                // GET: 查询单个资源
                @Get("/{id}")
                public Article getArticle(Long id) {
                    System.out.println("GET /api/articles/" + id);
                    return articleService.findById(id);
                }

                // GET: 查询资源列表
                @Get
                public List<Article> listArticles(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "10") int size) {
                    System.out.println("GET /api/articles?page=" + page + "&size=" + size);
                    return articleService.findAll(page, size);
                }

                // POST: 创建新资源
                @Post
                @Status(HttpStatus.CREATED)
                public Article createArticle(@Body ArticleRequest request) {
                    System.out.println("POST /api/articles - 标题: " + request.getTitle());
                    return articleService.create(request);
                }

                // PUT: 完整更新资源 (替换所有字段)
                @Put("/{id}")
                public Article updateArticle(Long id, @Body ArticleRequest request) {
                    System.out.println("PUT /api/articles/" + id + " - 完整更新");
                    return articleService.update(id, request);
                }

                // PATCH: 部分更新资源 (只更新提供的字段)
                @Patch("/{id}")
                public Article patchArticle(Long id, @Body Map<String, Object> updates) {
                    System.out.println("PATCH /api/articles/" + id + " - 部分更新: " + updates.keySet());
                    return articleService.partialUpdate(id, updates);
                }

                // DELETE: 删除资源
                @Delete("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void deleteArticle(Long id) {
                    System.out.println("DELETE /api/articles/" + id);
                    articleService.delete(id);
                }

                // HEAD: 检查资源是否存在 (不返回响应体)
                @Head("/{id}")
                public HttpResponse<?> checkArticleExists(Long id) {
                    System.out.println("HEAD /api/articles/" + id);
                    boolean exists = articleService.exists(id);
                    return exists ? HttpResponse.ok() : HttpResponse.notFound();
                }

                // OPTIONS: 返回支持的HTTP方法
                @Options("/{id}")
                public HttpResponse<?> getOptions() {
                    System.out.println("OPTIONS /api/articles/{id}");
                    return HttpResponse.ok()
                        .header("Allow", "GET, PUT, PATCH, DELETE, HEAD, OPTIONS");
                }
            }

            // RESTful API示例
            // GET    /api/articles           → 列表查询
            // GET    /api/articles/123       → 查询单个文章
            // POST   /api/articles           → 创建文章 (201 Created)
            // PUT    /api/articles/123       → 完整更新文章
            // PATCH  /api/articles/123       → 部分更新文章
            // DELETE /api/articles/123       → 删除文章 (204 No Content)
            // HEAD   /api/articles/123       → 检查文章是否存在
            // OPTIONS /api/articles/123      → 获取支持的HTTP方法
            ---
    b.自定义HTTP方法
        a.扩展HTTP方法
            通过@CustomHttpMethod注解支持自定义HTTP方法,用于实现WebDAV协议、缓存清除、资源锁定等扩展功能,突破标准HTTP方法的限制。
        b.自定义方法示例
            ---
            import io.micronaut.http.annotation.CustomHttpMethod;

            @Controller("/api/cache")
            public class CacheManagementController {
                private final CacheService cacheService;

                public CacheManagementController(CacheService cacheService) {
                    this.cacheService = cacheService;
                }

                // 自定义PURGE方法 - 清除缓存
                @CustomHttpMethod(method = "PURGE")
                @Status(HttpStatus.NO_CONTENT)
                public void purgeCache(
                    @QueryValue String key,
                    @QueryValue(defaultValue = "false") boolean pattern) {
                    if (pattern) {
                        System.out.println("PURGE /api/cache?key=" + key + "&pattern=true (模式匹配)");
                        cacheService.invalidatePattern(key);
                    } else {
                        System.out.println("PURGE /api/cache?key=" + key + " (精确匹配)");
                        cacheService.invalidate(key);
                    }
                }

                // 自定义LOCK方法 - 锁定资源
                @CustomHttpMethod(method = "LOCK", value = "/{resource}")
                public LockResponse lockResource(
                    String resource,
                    @Body LockRequest request) {
                    System.out.println("LOCK /api/cache/" + resource +
                                     " - 超时: " + request.getTimeout() + "秒");
                    String lockToken = cacheService.acquireLock(
                        resource,
                        request.getTimeout()
                    );
                    return new LockResponse(lockToken, resource, request.getTimeout());
                }

                // 自定义UNLOCK方法 - 解锁资源
                @CustomHttpMethod(method = "UNLOCK", value = "/{resource}")
                @Status(HttpStatus.NO_CONTENT)
                public void unlockResource(
                    String resource,
                    @Header("Lock-Token") String lockToken) {
                    System.out.println("UNLOCK /api/cache/" + resource +
                                     " - Token: " + lockToken);
                    boolean released = cacheService.releaseLock(resource, lockToken);
                    if (!released) {
                        throw new IllegalStateException("无效的锁令牌");
                    }
                }

                // 自定义REFRESH方法 - 刷新缓存
                @CustomHttpMethod(method = "REFRESH", value = "/{key}")
                public RefreshResponse refreshCache(String key) {
                    System.out.println("REFRESH /api/cache/" + key);
                    Object value = cacheService.refresh(key);
                    return new RefreshResponse(key, value != null,
                                              value != null ? "刷新成功" : "缓存未命中");
                }
            }

            // 锁请求对象
            public class LockRequest {
                private int timeout = 30; // 默认30秒
                private String owner;

                // Getter和Setter
                public int getTimeout() { return timeout; }
                public void setTimeout(int timeout) { this.timeout = timeout; }
                public String getOwner() { return owner; }
                public void setOwner(String owner) { this.owner = owner; }
            }

            // 锁响应对象
            public class LockResponse {
                private String token;
                private String resource;
                private int timeout;
                private long expiresAt;

                public LockResponse(String token, String resource, int timeout) {
                    this.token = token;
                    this.resource = resource;
                    this.timeout = timeout;
                    this.expiresAt = System.currentTimeMillis() + timeout * 1000;
                }

                // Getter省略
            }

            // 刷新响应对象
            public class RefreshResponse {
                private String key;
                private boolean success;
                private String message;

                public RefreshResponse(String key, boolean success, String message) {
                    this.key = key;
                    this.success = success;
                    this.message = message;
                }

                // Getter省略
            }

            // 使用示例
            // PURGE /api/cache?key=user:123
            // PURGE /api/cache?key=user:*&pattern=true
            // LOCK /api/cache/report-2024 (Body: {"timeout": 60, "owner": "job-123"})
            // UNLOCK /api/cache/report-2024 (Header: Lock-Token: abc123def456)
            // REFRESH /api/cache/statistics
            ---

04.路由版本控制
    a.URI路径版本
        a.版本路径设计
            在URI路径中包含版本号,如/api/v1/users、/api/v2/users,通过不同的控制器类或方法处理不同版本的API请求,实现版本隔离和独立演进。
        b.版本路径示例
            ---
            // V1版本 - 原始用户API
            @Controller("/api/v1/users")
            public class UserControllerV1 {
                private final UserService userService;

                public UserControllerV1(UserService userService) {
                    this.userService = userService;
                }

                @Get("/{id}")
                public UserV1Response getUser(Long id) {
                    System.out.println("API v1: GET /api/v1/users/" + id);
                    User user = userService.findById(id);
                    // V1响应格式: 简单字段
                    return new UserV1Response(
                        user.getId(),
                        user.getUsername(),
                        user.getEmail()
                    );
                }

                @Post
                public UserV1Response createUser(@Body UserV1Request request) {
                    System.out.println("API v1: POST /api/v1/users");
                    User user = userService.create(request);
                    return new UserV1Response(
                        user.getId(),
                        user.getUsername(),
                        user.getEmail()
                    );
                }
            }

            // V2版本 - 增强的用户API
            @Controller("/api/v2/users")
            public class UserControllerV2 {
                private final UserService userService;

                public UserControllerV2(UserService userService) {
                    this.userService = userService;
                }

                @Get("/{id}")
                public UserV2Response getUser(
                    Long id,
                    @QueryValue(defaultValue = "false") boolean includeProfile) {
                    System.out.println("API v2: GET /api/v2/users/" + id +
                                     " - includeProfile=" + includeProfile);
                    User user = userService.findById(id);
                    // V2响应格式: 增强字段和可选信息
                    UserV2Response response = new UserV2Response(
                        user.getId(),
                        user.getUsername(),
                        user.getEmail(),
                        user.getCreatedAt(),
                        user.getStatus()
                    );
                    if (includeProfile) {
                        response.setProfile(user.getProfile());
                    }
                    return response;
                }

                @Post
                public UserV2Response createUser(@Body UserV2Request request) {
                    System.out.println("API v2: POST /api/v2/users (支持更多字段)");
                    // V2请求支持额外字段: profile, preferences
                    User user = userService.createWithProfile(request);
                    return new UserV2Response(
                        user.getId(),
                        user.getUsername(),
                        user.getEmail(),
                        user.getCreatedAt(),
                        user.getStatus()
                    );
                }

                // V2新增功能: 批量操作
                @Post("/batch")
                public BatchResponse<UserV2Response> batchCreate(
                    @Body List<UserV2Request> requests) {
                    System.out.println("API v2: POST /api/v2/users/batch - " +
                                     requests.size() + "个用户");
                    List<User> users = userService.batchCreate(requests);
                    List<UserV2Response> responses = users.stream()
                        .map(u -> new UserV2Response(
                            u.getId(), u.getUsername(), u.getEmail(),
                            u.getCreatedAt(), u.getStatus()))
                        .collect(Collectors.toList());
                    return new BatchResponse<>(responses.size(), responses);
                }
            }

            // API版本对比
            // V1: GET /api/v1/users/123 → 返回基本信息(id, username, email)
            // V2: GET /api/v2/users/123 → 返回增强信息(id, username, email, createdAt, status)
            // V2: GET /api/v2/users/123?includeProfile=true → 返回完整信息(包含profile)
            // V2: POST /api/v2/users/batch → 批量创建(V1不支持)
            ---
    b.请求头版本控制
        a.版本协商
            通过自定义请求头(如Accept-Version或X-API-Version)传递版本信息,服务端根据版本号路由到对应的处理逻辑,保持URL统一。
        b.版本头示例
            ---
            import io.micronaut.http.annotation.Header;

            @Controller("/api/products")
            public class VersionedProductController {
                private final ProductService productService;

                public VersionedProductController(ProductService productService) {
                    this.productService = productService;
                }

                // 默认版本(无版本头或版本1)
                @Get("/{id}")
                public HttpResponse<?> getProduct(
                    Long id,
                    @Header(value = "Accept-Version", defaultValue = "1") String version) {

                    System.out.println("GET /api/products/" + id + " - 版本: " + version);

                    Product product = productService.findById(id);

                    switch (version) {
                        case "1":
                            // V1: 基本产品信息
                            return HttpResponse.ok(new ProductV1Response(
                                product.getId(),
                                product.getName(),
                                product.getPrice()
                            ));

                        case "2":
                            // V2: 增加库存和描述
                            return HttpResponse.ok(new ProductV2Response(
                                product.getId(),
                                product.getName(),
                                product.getPrice(),
                                product.getStock(),
                                product.getDescription()
                            ));

                        case "3":
                            // V3: 增加评分和图片
                            return HttpResponse.ok(new ProductV3Response(
                                product.getId(),
                                product.getName(),
                                product.getPrice(),
                                product.getStock(),
                                product.getDescription(),
                                product.getRating(),
                                product.getImages()
                            ));

                        default:
                            return HttpResponse.badRequest(
                                new ErrorResponse("UNSUPPORTED_VERSION",
                                                "不支持的API版本: " + version)
                            );
                    }
                }

                // 创建产品 - 根据版本接受不同的请求格式
                @Post
                public HttpResponse<?> createProduct(
                    @Header(value = "Accept-Version", defaultValue = "1") String version,
                    @Body String body) {

                    System.out.println("POST /api/products - 版本: " + version);

                    try {
                        switch (version) {
                            case "1":
                                ProductV1Request reqV1 =
                                    objectMapper.readValue(body, ProductV1Request.class);
                                Product p1 = productService.create(reqV1);
                                return HttpResponse.created(new ProductV1Response(
                                    p1.getId(), p1.getName(), p1.getPrice()
                                ));

                            case "2":
                                ProductV2Request reqV2 =
                                    objectMapper.readValue(body, ProductV2Request.class);
                                Product p2 = productService.createWithDetails(reqV2);
                                return HttpResponse.created(new ProductV2Response(
                                    p2.getId(), p2.getName(), p2.getPrice(),
                                    p2.getStock(), p2.getDescription()
                                ));

                            case "3":
                                ProductV3Request reqV3 =
                                    objectMapper.readValue(body, ProductV3Request.class);
                                Product p3 = productService.createWithMedia(reqV3);
                                return HttpResponse.created(new ProductV3Response(
                                    p3.getId(), p3.getName(), p3.getPrice(),
                                    p3.getStock(), p3.getDescription(),
                                    p3.getRating(), p3.getImages()
                                ));

                            default:
                                return HttpResponse.badRequest(
                                    new ErrorResponse("UNSUPPORTED_VERSION",
                                                    "不支持的API版本: " + version)
                                );
                        }
                    } catch (Exception e) {
                        return HttpResponse.serverError(
                            new ErrorResponse("PARSE_ERROR", e.getMessage())
                        );
                    }
                }
            }

            // 使用示例
            // curl -H "Accept-Version: 1" http://localhost:8080/api/products/123
            // 返回: {"id": 123, "name": "商品名", "price": 99.99}

            // curl -H "Accept-Version: 2" http://localhost:8080/api/products/123
            // 返回: {"id": 123, "name": "商品名", "price": 99.99, "stock": 100, "description": "..."}

            // curl -H "Accept-Version: 3" http://localhost:8080/api/products/123
            // 返回: {"id": 123, "name": "商品名", "price": 99.99, "stock": 100,
            //       "description": "...", "rating": 4.5, "images": ["url1", "url2"]}

            // 无版本头或默认版本1
            // curl http://localhost:8080/api/products/123
            // 返回: {"id": 123, "name": "商品名", "price": 99.99}
            ---

4.3 参数绑定

01.查询参数绑定
    a.@QueryValue基础
        a.查询参数映射
            @QueryValue注解将URL查询参数绑定到方法参数,支持基本类型、包装类型、字符串、日期等多种类型的自动转换。框架会自动解析URL中?后的参数,按名称匹配到方法参数,并进行类型转换和验证。
        b.基础查询参数示例
            ---
            import io.micronaut.http.annotation.*;
            import io.micronaut.core.annotation.Nullable;

            @Controller("/api/search")
            public class SearchController {
                private final ProductService productService;

                public SearchController(ProductService productService) {
                    this.productService = productService;
                }

                // 必需查询参数
                @Get
                public List<Product> search(@QueryValue String keyword) {
                    // GET /api/search?keyword=手机
                    System.out.println("搜索关键词: " + keyword);
                    return productService.search(keyword);
                }

                // 可选查询参数 - 使用@Nullable
                @Get("/optional")
                public List<Product> searchOptional(
                    @QueryValue @Nullable String keyword,
                    @QueryValue @Nullable String category) {
                    // GET /api/search/optional?keyword=手机
                    // GET /api/search/optional?keyword=手机&category=电子
                    // GET /api/search/optional (两个参数都是null)

                    System.out.println("关键词: " + (keyword != null ? keyword : "全部"));
                    System.out.println("分类: " + (category != null ? category : "全部"));

                    if (keyword == null && category == null) {
                        return productService.findAll();
                    } else if (keyword != null && category != null) {
                        return productService.searchByKeywordAndCategory(keyword, category);
                    } else if (keyword != null) {
                        return productService.search(keyword);
                    } else {
                        return productService.findByCategory(category);
                    }
                }

                // 带默认值的查询参数
                @Get("/paginated")
                public List<Product> searchPaginated(
                    @QueryValue(defaultValue = "") String keyword,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size,
                    @QueryValue(defaultValue = "id") String sortBy,
                    @QueryValue(defaultValue = "asc") String order) {

                    // GET /api/search/paginated?keyword=手机
                    // 使用默认值: page=0, size=20, sortBy=id, order=asc

                    System.out.println("搜索参数:");
                    System.out.println("  关键词: " + keyword);
                    System.out.println("  页码: " + page);
                    System.out.println("  每页: " + size);
                    System.out.println("  排序: " + sortBy + " " + order);

                    return productService.search(keyword, page, size, sortBy, order);
                }

                // 重命名查询参数 - 参数名与方法参数名不同
                @Get("/renamed")
                public List<Product> searchRenamed(
                    @QueryValue("q") String keyword,
                    @QueryValue("cat") @Nullable String category,
                    @QueryValue("p") int page) {

                    // GET /api/search/renamed?q=手机&cat=电子&p=1
                    System.out.println("q=" + keyword + ", cat=" + category + ", p=" + page);
                    return productService.search(keyword, category, page);
                }
            }

            // URL示例
            // GET /api/search?keyword=手机
            // GET /api/search/optional (返回全部)
            // GET /api/search/optional?keyword=手机
            // GET /api/search/paginated?keyword=手机&page=2&size=50
            // GET /api/search/renamed?q=laptop&cat=electronics&p=0
            ---
    b.复杂类型查询参数
        a.集合参数绑定
            使用List或数组接收同名的多个查询参数值,实现多选过滤、标签筛选等功能。框架自动将所有同名参数聚合为集合类型,便于处理批量条件。
        b.复杂类型示例
            ---
            import java.time.LocalDate;
            import java.time.LocalDateTime;
            import java.math.BigDecimal;
            import io.micronaut.core.convert.format.Format;

            @Controller("/api/products")
            public class ProductQueryController {
                private final ProductService productService;

                public ProductQueryController(ProductService productService) {
                    this.productService = productService;
                }

                // 多值参数 - List接收
                @Get("/filter")
                public List<Product> filterByTags(
                    @QueryValue("tag") List<String> tags,
                    @QueryValue("status") List<String> statuses) {

                    // GET /api/products/filter?tag=hot&tag=new&tag=featured&status=active&status=promoted
                    System.out.println("标签: " + tags);  // [hot, new, featured]
                    System.out.println("状态: " + statuses);  // [active, promoted]

                    return productService.filterByTagsAndStatuses(tags, statuses);
                }

                // 日期参数 - 使用@Format指定格式
                @Get("/by-date")
                public List<Product> findByDate(
                    @QueryValue @Format("yyyy-MM-dd") LocalDate startDate,
                    @QueryValue @Format("yyyy-MM-dd") LocalDate endDate) {

                    // GET /api/products/by-date?startDate=2024-01-01&endDate=2024-12-31
                    System.out.println("日期范围: " + startDate + " 至 " + endDate);
                    return productService.findByDateRange(startDate, endDate);
                }

                // 日期时间参数 - ISO 8601格式
                @Get("/by-datetime")
                public List<Product> findByDateTime(
                    @QueryValue @Format("yyyy-MM-dd'T'HH:mm:ss") LocalDateTime start,
                    @QueryValue @Format("yyyy-MM-dd'T'HH:mm:ss") LocalDateTime end) {

                    // GET /api/products/by-datetime?start=2024-01-01T00:00:00&end=2024-12-31T23:59:59
                    System.out.println("时间范围: " + start + " 至 " + end);
                    return productService.findByDateTimeRange(start, end);
                }

                // 数值范围参数 - BigDecimal精确计算
                @Get("/by-price")
                public List<Product> findByPriceRange(
                    @QueryValue @Nullable BigDecimal minPrice,
                    @QueryValue @Nullable BigDecimal maxPrice) {

                    // GET /api/products/by-price?minPrice=100.00&maxPrice=999.99
                    System.out.println("价格范围: " + minPrice + " - " + maxPrice);

                    if (minPrice != null && maxPrice != null) {
                        return productService.findByPriceRange(minPrice, maxPrice);
                    } else if (minPrice != null) {
                        return productService.findByMinPrice(minPrice);
                    } else if (maxPrice != null) {
                        return productService.findByMaxPrice(maxPrice);
                    } else {
                        return productService.findAll();
                    }
                }

                // 枚举参数 - 自动转换
                @Get("/by-status")
                public List<Product> findByStatus(
                    @QueryValue ProductStatus status,
                    @QueryValue(defaultValue = "false") boolean includeDeleted) {

                    // GET /api/products/by-status?status=ACTIVE&includeDeleted=true
                    System.out.println("状态: " + status);  // ACTIVE枚举值
                    System.out.println("包含已删除: " + includeDeleted);

                    return productService.findByStatus(status, includeDeleted);
                }

                // Boolean参数 - 多种格式支持
                @Get("/flags")
                public List<Product> findWithFlags(
                    @QueryValue(defaultValue = "false") boolean inStock,
                    @QueryValue(defaultValue = "false") boolean onSale,
                    @QueryValue(defaultValue = "true") boolean published) {

                    // GET /api/products/flags?inStock=true&onSale=1&published=yes
                    // 支持: true/false, 1/0, yes/no, on/off
                    System.out.println("有货: " + inStock);
                    System.out.println("促销: " + onSale);
                    System.out.println("已发布: " + published);

                    return productService.findWithFlags(inStock, onSale, published);
                }

                // 高级搜索 - 组合多种类型
                @Get("/advanced-search")
                public List<Product> advancedSearch(
                    @QueryValue @Nullable String keyword,
                    @QueryValue("category") @Nullable List<String> categories,
                    @QueryValue @Nullable BigDecimal minPrice,
                    @QueryValue @Nullable BigDecimal maxPrice,
                    @QueryValue @Format("yyyy-MM-dd") @Nullable LocalDate startDate,
                    @QueryValue @Format("yyyy-MM-dd") @Nullable LocalDate endDate,
                    @QueryValue("tag") @Nullable List<String> tags,
                    @QueryValue(defaultValue = "ACTIVE") ProductStatus status,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {

                    System.out.println("=== 高级搜索参数 ===");
                    System.out.println("关键词: " + keyword);
                    System.out.println("分类: " + categories);
                    System.out.println("价格区间: " + minPrice + " - " + maxPrice);
                    System.out.println("日期区间: " + startDate + " - " + endDate);
                    System.out.println("标签: " + tags);
                    System.out.println("状态: " + status);
                    System.out.println("分页: page=" + page + ", size=" + size);

                    SearchCriteria criteria = new SearchCriteria();
                    criteria.setKeyword(keyword);
                    criteria.setCategories(categories);
                    criteria.setMinPrice(minPrice);
                    criteria.setMaxPrice(maxPrice);
                    criteria.setStartDate(startDate);
                    criteria.setEndDate(endDate);
                    criteria.setTags(tags);
                    criteria.setStatus(status);

                    return productService.advancedSearch(criteria, page, size);
                }
            }

            // 枚举定义
            public enum ProductStatus {
                DRAFT,      // 草稿
                ACTIVE,     // 激活
                INACTIVE,   // 未激活
                DELETED     // 已删除
            }

            // URL示例
            // GET /api/products/filter?tag=hot&tag=new&status=active&status=promoted
            // GET /api/products/by-date?startDate=2024-01-01&endDate=2024-12-31
            // GET /api/products/by-price?minPrice=99.99&maxPrice=999.99
            // GET /api/products/by-status?status=ACTIVE&includeDeleted=false
            // GET /api/products/advanced-search?keyword=手机&category=电子&category=数码&minPrice=1000&tag=5G&tag=旗舰
            ---

02.路径参数绑定
    a.路径变量提取
        a.路径参数映射
            路径中{}定义的变量自动绑定到同名方法参数,框架负责类型转换和验证。支持基本类型、包装类型、字符串、UUID等类型,转换失败时返回400 Bad Request错误。
        b.路径参数示例
            ---
            import java.util.UUID;

            @Controller("/api")
            public class PathVariableController {
                private final ResourceService resourceService;

                public PathVariableController(ResourceService resourceService) {
                    this.resourceService = resourceService;
                }

                // Long类型路径参数
                @Get("/users/{id}")
                public User getUser(Long id) {
                    // GET /api/users/123
                    System.out.println("用户ID: " + id);
                    return resourceService.findUserById(id);
                }

                // String类型路径参数
                @Get("/users/username/{username}")
                public User getUserByUsername(String username) {
                    // GET /api/users/username/john_doe
                    System.out.println("用户名: " + username);
                    return resourceService.findUserByUsername(username);
                }

                // UUID类型路径参数
                @Get("/orders/{orderId}")
                public Order getOrder(UUID orderId) {
                    // GET /api/orders/550e8400-e29b-41d4-a716-446655440000
                    System.out.println("订单UUID: " + orderId);
                    return resourceService.findOrderByUUID(orderId);
                }

                // 多个路径参数
                @Get("/users/{userId}/posts/{postId}")
                public Post getUserPost(Long userId, Long postId) {
                    // GET /api/users/123/posts/456
                    System.out.println("用户ID: " + userId + ", 文章ID: " + postId);
                    return resourceService.findPostByUserAndId(userId, postId);
                }

                // 路径参数 + 查询参数组合
                @Get("/categories/{category}/products/{productId}")
                public Product getProduct(
                    String category,
                    Long productId,
                    @QueryValue(defaultValue = "false") boolean includeReviews) {

                    // GET /api/categories/electronics/products/789?includeReviews=true
                    System.out.println("分类: " + category);
                    System.out.println("产品ID: " + productId);
                    System.out.println("包含评论: " + includeReviews);

                    Product product = resourceService.findProduct(category, productId);
                    if (includeReviews) {
                        product.setReviews(resourceService.getProductReviews(productId));
                    }
                    return product;
                }

                // 正则表达式约束的路径参数
                @Get("/posts/{slug:[a-z0-9-]+}")
                public Post getPostBySlug(String slug) {
                    // GET /api/posts/my-first-blog-post
                    // 只匹配小写字母、数字、连字符
                    System.out.println("文章标识: " + slug);
                    return resourceService.findPostBySlug(slug);
                }

                // 日期格式路径参数
                @Get("/reports/{date}")
                public Report getReport(
                    @Format("yyyy-MM-dd") LocalDate date) {

                    // GET /api/reports/2024-01-15
                    System.out.println("报表日期: " + date);
                    return resourceService.generateReport(date);
                }

                // 可选路径段
                @Get("/search{/keyword}")
                public List<Article> search(@Nullable String keyword) {
                    // GET /api/search → keyword=null
                    // GET /api/search/java → keyword="java"

                    if (keyword == null) {
                        System.out.println("搜索: 全部文章");
                        return resourceService.findAllArticles();
                    } else {
                        System.out.println("搜索关键词: " + keyword);
                        return resourceService.searchArticles(keyword);
                    }
                }
            }

            // URL示例
            // GET /api/users/123
            // GET /api/users/username/alice
            // GET /api/orders/550e8400-e29b-41d4-a716-446655440000
            // GET /api/users/100/posts/500
            // GET /api/categories/books/products/999?includeReviews=true
            // GET /api/posts/hello-world
            // GET /api/reports/2024-12-25
            // GET /api/search
            // GET /api/search/spring-boot
            ---
    b.路径参数验证
        a.类型转换与约束
            路径参数自动进行类型转换,转换失败返回400错误。可以使用正则表达式约束路径格式,在路由层面实现输入验证,提前拦截非法请求,减轻业务层压力。
        b.参数验证示例
            ---
            import jakarta.validation.constraints.*;

            @Controller("/api/validated")
            public class ValidatedPathController {
                private final ValidationService validationService;

                public ValidatedPathController(ValidationService validationService) {
                    this.validationService = validationService;
                }

                // 正则约束 - 只接受数字ID
                @Get("/users/{id:[0-9]+}")
                public User getUserById(Long id) {
                    // GET /api/validated/users/123 ✓
                    // GET /api/validated/users/abc → 404 Not Found
                    System.out.println("数字ID: " + id);
                    return validationService.findUser(id);
                }

                // 正则约束 - 用户名格式
                @Get("/users/{username:[a-zA-Z0-9_]{3,20}}")
                public User getUserByUsername(String username) {
                    // 用户名: 3-20个字符,只能包含字母、数字、下划线
                    // GET /api/validated/users/john_doe ✓
                    // GET /api/validated/users/ab → 404 (太短)
                    // GET /api/validated/users/user@123 → 404 (包含非法字符)
                    System.out.println("合法用户名: " + username);
                    return validationService.findUserByUsername(username);
                }

                // 正则约束 - 邮箱格式
                @Get("/verify/{email:.+@.+\\..+}")
                public VerificationResult verifyEmail(String email) {
                    // GET /api/validated/verify/user@example.com ✓
                    // GET /api/validated/verify/invalid-email → 404
                    System.out.println("邮箱: " + email);
                    return validationService.verifyEmail(email);
                }

                // 正则约束 - 日期格式 YYYY-MM-DD
                @Get("/orders/{date:\\d{4}-\\d{2}-\\d{2}}")
                public List<Order> getOrdersByDate(
                    @Format("yyyy-MM-dd") LocalDate date) {

                    // GET /api/validated/orders/2024-01-15 ✓
                    // GET /api/validated/orders/2024-1-5 → 404 (格式不对)
                    System.out.println("订单日期: " + date);
                    return validationService.findOrdersByDate(date);
                }

                // 正则约束 - 手机号格式
                @Get("/sms/{phone:1[3-9]\\d{9}}")
                public SmsResult sendSms(String phone) {
                    // 中国手机号: 1开头,第二位3-9,共11位
                    // GET /api/validated/sms/13812345678 ✓
                    // GET /api/validated/sms/12812345678 → 404 (第二位不对)
                    // GET /api/validated/sms/138123456 → 404 (位数不够)
                    System.out.println("手机号: " + phone);
                    return validationService.sendSms(phone);
                }

                // 正则约束 - 产品代码格式
                @Get("/products/{code:[A-Z]{2}\\d{6}}")
                public Product getProductByCode(String code) {
                    // 产品代码: 2个大写字母 + 6个数字
                    // GET /api/validated/products/AB123456 ✓
                    // GET /api/validated/products/ab123456 → 404 (小写)
                    // GET /api/validated/products/ABC12345 → 404 (格式不对)
                    System.out.println("产品代码: " + code);
                    return validationService.findProductByCode(code);
                }

                // 多路径参数组合验证
                @Get("/transactions/{year:\\d{4}}/{month:0[1-9]|1[0-2]}/{id:[0-9]+}")
                public Transaction getTransaction(int year, int month, Long id) {
                    // year: 4位数字
                    // month: 01-12
                    // id: 纯数字
                    // GET /api/validated/transactions/2024/03/12345 ✓
                    // GET /api/validated/transactions/2024/13/12345 → 404 (月份超范围)
                    System.out.println("交易: " + year + "年" + month + "月, ID=" + id);
                    return validationService.findTransaction(year, month, id);
                }
            }

            // 路由匹配示例
            // ✓ GET /api/validated/users/123
            // ✗ GET /api/validated/users/abc (404 - 不是数字)
            // ✓ GET /api/validated/users/john_doe
            // ✗ GET /api/validated/users/ab (404 - 太短)
            // ✓ GET /api/validated/verify/user@example.com
            // ✗ GET /api/validated/verify/notanemail (404 - 不是邮箱格式)
            // ✓ GET /api/validated/orders/2024-01-15
            // ✗ GET /api/validated/orders/2024-1-5 (404 - 日期格式错误)
            // ✓ GET /api/validated/sms/13812345678
            // ✗ GET /api/validated/sms/12345678901 (404 - 不是合法手机号)
            ---

03.请求头绑定
    a.@Header注解
        a.请求头访问
            @Header注解绑定HTTP请求头到方法参数,用于获取认证信息、客户端元数据、自定义业务参数等。支持必需请求头和可选请求头,可以设置默认值。
        b.请求头示例
            ---
            @Controller("/api/secure")
            public class HeaderBindingController {
                private final AuthService authService;
                private final ContentService contentService;

                public HeaderBindingController(AuthService authService,
                                              ContentService contentService) {
                    this.authService = authService;
                    this.contentService = contentService;
                }

                // 必需请求头 - Authorization
                @Get("/profile")
                public UserProfile getProfile(@Header String authorization) {
                    // curl -H "Authorization: Bearer eyJhbGc..." http://localhost:8080/api/secure/profile
                    System.out.println("Authorization: " + authorization);

                    // 解析Bearer Token
                    String token = authorization.replace("Bearer ", "");
                    Long userId = authService.getUserIdFromToken(token);

                    return contentService.getUserProfile(userId);
                }

                // 可选请求头 - Accept-Language
                @Get("/content")
                public Content getContent(
                    @Header("Accept-Language") @Nullable String language,
                    @Header("User-Agent") @Nullable String userAgent) {

                    // curl -H "Accept-Language: zh-CN" -H "User-Agent: Mozilla/5.0..." \
                    //      http://localhost:8080/api/secure/content

                    String lang = language != null ? language : "en";
                    System.out.println("语言: " + lang);
                    System.out.println("客户端: " + userAgent);

                    return contentService.getLocalizedContent(lang);
                }

                // 带默认值的请求头
                @Get("/api-call")
                public ApiResponse callApi(
                    @Header("X-API-Key") String apiKey,
                    @Header(value = "X-Request-Id", defaultValue = "") String requestId,
                    @Header(value = "X-Trace-Id", defaultValue = "none") String traceId) {

                    // curl -H "X-API-Key: abc123" -H "X-Request-Id: req-001" \
                    //      http://localhost:8080/api/secure/api-call

                    System.out.println("API密钥: " + apiKey);
                    System.out.println("请求ID: " + requestId);
                    System.out.println("追踪ID: " + traceId);

                    return contentService.performApiCall(apiKey, requestId, traceId);
                }

                // 自定义业务请求头
                @Post("/upload")
                public UploadResponse upload(
                    @Body byte[] data,
                    @Header("X-File-Name") String fileName,
                    @Header("X-File-Type") String fileType,
                    @Header("X-File-Size") long fileSize,
                    @Header(value = "X-Checksum", defaultValue = "") String checksum) {

                    // curl -X POST -H "X-File-Name: document.pdf" \
                    //      -H "X-File-Type: application/pdf" \
                    //      -H "X-File-Size: 1024000" \
                    //      -H "X-Checksum: md5hash..." \
                    //      --data-binary @document.pdf \
                    //      http://localhost:8080/api/secure/upload

                    System.out.println("文件名: " + fileName);
                    System.out.println("文件类型: " + fileType);
                    System.out.println("文件大小: " + fileSize + " bytes");
                    System.out.println("校验和: " + checksum);

                    // 验证校验和
                    if (!checksum.isEmpty()) {
                        String actualChecksum = contentService.calculateChecksum(data);
                        if (!actualChecksum.equals(checksum)) {
                            throw new IllegalArgumentException("文件校验和不匹配");
                        }
                    }

                    String fileId = contentService.saveFile(fileName, fileType, data);
                    return new UploadResponse(fileId, fileName, fileSize);
                }

                // 多租户请求头
                @Get("/tenant-data")
                public TenantData getTenantData(
                    @Header("X-Tenant-Id") String tenantId,
                    @Header("X-User-Id") Long userId,
                    @Header(value = "X-Org-Id", defaultValue = "default") String orgId) {

                    // curl -H "X-Tenant-Id: tenant-123" \
                    //      -H "X-User-Id: 456" \
                    //      -H "X-Org-Id: org-789" \
                    //      http://localhost:8080/api/secure/tenant-data

                    System.out.println("租户ID: " + tenantId);
                    System.out.println("用户ID: " + userId);
                    System.out.println("组织ID: " + orgId);

                    return contentService.getTenantData(tenantId, userId, orgId);
                }

                // 访问所有请求头 - HttpHeaders对象
                @Get("/all-headers")
                public Map<String, String> getAllHeaders(HttpHeaders headers) {
                    Map<String, String> result = new LinkedHashMap<>();

                    for (String name : headers.names()) {
                        result.put(name, headers.get(name));
                    }

                    System.out.println("接收到 " + result.size() + " 个请求头");
                    for (Map.Entry<String, String> entry : result.entrySet()) {
                        System.out.println("  " + entry.getKey() + ": " + entry.getValue());
                    }

                    return result;
                }

                // 条件化处理 - 根据请求头选择处理逻辑
                @Get("/content-negotiation")
                public HttpResponse<?> getContentNegotiation(
                    @Header("Accept") String accept,
                    @Header(value = "Accept-Encoding", defaultValue = "identity") String encoding) {

                    // curl -H "Accept: application/json" http://localhost:8080/api/secure/content-negotiation
                    // curl -H "Accept: application/xml" http://localhost:8080/api/secure/content-negotiation

                    System.out.println("Accept: " + accept);
                    System.out.println("Accept-Encoding: " + encoding);

                    Object data = contentService.getData();

                    if (accept.contains("application/json")) {
                        return HttpResponse.ok(data)
                            .contentType(MediaType.APPLICATION_JSON);
                    } else if (accept.contains("application/xml")) {
                        String xml = contentService.toXml(data);
                        return HttpResponse.ok(xml)
                            .contentType(MediaType.APPLICATION_XML);
                    } else if (accept.contains("text/plain")) {
                        String text = data.toString();
                        return HttpResponse.ok(text)
                            .contentType(MediaType.TEXT_PLAIN);
                    } else {
                        return HttpResponse.notAcceptable();
                    }
                }
            }

            // curl示例
            // curl -H "Authorization: Bearer token123" http://localhost:8080/api/secure/profile
            // curl -H "Accept-Language: zh-CN" http://localhost:8080/api/secure/content
            // curl -H "X-API-Key: key123" -H "X-Request-Id: req-001" http://localhost:8080/api/secure/api-call
            // curl -X POST -H "X-File-Name: doc.pdf" -H "X-File-Type: application/pdf" \
            //      --data-binary @doc.pdf http://localhost:8080/api/secure/upload
            ---

04.请求体绑定
    a.@Body对象绑定
        a.JSON反序列化
            @Body注解将请求体JSON自动反序列化为Java对象,支持简单对象、嵌套对象、泛型对象、集合类型的绑定。框架使用Jackson进行反序列化,自动处理日期格式、命名转换等。
        b.请求体绑定示例
            ---
            @Controller("/api/users")
            public class RequestBodyController {
                private final UserService userService;

                public RequestBodyController(UserService userService) {
                    this.userService = userService;
                }

                // 简单对象绑定
                @Post
                public User createUser(@Body User user) {
                    // POST /api/users
                    // Content-Type: application/json
                    // {"username": "john", "email": "john@example.com", "age": 30}

                    System.out.println("创建用户:");
                    System.out.println("  用户名: " + user.getUsername());
                    System.out.println("  邮箱: " + user.getEmail());
                    System.out.println("  年龄: " + user.getAge());

                    return userService.create(user);
                }

                // 嵌套对象绑定
                @Post("/register")
                public RegistrationResponse register(@Body RegistrationRequest request) {
                    // POST /api/users/register
                    // {
                    //   "username": "john",
                    //   "email": "john@example.com",
                    //   "password": "secret123",
                    //   "profile": {
                    //     "firstName": "John",
                    //     "lastName": "Doe",
                    //     "birthDate": "1990-01-15",
                    //     "address": {
                    //       "street": "123 Main St",
                    //       "city": "New York",
                    //       "zipCode": "10001"
                    //     }
                    //   },
                    //   "preferences": {
                    //     "language": "en",
                    //     "timezone": "America/New_York",
                    //     "notifications": true
                    //   }
                    // }

                    System.out.println("注册用户:");
                    System.out.println("  用户名: " + request.getUsername());
                    System.out.println("  邮箱: " + request.getEmail());
                    System.out.println("  姓名: " + request.getProfile().getFirstName() +
                                     " " + request.getProfile().getLastName());
                    System.out.println("  地址: " + request.getProfile().getAddress().getCity());
                    System.out.println("  语言: " + request.getPreferences().getLanguage());

                    User user = userService.register(request);
                    return new RegistrationResponse(user.getId(), "注册成功");
                }

                // 集合类型绑定 - List
                @Post("/batch")
                public BatchResponse<User> batchCreate(@Body List<User> users) {
                    // POST /api/users/batch
                    // [
                    //   {"username": "user1", "email": "user1@example.com"},
                    //   {"username": "user2", "email": "user2@example.com"},
                    //   {"username": "user3", "email": "user3@example.com"}
                    // ]

                    System.out.println("批量创建 " + users.size() + " 个用户");
                    for (int i = 0; i < users.size(); i++) {
                        System.out.println("  用户" + (i+1) + ": " + users.get(i).getUsername());
                    }

                    List<User> created = userService.batchCreate(users);
                    return new BatchResponse<>(created.size(), created);
                }

                // Map类型绑定 - 动态字段
                @Patch("/{id}")
                public User partialUpdate(Long id, @Body Map<String, Object> updates) {
                    // PATCH /api/users/123
                    // {
                    //   "email": "newemail@example.com",
                    //   "phone": "13900139000",
                    //   "profile.city": "Beijing"
                    // }

                    System.out.println("部分更新用户 " + id);
                    System.out.println("更新字段: " + updates.keySet());

                    User user = userService.findById(id);

                    // 应用更新
                    if (updates.containsKey("email")) {
                        user.setEmail((String) updates.get("email"));
                    }
                    if (updates.containsKey("phone")) {
                        user.setPhone((String) updates.get("phone"));
                    }
                    if (updates.containsKey("age")) {
                        user.setAge(((Number) updates.get("age")).intValue());
                    }

                    return userService.update(user);
                }

                // 泛型请求体绑定
                @Post("/action")
                public ActionResponse<User> performAction(@Body ActionRequest<User> request) {
                    // POST /api/users/action
                    // {
                    //   "action": "update",
                    //   "data": {"username": "john", "email": "john@example.com"},
                    //   "options": {"notify": true, "async": false}
                    // }

                    System.out.println("执行操作: " + request.getAction());
                    System.out.println("数据: " + request.getData().getUsername());
                    System.out.println("选项: " + request.getOptions());

                    User result = userService.performAction(request.getAction(), request.getData());
                    return new ActionResponse<>(request.getAction(), result, "操作成功");
                }

                // 可选请求体
                @Post("/search")
                public List<User> search(@Body @Nullable SearchCriteria criteria) {
                    // POST /api/users/search
                    // 可以不传请求体,或传递搜索条件

                    if (criteria == null) {
                        System.out.println("搜索: 返回所有用户");
                        return userService.findAll();
                    }

                    System.out.println("搜索条件:");
                    System.out.println("  关键词: " + criteria.getKeyword());
                    System.out.println("  状态: " + criteria.getStatus());

                    return userService.search(criteria);
                }
            }

            // 请求对象定义
            public class RegistrationRequest {
                private String username;
                private String email;
                private String password;
                private UserProfile profile;
                private UserPreferences preferences;

                // Getter和Setter省略
            }

            public class UserProfile {
                private String firstName;
                private String lastName;
                private LocalDate birthDate;
                private Address address;

                // Getter和Setter省略
            }

            public class Address {
                private String street;
                private String city;
                private String zipCode;

                // Getter和Setter省略
            }

            public class UserPreferences {
                private String language;
                private String timezone;
                private boolean notifications;

                // Getter和Setter省略
            }

            public class ActionRequest<T> {
                private String action;
                private T data;
                private Map<String, Object> options;

                // Getter和Setter省略
            }

            public class ActionResponse<T> {
                private String action;
                private T result;
                private String message;

                public ActionResponse(String action, T result, String message) {
                    this.action = action;
                    this.result = result;
                    this.message = message;
                }

                // Getter省略
            }

            // curl示例
            // curl -X POST -H "Content-Type: application/json" \
            //      -d '{"username":"john","email":"john@example.com","age":30}' \
            //      http://localhost:8080/api/users

            // curl -X PATCH -H "Content-Type: application/json" \
            //      -d '{"email":"newemail@example.com","phone":"13900139000"}' \
            //      http://localhost:8080/api/users/123
            ---

05.Cookie和表单绑定
    a.Cookie绑定
        a.@CookieValue注解
            @CookieValue注解绑定HTTP Cookie到方法参数,用于读取会话标识、用户偏好、记住登录状态等存储在Cookie中的数据。支持必需Cookie和可选Cookie,可以设置默认值。
        b.Cookie绑定示例
            ---
            import io.micronaut.http.annotation.CookieValue;
            import io.micronaut.http.cookie.Cookie;

            @Controller("/api")
            public class CookieController {
                private final SessionService sessionService;

                public CookieController(SessionService sessionService) {
                    this.sessionService = sessionService;
                }

                // 必需Cookie
                @Get("/session")
                public SessionInfo getSession(@CookieValue("SESSIONID") String sessionId) {
                    // Cookie: SESSIONID=abc123def456
                    System.out.println("会话ID: " + sessionId);
                    return sessionService.getSessionInfo(sessionId);
                }

                // 可选Cookie
                @Get("/preferences")
                public UserPreferences getPreferences(
                    @CookieValue("theme") @Nullable String theme,
                    @CookieValue("language") @Nullable String language) {

                    // Cookie: theme=dark; language=zh-CN
                    String userTheme = theme != null ? theme : "light";
                    String userLang = language != null ? language : "en";

                    System.out.println("主题: " + userTheme);
                    System.out.println("语言: " + userLang);

                    return new UserPreferences(userTheme, userLang);
                }

                // 带默认值的Cookie
                @Get("/settings")
                public Settings getSettings(
                    @CookieValue(value = "fontSize", defaultValue = "14") int fontSize,
                    @CookieValue(value = "autoSave", defaultValue = "true") boolean autoSave) {

                    System.out.println("字体大小: " + fontSize);
                    System.out.println("自动保存: " + autoSave);

                    return new Settings(fontSize, autoSave);
                }

                // 设置Cookie - 返回HttpResponse
                @Post("/login")
                public HttpResponse<LoginResponse> login(@Body LoginRequest request) {
                    String sessionId = sessionService.createSession(request.getUsername());

                    Cookie sessionCookie = Cookie.of("SESSIONID", sessionId)
                        .maxAge(Duration.ofHours(24))
                        .path("/")
                        .httpOnly(true)
                        .secure(true);

                    Cookie rememberMeCookie = Cookie.of("remember-me", "true")
                        .maxAge(Duration.ofDays(30))
                        .path("/");

                    return HttpResponse.ok(new LoginResponse("登录成功"))
                        .cookie(sessionCookie)
                        .cookie(rememberMeCookie);
                }

                // 删除Cookie
                @Post("/logout")
                public HttpResponse<Void> logout() {
                    // 设置maxAge为0删除Cookie
                    Cookie deleteCookie = Cookie.of("SESSIONID", "")
                        .maxAge(Duration.ZERO)
                        .path("/");

                    return HttpResponse.noContent()
                        .cookie(deleteCookie);
                }
            }

            // curl示例
            // curl -b "SESSIONID=abc123" http://localhost:8080/api/session
            // curl -b "theme=dark; language=zh-CN" http://localhost:8080/api/preferences
            // curl -X POST -H "Content-Type: application/json" \
            //      -d '{"username":"john","password":"secret"}' \
            //      http://localhost:8080/api/login
            ---
    b.表单数据绑定
        a.@Body表单绑定
            通过@Body绑定application/x-www-form-urlencoded格式的表单数据,自动将表单字段映射到对象属性或方法参数。支持嵌套对象和集合属性的表单提交。
        b.表单绑定示例
            ---
            import io.micronaut.http.annotation.Part;
            import io.micronaut.http.multipart.CompletedFileUpload;

            @Controller("/api/forms")
            public class FormController {
                private final FormService formService;

                public FormController(FormService formService) {
                    this.formService = formService;
                }

                // 表单字段绑定到对象
                @Post("/submit")
                @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
                public FormResponse submitForm(@Body ContactForm form) {
                    // POST /api/forms/submit
                    // Content-Type: application/x-www-form-urlencoded
                    // name=John+Doe&email=john%40example.com&message=Hello&subscribe=true

                    System.out.println("表单提交:");
                    System.out.println("  姓名: " + form.getName());
                    System.out.println("  邮箱: " + form.getEmail());
                    System.out.println("  消息: " + form.getMessage());
                    System.out.println("  订阅: " + form.isSubscribe());

                    formService.processContact(form);
                    return new FormResponse("表单已提交");
                }

                // 单文件上传
                @Post("/upload")
                @Consumes(MediaType.MULTIPART_FORM_DATA)
                public UploadResponse uploadFile(
                    @Part("file") CompletedFileUpload file,
                    @Part("description") @Nullable String description) throws IOException {

                    // POST /api/forms/upload
                    // Content-Type: multipart/form-data
                    // file=@document.pdf
                    // description=重要文档

                    System.out.println("文件上传:");
                    System.out.println("  文件名: " + file.getFilename());
                    System.out.println("  大小: " + file.getSize() + " bytes");
                    System.out.println("  类型: " + file.getContentType().orElse("unknown"));
                    System.out.println("  描述: " + description);

                    byte[] bytes = file.getBytes();
                    String fileId = formService.saveFile(file.getFilename(), bytes);

                    return new UploadResponse(fileId, file.getFilename(), file.getSize());
                }

                // 多文件上传
                @Post("/upload-multiple")
                @Consumes(MediaType.MULTIPART_FORM_DATA)
                public BatchUploadResponse uploadMultipleFiles(
                    @Part("files") List<CompletedFileUpload> files,
                    @Part("category") String category) throws IOException {

                    System.out.println("批量上传 " + files.size() + " 个文件, 分类: " + category);

                    List<String> fileIds = new ArrayList<>();
                    for (CompletedFileUpload file : files) {
                        System.out.println("  文件: " + file.getFilename() +
                                         " (" + file.getSize() + " bytes)");
                        byte[] bytes = file.getBytes();
                        String fileId = formService.saveFile(file.getFilename(), bytes);
                        fileIds.add(fileId);
                    }

                    return new BatchUploadResponse(fileIds.size(), fileIds);
                }

                // 混合表单数据和文件
                @Post("/submit-with-file")
                @Consumes(MediaType.MULTIPART_FORM_DATA)
                public SubmitResponse submitWithFile(
                    @Part("title") String title,
                    @Part("content") String content,
                    @Part("tags") List<String> tags,
                    @Part("attachment") @Nullable CompletedFileUpload attachment) throws IOException {

                    System.out.println("提交文章:");
                    System.out.println("  标题: " + title);
                    System.out.println("  内容: " + content);
                    System.out.println("  标签: " + tags);

                    String attachmentId = null;
                    if (attachment != null) {
                        System.out.println("  附件: " + attachment.getFilename());
                        byte[] bytes = attachment.getBytes();
                        attachmentId = formService.saveFile(attachment.getFilename(), bytes);
                    }

                    Long articleId = formService.createArticle(title, content, tags, attachmentId);
                    return new SubmitResponse(articleId, "文章已创建");
                }
            }

            // 表单对象定义
            public class ContactForm {
                private String name;
                private String email;
                private String message;
                private boolean subscribe;

                // Getter和Setter省略
            }

            // curl示例
            // curl -X POST -H "Content-Type: application/x-www-form-urlencoded" \
            //      -d "name=John Doe&email=john@example.com&message=Hello&subscribe=true" \
            //      http://localhost:8080/api/forms/submit

            // curl -X POST -F "file=@document.pdf" -F "description=重要文档" \
            //      http://localhost:8080/api/forms/upload

            // curl -X POST -F "files=@file1.pdf" -F "files=@file2.pdf" -F "category=documents" \
            //      http://localhost:8080/api/forms/upload-multiple

            // curl -X POST -F "title=文章标题" -F "content=文章内容" \
            //      -F "tags=java" -F "tags=micronaut" -F "attachment=@image.jpg" \
            //      http://localhost:8080/api/forms/submit-with-file
            ---

4.4 响应处理

01.响应类型
    a.直接返回对象
        a.自动序列化
            控制器方法直接返回Java对象时,框架自动将对象序列化为JSON格式响应,Content-Type默认为application/json。支持返回POJO、集合、Map等类型,使用Jackson或配置的序列化器进行转换。
        b.对象返回示例
            ---
            import io.micronaut.http.annotation.*;
            import java.util.*;

            @Controller("/api/data")
            public class DataResponseController {
                private final DataService dataService;

                public DataResponseController(DataService dataService) {
                    this.dataService = dataService;
                }

                // 返回单个对象
                @Get("/user/{id}")
                public User getUser(Long id) {
                    // GET /api/data/user/123
                    // 响应: {"id": 123, "username": "john", "email": "john@example.com"}
                    System.out.println("查询用户: " + id);
                    return dataService.findUserById(id);
                }

                // 返回List集合
                @Get("/users")
                public List<User> getUsers() {
                    // GET /api/data/users
                    // 响应: [{"id": 1, "username": "john"}, {"id": 2, "username": "jane"}]
                    System.out.println("查询所有用户");
                    return dataService.findAllUsers();
                }

                // 返回Map
                @Get("/statistics")
                public Map<String, Object> getStatistics() {
                    // GET /api/data/statistics
                    // 响应: {"total": 100, "active": 85, "inactive": 15, "ratio": 0.85}
                    Map<String, Object> stats = new HashMap<>();
                    stats.put("total", 100);
                    stats.put("active", 85);
                    stats.put("inactive", 15);
                    stats.put("ratio", 0.85);
                    return stats;
                }

                // 返回嵌套对象
                @Get("/order/{id}")
                public Order getOrder(Long id) {
                    // GET /api/data/order/456
                    // 响应包含嵌套的用户、商品、地址对象
                    System.out.println("查询订单: " + id);
                    return dataService.findOrderById(id);
                }

                // 返回分页对象
                @Get("/products")
                public Page<Product> getProducts(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    // GET /api/data/products?page=0&size=20
                    // 响应: {
                    //   "content": [...],
                    //   "page": 0,
                    //   "size": 20,
                    //   "totalElements": 150,
                    //   "totalPages": 8
                    // }
                    return dataService.findProducts(page, size);
                }
            }

            // 分页对象定义
            public class Page<T> {
                private List<T> content;
                private int page;
                private int size;
                private long totalElements;
                private int totalPages;

                public Page(List<T> content, int page, int size, long totalElements) {
                    this.content = content;
                    this.page = page;
                    this.size = size;
                    this.totalElements = totalElements;
                    this.totalPages = (int) Math.ceil((double) totalElements / size);
                }

                // Getter省略
            }
            ---
    b.HttpResponse返回
        a.完全控制响应
            返回HttpResponse对象可以完全控制响应内容、状态码、响应头、Cookie等,提供最灵活的响应定制能力。使用工厂方法快速构建标准HTTP响应。
        b.HttpResponse示例
            ---
            import io.micronaut.http.HttpResponse;
            import io.micronaut.http.MutableHttpResponse;
            import io.micronaut.http.MediaType;

            @Controller("/api/responses")
            public class HttpResponseController {
                private final ResponseService responseService;

                public HttpResponseController(ResponseService responseService) {
                    this.responseService = responseService;
                }

                // 200 OK响应
                @Get("/ok")
                public HttpResponse<Message> ok() {
                    Message message = new Message("操作成功");
                    return HttpResponse.ok(message);
                }

                // 201 Created响应 + Location头
                @Post("/users")
                public HttpResponse<User> createUser(@Body User user) {
                    User created = responseService.createUser(user);

                    return HttpResponse.created(created)
                        .header("Location", "/api/responses/users/" + created.getId())
                        .header("X-User-Id", created.getId().toString());
                }

                // 204 No Content响应
                @Delete("/users/{id}")
                public HttpResponse<Void> deleteUser(Long id) {
                    responseService.deleteUser(id);
                    // 返回204,没有响应体
                    return HttpResponse.noContent();
                }

                // 202 Accepted响应 - 异步任务
                @Post("/tasks")
                public HttpResponse<TaskResponse> submitTask(@Body TaskRequest request) {
                    String taskId = responseService.submitAsyncTask(request);

                    TaskResponse response = new TaskResponse(taskId, "任务已提交");
                    return HttpResponse.accepted()
                        .body(response)
                        .header("X-Task-Id", taskId)
                        .header("Location", "/api/responses/tasks/" + taskId);
                }

                // 404 Not Found响应
                @Get("/users/{id}")
                public HttpResponse<User> getUser(Long id) {
                    Optional<User> user = responseService.findUserById(id);

                    if (user.isPresent()) {
                        return HttpResponse.ok(user.get());
                    } else {
                        return HttpResponse.notFound();
                    }
                }

                // 400 Bad Request响应
                @Post("/validate")
                public HttpResponse<?> validate(@Body ValidationRequest request) {
                    List<String> errors = responseService.validate(request);

                    if (errors.isEmpty()) {
                        return HttpResponse.ok(new Message("验证通过"));
                    } else {
                        ErrorResponse error = new ErrorResponse(
                            "VALIDATION_ERROR",
                            "请求数据验证失败",
                            errors
                        );
                        return HttpResponse.badRequest(error);
                    }
                }

                // 自定义状态码
                @Get("/custom")
                public HttpResponse<Message> customStatus() {
                    return HttpResponse.status(HttpStatus.I_AM_A_TEAPOT)
                        .body(new Message("我是茶壶"));
                }

                // 构建复杂响应
                @Get("/download/{fileId}")
                public MutableHttpResponse<byte[]> downloadFile(String fileId) {
                    byte[] data = responseService.getFileData(fileId);
                    String fileName = responseService.getFileName(fileId);

                    return HttpResponse.ok(data)
                        .contentType(MediaType.APPLICATION_OCTET_STREAM)
                        .header("Content-Disposition",
                               "attachment; filename=\"" + fileName + "\"")
                        .header("Content-Length", String.valueOf(data.length))
                        .header("X-File-Id", fileId);
                }

                // 重定向响应
                @Get("/redirect")
                public HttpResponse<?> redirect() {
                    // 302临时重定向
                    return HttpResponse.redirect(URI.create("/api/responses/ok"));
                }

                @Get("/permanent-redirect")
                public HttpResponse<?> permanentRedirect() {
                    // 301永久重定向
                    return HttpResponse.permanentRedirect(URI.create("/api/responses/ok"));
                }
            }

            // 响应对象定义
            public class Message {
                private String message;
                private long timestamp;

                public Message(String message) {
                    this.message = message;
                    this.timestamp = System.currentTimeMillis();
                }

                // Getter省略
            }

            public class TaskResponse {
                private String taskId;
                private String message;
                private String status;

                public TaskResponse(String taskId, String message) {
                    this.taskId = taskId;
                    this.message = message;
                    this.status = "PENDING";
                }

                // Getter省略
            }

            public class ErrorResponse {
                private String code;
                private String message;
                private Object details;
                private long timestamp;

                public ErrorResponse(String code, String message, Object details) {
                    this.code = code;
                    this.message = message;
                    this.details = details;
                    this.timestamp = System.currentTimeMillis();
                }

                // Getter省略
            }
            ---
    c.响应式返���
        a.异步响应
            返回CompletableFuture、Publisher、Flux、Mono等响应式类型,支持流式响应和异步处理,提升高并发场景的性能,控制器方法立即返回。
        b.响应式示例
            ---
            import java.util.concurrent.CompletableFuture;
            import reactor.core.publisher.Flux;
            import reactor.core.publisher.Mono;
            import org.reactivestreams.Publisher;

            @Controller("/api/reactive")
            public class ReactiveResponseController {
                private final ReactiveService reactiveService;

                public ReactiveResponseController(ReactiveService reactiveService) {
                    this.reactiveService = reactiveService;
                }

                // CompletableFuture - 异步单个对象
                @Get("/user/{id}")
                public CompletableFuture<User> getUserAsync(Long id) {
                    // 异步查询用户,立即返回Future
                    System.out.println("异步查询用户: " + id);

                    return CompletableFuture.supplyAsync(() -> {
                        // 在后台线程执行
                        return reactiveService.findUserById(id);
                    });
                }

                // Mono - 单个元素的响应式流
                @Get("/order/{id}")
                public Mono<Order> getOrderMono(Long id) {
                    System.out.println("Mono查询订单: " + id);
                    return reactiveService.findOrderByIdMono(id);
                }

                // Flux - 多个元素的响应式流
                @Get("/products")
                @Produces(MediaType.APPLICATION_JSON_STREAM)
                public Flux<Product> streamProducts() {
                    // 流式返回产品列表,逐个发送
                    System.out.println("流式传输产品列表");
                    return reactiveService.streamAllProducts();
                }

                // Publisher - 标准响应式流接口
                @Get("/events")
                @Produces(MediaType.TEXT_EVENT_STREAM)
                public Publisher<ServerSentEvent<String>> streamEvents() {
                    // Server-Sent Events流式推送
                    System.out.println("开始推送事件流");

                    return Flux.interval(Duration.ofSeconds(1))
                        .map(seq -> ServerSentEvent.<String>builder()
                            .id(String.valueOf(seq))
                            .data("事件 " + seq)
                            .comment("序列号: " + seq)
                            .build());
                }

                // 异步处理后返回
                @Post("/process")
                public CompletableFuture<ProcessResult> processAsync(@Body ProcessRequest request) {
                    System.out.println("提交异步处理任务");

                    return CompletableFuture.supplyAsync(() -> {
                        // 模拟耗时处理
                        try {
                            Thread.sleep(2000);
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                        }

                        ProcessResult result = new ProcessResult();
                        result.setStatus("完成");
                        result.setData(request.getData());
                        result.setProcessedAt(LocalDateTime.now());
                        return result;
                    });
                }

                // 异步流式处理
                @Post("/batch-process")
                @Produces(MediaType.APPLICATION_JSON_STREAM)
                public Flux<BatchResult> processBatch(@Body List<String> items) {
                    System.out.println("批量处理 " + items.size() + " 项");

                    return Flux.fromIterable(items)
                        .flatMap(item -> reactiveService.processItem(item))
                        .map(result -> new BatchResult(result.getId(), result.getStatus()));
                }
            }

            // Server-Sent Event类
            import io.micronaut.http.sse.Event;

            public class ServerSentEvent<T> implements Event<T> {
                private String id;
                private T data;
                private String comment;

                public static <T> Builder<T> builder() {
                    return new Builder<>();
                }

                public static class Builder<T> {
                    private String id;
                    private T data;
                    private String comment;

                    public Builder<T> id(String id) {
                        this.id = id;
                        return this;
                    }

                    public Builder<T> data(T data) {
                        this.data = data;
                        return this;
                    }

                    public Builder<T> comment(String comment) {
                        this.comment = comment;
                        return this;
                    }

                    public ServerSentEvent<T> build() {
                        ServerSentEvent<T> event = new ServerSentEvent<>();
                        event.id = this.id;
                        event.data = this.data;
                        event.comment = this.comment;
                        return event;
                    }
                }

                // Getter省略
            }

            // 处理结果对象
            public class ProcessResult {
                private String status;
                private Object data;
                private LocalDateTime processedAt;

                // Getter和Setter省略
            }

            public class BatchResult {
                private Long id;
                private String status;

                public BatchResult(Long id, String status) {
                    this.id = id;
                    this.status = status;
                }

                // Getter省略
            }
            ---

02.状态码控制
    a.@Status注解
        a.固定状态码
            通过@Status注解指定方法成功响应的HTTP状态码,简化状态码设置。常用状态码:200 OK、201 Created、204 No Content、202 Accepted。
        b.Status注解示例
            ---
            @Controller("/api/resources")
            public class StatusCodeController {
                private final ResourceService resourceService;

                public StatusCodeController(ResourceService resourceService) {
                    this.resourceService = resourceService;
                }

                // 201 Created - 创建成功
                @Post
                @Status(HttpStatus.CREATED)
                public Resource createResource(@Body ResourceRequest request) {
                    System.out.println("创建资源: " + request.getName());
                    return resourceService.create(request);
                }

                // 204 No Content - 更新成功无返回
                @Put("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void updateResource(Long id, @Body ResourceRequest request) {
                    System.out.println("更新资源: " + id);
                    resourceService.update(id, request);
                    // 返回void,响应204 No Content
                }

                // 202 Accepted - 异步任务已接受
                @Post("/async")
                @Status(HttpStatus.ACCEPTED)
                public TaskInfo submitAsyncTask(@Body TaskRequest request) {
                    System.out.println("提交异步任务");
                    String taskId = resourceService.submitTask(request);
                    return new TaskInfo(taskId, "任务已接受");
                }

                // 206 Partial Content - 部分内容
                @Get("/{id}/partial")
                @Status(HttpStatus.PARTIAL_CONTENT)
                public PartialData getPartialData(
                    Long id,
                    @Header("Range") String range) {
                    System.out.println("获取部分数据: " + id + ", 范围: " + range);
                    return resourceService.getPartialData(id, range);
                }

                // 默认200 OK - 无需显式指定
                @Get("/{id}")
                public Resource getResource(Long id) {
                    System.out.println("查询资源: " + id);
                    return resourceService.findById(id);
                }
            }

            // 任务信息对象
            public class TaskInfo {
                private String taskId;
                private String message;
                private String status;
                private long timestamp;

                public TaskInfo(String taskId, String message) {
                    this.taskId = taskId;
                    this.message = message;
                    this.status = "ACCEPTED";
                    this.timestamp = System.currentTimeMillis();
                }

                // Getter省略
            }

            // 部分数据对象
            public class PartialData {
                private String range;
                private byte[] data;
                private long totalSize;

                public PartialData(String range, byte[] data, long totalSize) {
                    this.range = range;
                    this.data = data;
                    this.totalSize = totalSize;
                }

                // Getter省略
            }
            ---
    b.动态状态码
        a.条件响应
            根据业务逻辑动态选择状态码,使用HttpResponse构建不同状态的响应。常见场景:资源是否存在、验证是否通过、权限检查等。
        b.动态状态码示例
            ---
            @Controller("/api/dynamic")
            public class DynamicStatusController {
                private final DynamicService dynamicService;

                public DynamicStatusController(DynamicService dynamicService) {
                    this.dynamicService = dynamicService;
                }

                // 根据资源是否存在返回不同状态
                @Get("/resource/{id}")
                public HttpResponse<Resource> getResource(Long id) {
                    Optional<Resource> resource = dynamicService.findById(id);

                    if (resource.isPresent()) {
                        return HttpResponse.ok(resource.get());  // 200 OK
                    } else {
                        return HttpResponse.notFound();  // 404 Not Found
                    }
                }

                // 根据删除结果返回不同状态
                @Delete("/resource/{id}")
                public HttpResponse<Void> deleteResource(Long id) {
                    boolean deleted = dynamicService.delete(id);

                    if (deleted) {
                        return HttpResponse.noContent();  // 204 No Content
                    } else {
                        return HttpResponse.notFound();  // 404 Not Found
                    }
                }

                // 根据验证结果返回不同状态
                @Post("/submit")
                public HttpResponse<?> submitData(@Body DataRequest request) {
                    ValidationResult validation = dynamicService.validate(request);

                    if (validation.isValid()) {
                        Data data = dynamicService.save(request);
                        return HttpResponse.created(data);  // 201 Created
                    } else {
                        ErrorResponse error = new ErrorResponse(
                            "VALIDATION_ERROR",
                            "数据验证失败",
                            validation.getErrors()
                        );
                        return HttpResponse.badRequest(error);  // 400 Bad Request
                    }
                }

                // 根据权限返回不同状态
                @Get("/protected/{id}")
                public HttpResponse<?> getProtectedResource(
                    Long id,
                    @Header("Authorization") @Nullable String authorization) {

                    if (authorization == null) {
                        // 未提供认证信息
                        return HttpResponse.unauthorized();  // 401 Unauthorized
                    }

                    boolean authenticated = dynamicService.verifyToken(authorization);
                    if (!authenticated) {
                        return HttpResponse.unauthorized();  // 401 Unauthorized
                    }

                    boolean hasPermission = dynamicService.checkPermission(authorization, id);
                    if (!hasPermission) {
                        // 已认证但无权限
                        ErrorResponse error = new ErrorResponse(
                            "FORBIDDEN",
                            "您没有权限访问此资源",
                            null
                        );
                        return HttpResponse.status(HttpStatus.FORBIDDEN)
                            .body(error);  // 403 Forbidden
                    }

                    Resource resource = dynamicService.getResource(id);
                    return HttpResponse.ok(resource);  // 200 OK
                }

                // 根据资源状态返回不同响应
                @Put("/resource/{id}/status")
                public HttpResponse<?> updateStatus(
                    Long id,
                    @Body StatusUpdate update) {

                    try {
                        ResourceState result = dynamicService.updateStatus(id, update.getStatus());

                        switch (result) {
                            case UPDATED:
                                return HttpResponse.ok(new Message("状态已更新"));  // 200 OK
                            case NOT_FOUND:
                                return HttpResponse.notFound();  // 404 Not Found
                            case CONFLICT:
                                ErrorResponse conflict = new ErrorResponse(
                                    "CONFLICT",
                                    "状态冲突,资源已被修改",
                                    null
                                );
                                return HttpResponse.status(HttpStatus.CONFLICT)
                                    .body(conflict);  // 409 Conflict
                            case PRECONDITION_FAILED:
                                ErrorResponse precondition = new ErrorResponse(
                                    "PRECONDITION_FAILED",
                                    "前置条件不满足",
                                    null
                                );
                                return HttpResponse.status(HttpStatus.PRECONDITION_FAILED)
                                    .body(precondition);  // 412 Precondition Failed
                            default:
                                return HttpResponse.serverError();  // 500 Internal Server Error
                        }
                    } catch (Exception e) {
                        ErrorResponse error = new ErrorResponse(
                            "INTERNAL_ERROR",
                            "服务器内部错误",
                            e.getMessage()
                        );
                        return HttpResponse.serverError(error);  // 500 Internal Server Error
                    }
                }
            }

            // 资源状态枚举
            public enum ResourceState {
                UPDATED,
                NOT_FOUND,
                CONFLICT,
                PRECONDITION_FAILED
            }

            // 状态更新请求
            public class StatusUpdate {
                private String status;
                private String reason;

                // Getter和Setter省略
            }

            // 验证结果对象
            public class ValidationResult {
                private boolean valid;
                private List<String> errors;

                public ValidationResult(boolean valid, List<String> errors) {
                    this.valid = valid;
                    this.errors = errors;
                }

                public boolean isValid() { return valid; }
                public List<String> getErrors() { return errors; }
            }
            ---

03.响应头设置
    a.固定响应头
        a.@Header方法级注解
            在方法上使用@Header注解添加固定响应头,如CORS头、缓存控制头、API版本头等。适用于添加固定的响应头,简化响应头配置。
        b.固定响应头示例
            ---
            @Controller("/api/headers")
            public class ResponseHeaderController {
                private final HeaderService headerService;

                public ResponseHeaderController(HeaderService headerService) {
                    this.headerService = headerService;
                }

                // 单个固定响应头
                @Get("/version")
                @Header(name = "X-API-Version", value = "1.0")
                public ApiInfo getVersion() {
                    return new ApiInfo("API", "1.0");
                }

                // 多个固定响应头
                @Get("/cors-enabled")
                @Header(name = "Access-Control-Allow-Origin", value = "*")
                @Header(name = "Access-Control-Allow-Methods", value = "GET, POST, PUT, DELETE")
                @Header(name = "Access-Control-Max-Age", value = "3600")
                public Message getCorsEnabled() {
                    return new Message("支持CORS跨域访问");
                }

                // 缓存控制头
                @Get("/cacheable")
                @Header(name = "Cache-Control", value = "public, max-age=3600")
                @Header(name = "ETag", value = "v1.0")
                public CacheableData getCacheableData() {
                    return headerService.getCacheableData();
                }

                // 自定义业务响应头
                @Get("/business")
                @Header(name = "X-Request-Id", value = "generated-id")
                @Header(name = "X-Tenant-Id", value = "default")
                @Header(name = "X-Response-Time", value = "50ms")
                public BusinessData getBusinessData() {
                    return headerService.getBusinessData();
                }
            }

            // API信息对象
            public class ApiInfo {
                private String name;
                private String version;

                public ApiInfo(String name, String version) {
                    this.name = name;
                    this.version = version;
                }

                // Getter省略
            }

            // 可缓存数据对象
            public class CacheableData {
                private String data;
                private long timestamp;
                private String etag;

                // Getter和Setter省略
            }

            // 业务数据对象
            public class BusinessData {
                private String content;
                private Map<String, Object> metadata;

                // Getter和Setter省略
            }
            ---
    b.动态响应头
        a.HttpResponse响应头
            通过HttpResponse.header()方法动态添加响应头,根据请求内容或业务逻辑设置不同的响应头值。支持链式调用,设置多个响应头。
        b.动态响应头示例
            ---
            @Controller("/api/dynamic-headers")
            public class DynamicHeaderController {
                private final DynamicHeaderService headerService;

                public DynamicHeaderController(DynamicHeaderService headerService) {
                    this.headerService = headerService;
                }

                // 动态设置Content-Type
                @Get("/content/{format}")
                public HttpResponse<?> getContent(String format) {
                    Object data = headerService.getData();

                    switch (format.toLowerCase()) {
                        case "json":
                            return HttpResponse.ok(data)
                                .contentType(MediaType.APPLICATION_JSON);
                        case "xml":
                            String xml = headerService.toXml(data);
                            return HttpResponse.ok(xml)
                                .contentType(MediaType.APPLICATION_XML);
                        case "text":
                            String text = data.toString();
                            return HttpResponse.ok(text)
                                .contentType(MediaType.TEXT_PLAIN);
                        default:
                            return HttpResponse.badRequest();
                    }
                }

                // 动态设置缓存头
                @Get("/cache/{resource}")
                public HttpResponse<Resource> getCachedResource(String resource) {
                    Resource data = headerService.getResource(resource);
                    String etag = headerService.calculateETag(data);
                    boolean cacheable = headerService.isCacheable(resource);

                    MutableHttpResponse<Resource> response = HttpResponse.ok(data)
                        .header("ETag", etag);

                    if (cacheable) {
                        response.header("Cache-Control", "public, max-age=3600");
                    } else {
                        response.header("Cache-Control", "no-cache, no-store, must-revalidate");
                    }

                    return response;
                }

                // 动态设置Location头
                @Post("/items")
                public HttpResponse<Item> createItem(@Body ItemRequest request) {
                    Item item = headerService.createItem(request);
                    String location = "/api/dynamic-headers/items/" + item.getId();

                    return HttpResponse.created(item)
                        .header("Location", location)
                        .header("X-Item-Id", item.getId().toString())
                        .header("X-Created-At", item.getCreatedAt().toString());
                }

                // 根据请求动态设置响应头
                @Get("/conditional")
                public HttpResponse<ConditionalData> getConditional(
                    @Header("Accept-Language") @Nullable String language,
                    @Header("Accept-Encoding") @Nullable String encoding) {

                    String lang = language != null ? language : "en";
                    ConditionalData data = headerService.getLocalizedData(lang);

                    MutableHttpResponse<ConditionalData> response = HttpResponse.ok(data)
                        .header("Content-Language", lang)
                        .header("X-Data-Version", data.getVersion());

                    // 根据Accept-Encoding设置压缩
                    if (encoding != null && encoding.contains("gzip")) {
                        response.header("Content-Encoding", "gzip");
                    }

                    return response;
                }

                // 设置多个自定义头
                @Get("/tracking/{id}")
                public HttpResponse<TrackingInfo> getTracking(Long id) {
                    TrackingInfo info = headerService.getTrackingInfo(id);
                    String requestId = UUID.randomUUID().toString();
                    String correlationId = headerService.getCorrelationId();

                    return HttpResponse.ok(info)
                        .header("X-Request-Id", requestId)
                        .header("X-Correlation-Id", correlationId)
                        .header("X-Processing-Time", info.getProcessingTime() + "ms")
                        .header("X-Cache-Status", info.isCached() ? "HIT" : "MISS")
                        .header("X-Server-Region", "us-west-1");
                }

                // 文件下载响应头
                @Get("/download/{fileId}")
                public HttpResponse<byte[]> downloadFile(String fileId) {
                    byte[] data = headerService.getFileData(fileId);
                    String fileName = headerService.getFileName(fileId);
                    String contentType = headerService.getContentType(fileId);
                    String checksum = headerService.calculateChecksum(data);

                    return HttpResponse.ok(data)
                        .contentType(contentType)
                        .header("Content-Disposition",
                               "attachment; filename=\"" + fileName + "\"")
                        .header("Content-Length", String.valueOf(data.length))
                        .header("X-File-Id", fileId)
                        .header("X-Checksum", checksum)
                        .header("X-Downloaded-At", LocalDateTime.now().toString());
                }
            }

            // 条件数据对象
            public class ConditionalData {
                private String content;
                private String version;
                private String language;

                // Getter和Setter省略
            }

            // 跟踪信息对象
            public class TrackingInfo {
                private Long id;
                private String status;
                private long processingTime;
                private boolean cached;

                // Getter和Setter省略
            }
            ---

04.内容协商与流式响应
    a.内容协商
        a.@Produces注解
            @Produces注解指定方法返回的内容类型,支持同一资源返回多种格式。根据客户端Accept请求头自动选择响应格式,实现内容协商。
        b.内容协商示例
            ---
            @Controller("/api/content")
            public class ContentNegotiationController {
                private final ContentService contentService;

                public ContentNegotiationController(ContentService contentService) {
                    this.contentService = contentService;
                }

                // 返回JSON格式(默认)
                @Get("/data")
                @Produces(MediaType.APPLICATION_JSON)
                public DataObject getDataJson() {
                    System.out.println("返回JSON格式");
                    return contentService.getData();
                }

                // 返回XML格式
                @Get("/data")
                @Produces(MediaType.APPLICATION_XML)
                public String getDataXml() {
                    System.out.println("返回XML格式");
                    DataObject data = contentService.getData();
                    return contentService.toXml(data);
                }

                // 返回纯文本
                @Get("/data")
                @Produces(MediaType.TEXT_PLAIN)
                public String getDataText() {
                    System.out.println("返回纯文本格式");
                    DataObject data = contentService.getData();
                    return data.toString();
                }

                // 返回HTML
                @Get("/page")
                @Produces(MediaType.TEXT_HTML)
                public String getHtmlPage() {
                    return "<html><body><h1>Hello Micronaut</h1></body></html>";
                }

                // 手动内容协商
                @Get("/manual")
                public HttpResponse<?> manualContentNegotiation(
                    @Header("Accept") String accept) {

                    DataObject data = contentService.getData();

                    if (accept.contains("application/json")) {
                        return HttpResponse.ok(data)
                            .contentType(MediaType.APPLICATION_JSON);
                    } else if (accept.contains("application/xml")) {
                        String xml = contentService.toXml(data);
                        return HttpResponse.ok(xml)
                            .contentType(MediaType.APPLICATION_XML);
                    } else if (accept.contains("text/plain")) {
                        return HttpResponse.ok(data.toString())
                            .contentType(MediaType.TEXT_PLAIN);
                    } else {
                        // 不支持的格式
                        return HttpResponse.status(HttpStatus.NOT_ACCEPTABLE)
                            .body(new Message("不支持的格式: " + accept));
                    }
                }
            }

            // 数据对象
            public class DataObject {
                private Long id;
                private String name;
                private String description;
                private Map<String, Object> attributes;

                @Override
                public String toString() {
                    return "DataObject{id=" + id + ", name=" + name +
                           ", description=" + description + "}";
                }

                // Getter和Setter省略
            }

            // curl示例
            // curl -H "Accept: application/json" http://localhost:8080/api/content/data
            // curl -H "Accept: application/xml" http://localhost:8080/api/content/data
            // curl -H "Accept: text/plain" http://localhost:8080/api/content/data
            ---
    b.流式响应
        a.Server-Sent Events
            返回Publisher<Event>实现服务器推送事件,建立持久连接向客户端推送实时消息。使用text/event-stream格式,客户端通过EventSource API接收。
        b.流式响应示例
            ---
            import io.micronaut.http.sse.Event;

            @Controller("/api/stream")
            public class StreamResponseController {
                private final StreamService streamService;

                public StreamResponseController(StreamService streamService) {
                    this.streamService = streamService;
                }

                // Server-Sent Events流
                @Get("/events")
                @Produces(MediaType.TEXT_EVENT_STREAM)
                public Publisher<Event<String>> streamEvents() {
                    System.out.println("开始推送事件流");

                    return Flux.interval(Duration.ofSeconds(1))
                        .map(seq -> Event.of("事件 " + seq)
                            .id(String.valueOf(seq))
                            .comment("序列号: " + seq));
                }

                // 流式JSON数据
                @Get("/products")
                @Produces(MediaType.APPLICATION_JSON_STREAM)
                public Flux<Product> streamProducts() {
                    System.out.println("流式传输产品列表");
                    return streamService.streamAllProducts();
                }

                // 分块传输大文件
                @Get("/download/{fileId}")
                public HttpResponse<StreamedFile> downloadLargeFile(String fileId) {
                    File file = streamService.getFile(fileId);
                    String fileName = file.getName();

                    StreamedFile streamedFile = new StreamedFile(file, MediaType.APPLICATION_OCTET_STREAM_TYPE);

                    return HttpResponse.ok(streamedFile)
                        .header("Content-Disposition",
                               "attachment; filename=\"" + fileName + "\"")
                        .header("Transfer-Encoding", "chunked");
                }

                // 实时进度推送
                @Post("/long-running")
                @Produces(MediaType.TEXT_EVENT_STREAM)
                public Publisher<Event<ProgressUpdate>> longRunningTask(@Body TaskRequest request) {
                    System.out.println("启动长时间运行任务");

                    return Flux.create(emitter -> {
                        streamService.executeLongTask(request, progress -> {
                            ProgressUpdate update = new ProgressUpdate(
                                progress.getPercent(),
                                progress.getMessage()
                            );
                            emitter.next(Event.of(update));

                            if (progress.isCompleted()) {
                                emitter.complete();
                            }
                        });
                    });
                }

                // 日志流式推送
                @Get("/logs/{serviceId}")
                @Produces(MediaType.TEXT_EVENT_STREAM)
                public Flux<Event<LogEntry>> streamLogs(String serviceId) {
                    System.out.println("开始推送日志: " + serviceId);

                    return streamService.watchLogs(serviceId)
                        .map(log -> Event.of(log)
                            .id(log.getId())
                            .event("log")
                            .comment("Level: " + log.getLevel()));
                }
            }

            // 进度更新对象
            public class ProgressUpdate {
                private int percent;
                private String message;
                private long timestamp;

                public ProgressUpdate(int percent, String message) {
                    this.percent = percent;
                    this.message = message;
                    this.timestamp = System.currentTimeMillis();
                }

                // Getter省略
            }

            // 日志条目对象
            public class LogEntry {
                private String id;
                private String level;
                private String message;
                private LocalDateTime timestamp;

                // Getter和Setter省略
            }

            // JavaScript客户端示例
            // const eventSource = new EventSource('http://localhost:8080/api/stream/events');
            // eventSource.onmessage = (event) => {
            //     console.log('收到事件:', event.data);
            // };
            ---

4.5 过滤器与拦截器

01.HTTP过滤器
    a.@Filter注解
        a.过滤器定义
            @Filter注解标记HTTP过滤器类,实现HttpFilter接口拦截HTTP请求和响应。过滤器可以修改请求、响应、添加日志、认证授权等,按照定义的patterns匹配URL路径执行过滤逻辑。
        b.基础过滤器示例
            ---
            import io.micronaut.http.HttpRequest;
            import io.micronaut.http.MutableHttpResponse;
            import io.micronaut.http.annotation.Filter;
            import io.micronaut.http.filter.HttpServerFilter;
            import io.micronaut.http.filter.ServerFilterChain;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Flux;

            // 拦截所有/api/**路径的请求
            @Filter("/api/**")
            public class LoggingFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    long startTime = System.currentTimeMillis();

                    System.out.println("=== 请求开始 ===");
                    System.out.println("方法: " + request.getMethod());
                    System.out.println("路径: " + request.getPath());
                    System.out.println("参数: " + request.getParameters().asMap());

                    // 继续执行请求链
                    return Flux.from(chain.proceed(request))
                        .doOnNext(response -> {
                            long duration = System.currentTimeMillis() - startTime;
                            System.out.println("状态码: " + response.getStatus());
                            System.out.println("耗时: " + duration + "ms");
                            System.out.println("=== 请求结束 ===\n");
                        });
                }
            }

            // 拦截特定路径的过滤器
            @Filter("/api/secure/**")
            public class SecurityFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("安全过滤器: 检查访问权限");

                    // 获取Authorization请求头
                    String authorization = request.getHeaders().get("Authorization");

                    if (authorization == null || !authorization.startsWith("Bearer ")) {
                        // 未提供认证信息,返回401
                        System.out.println("认证失败: 缺少Authorization头");
                        MutableHttpResponse<?> response = HttpResponse.unauthorized();
                        return Flux.just(response);
                    }

                    String token = authorization.substring(7);
                    if (!isValidToken(token)) {
                        // Token无效,返回401
                        System.out.println("认证失败: Token无效");
                        return Flux.just(HttpResponse.unauthorized());
                    }

                    System.out.println("认证成功,继续执行请求");
                    // Token有效,继续执行
                    return chain.proceed(request);
                }

                private boolean isValidToken(String token) {
                    // 简化的Token验证逻辑
                    return token != null && token.length() > 10;
                }
            }

            // 多路径匹配的过滤器
            @Filter(patterns = {"/api/admin/**", "/api/management/**"})
            public class AdminFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("管理员过滤器: 检查管理员权限");

                    String token = request.getHeaders().get("Authorization");
                    if (!hasAdminRole(token)) {
                        System.out.println("权限不足: 需要管理员权限");
                        ErrorResponse error = new ErrorResponse(
                            "FORBIDDEN",
                            "需要管理员权限",
                            null
                        );
                        return Flux.just(HttpResponse.status(HttpStatus.FORBIDDEN).body(error));
                    }

                    System.out.println("管理员权限验证通过");
                    return chain.proceed(request);
                }

                private boolean hasAdminRole(String token) {
                    // 检查用户是否有管理员角色
                    return token != null && token.contains("admin");
                }
            }
            ---
    b.过滤器顺序
        a.执行优先级
            使用@Order注解控制过滤器执行顺序,数字越小优先级越高。未指定Order的过滤器默认优先级为0,可以使用负数提高优先级。
        b.过滤器顺序示例
            ---
            import io.micronaut.core.order.Ordered;

            // 优先级最高: 先执行
            @Filter("/api/**")
            @Order(Ordered.HIGHEST_PRECEDENCE)
            public class FirstFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("1. FirstFilter: 最高优先级过滤器");
                    return chain.proceed(request);
                }
            }

            // 优先级-100: 第二执行
            @Filter("/api/**")
            @Order(-100)
            public class AuthenticationFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("2. AuthenticationFilter: 认证过滤器 (优先级-100)");

                    // 认证逻辑
                    String token = request.getHeaders().get("X-Auth-Token");
                    if (token == null) {
                        System.out.println("   认证失败: 缺少token");
                        return Flux.just(HttpResponse.unauthorized());
                    }

                    System.out.println("   认证通过");
                    return chain.proceed(request);
                }
            }

            // 优先级0(默认): 第三执行
            @Filter("/api/**")
            public class LoggingFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("3. LoggingFilter: 日志过滤器 (默认优先级0)");

                    long start = System.currentTimeMillis();
                    return Flux.from(chain.proceed(request))
                        .doOnNext(response -> {
                            long duration = System.currentTimeMillis() - start;
                            System.out.println("   请求耗时: " + duration + "ms");
                        });
                }
            }

            // 优先级100: 第四执行
            @Filter("/api/**")
            @Order(100)
            public class CacheFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("4. CacheFilter: 缓存过滤器 (优先级100)");

                    // 检查缓存
                    String cacheKey = request.getPath();
                    Object cached = checkCache(cacheKey);

                    if (cached != null) {
                        System.out.println("   缓存命中");
                        return Flux.just(HttpResponse.ok(cached));
                    }

                    System.out.println("   缓存未命中,继续执行");
                    return chain.proceed(request);
                }

                private Object checkCache(String key) {
                    // 简化的缓存检查逻辑
                    return null;
                }
            }

            // 优先级最低: 最后执行
            @Filter("/api/**")
            @Order(Ordered.LOWEST_PRECEDENCE)
            public class LastFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("5. LastFilter: 最低优先级过滤器");
                    return chain.proceed(request);
                }
            }

            // 执行顺序示例输出:
            // 1. FirstFilter: 最高优先级过滤器
            // 2. AuthenticationFilter: 认证过滤器 (优先级-100)
            //    认证通过
            // 3. LoggingFilter: 日志过滤器 (默认优先级0)
            // 4. CacheFilter: 缓存过滤器 (优先级100)
            //    缓存未命中,继续执行
            // 5. LastFilter: 最低优先级过滤器
            // [Controller处理请求]
            //    请求耗时: 45ms
            ---

02.请求拦截
    a.请求修改
        a.修改请求内容
            过滤器可以修改请求的头部、参数、路径等信息,实现请求预处理、参数转换、请求重写等功能。通过创建新的MutableHttpRequest对象实现请求修改。
        b.请求修改示例
            ---
            @Filter("/api/**")
            public class RequestModificationFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("原始请求: " + request.getPath());

                    // 1. 添加请求头
                    MutableHttpRequest<?> modifiedRequest = request.mutate()
                        .header("X-Request-Id", UUID.randomUUID().toString())
                        .header("X-Processing-Time", String.valueOf(System.currentTimeMillis()))
                        .header("X-Client-IP", getClientIp(request));

                    System.out.println("添加请求头: X-Request-Id, X-Processing-Time, X-Client-IP");

                    // 2. 继续执行修改后的请求
                    return chain.proceed(modifiedRequest);
                }

                private String getClientIp(HttpRequest<?> request) {
                    // 获取客户端真实IP
                    String forwarded = request.getHeaders().get("X-Forwarded-For");
                    if (forwarded != null) {
                        return forwarded.split(",")[0].trim();
                    }
                    return request.getRemoteAddress().getAddress().getHostAddress();
                }
            }

            // 参数转换过滤器
            @Filter("/api/**")
            public class ParameterTransformFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    // 将查询参数转换为小写
                    MutableHttpRequest<?> modifiedRequest = request.mutate();

                    request.getParameters().forEach((key, values) -> {
                        List<String> lowercaseValues = values.stream()
                            .map(String::toLowerCase)
                            .collect(Collectors.toList());
                        System.out.println("参数转换: " + key + " = " + values + " → " + lowercaseValues);
                    });

                    return chain.proceed(modifiedRequest);
                }
            }

            // 用户上下文注入过滤器
            @Filter("/api/**")
            @Order(-50)
            public class UserContextFilter implements HttpServerFilter {
                private final JwtService jwtService;

                public UserContextFilter(JwtService jwtService) {
                    this.jwtService = jwtService;
                }

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    String authorization = request.getHeaders().get("Authorization");

                    if (authorization != null && authorization.startsWith("Bearer ")) {
                        String token = authorization.substring(7);

                        try {
                            // 解析JWT Token
                            UserInfo userInfo = jwtService.parseToken(token);

                            System.out.println("用户上下文: ID=" + userInfo.getId() +
                                             ", 用户名=" + userInfo.getUsername() +
                                             ", 角色=" + userInfo.getRoles());

                            // 将用户信息添加到请求属性中
                            MutableHttpRequest<?> modifiedRequest = request.mutate()
                                .header("X-User-Id", userInfo.getId().toString())
                                .header("X-Username", userInfo.getUsername())
                                .header("X-User-Roles", String.join(",", userInfo.getRoles()));

                            return chain.proceed(modifiedRequest);

                        } catch (Exception e) {
                            System.out.println("Token解析失败: " + e.getMessage());
                            return Flux.just(HttpResponse.unauthorized());
                        }
                    }

                    // 没有认证信息,继续执行
                    return chain.proceed(request);
                }
            }

            // 用户信息对象
            public class UserInfo {
                private Long id;
                private String username;
                private List<String> roles;

                public UserInfo(Long id, String username, List<String> roles) {
                    this.id = id;
                    this.username = username;
                    this.roles = roles;
                }

                // Getter省略
            }
            ---
    b.请求验证
        a.输入验证
            在过滤器中对请求进行验证,检查请求头、参数、内容类型等是否符合要求,实现统一的请求验证和安全防护。
        b.请求验证示例
            ---
            @Filter("/api/**")
            @Order(-200)
            public class RequestValidationFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    System.out.println("请求验证过滤器");

                    // 1. 验证Content-Type
                    if (request.getMethod().equals(HttpMethod.POST) ||
                        request.getMethod().equals(HttpMethod.PUT)) {

                        String contentType = request.getContentType().orElse(null);
                        if (contentType == null) {
                            System.out.println("验证失败: 缺少Content-Type");
                            ErrorResponse error = new ErrorResponse(
                                "INVALID_CONTENT_TYPE",
                                "POST/PUT请求必须指定Content-Type",
                                null
                            );
                            return Flux.just(HttpResponse.badRequest(error));
                        }
                    }

                    // 2. 验证必需的请求头
                    if (!request.getHeaders().contains("X-API-Version")) {
                        System.out.println("验证失败: 缺少X-API-Version头");
                        ErrorResponse error = new ErrorResponse(
                            "MISSING_API_VERSION",
                            "请求必须包含X-API-Version头",
                            null
                        );
                        return Flux.just(HttpResponse.badRequest(error));
                    }

                    // 3. 验证User-Agent
                    String userAgent = request.getHeaders().get("User-Agent");
                    if (userAgent == null || userAgent.isEmpty()) {
                        System.out.println("验证失败: 缺少User-Agent");
                        ErrorResponse error = new ErrorResponse(
                            "MISSING_USER_AGENT",
                            "请求必须包含User-Agent头",
                            null
                        );
                        return Flux.just(HttpResponse.badRequest(error));
                    }

                    // 4. 验证请求路径长度
                    if (request.getPath().length() > 2000) {
                        System.out.println("验证失败: URL过长");
                        ErrorResponse error = new ErrorResponse(
                            "URI_TOO_LONG",
                            "请求URL长度不能超过2000字符",
                            null
                        );
                        return Flux.just(
                            HttpResponse.status(HttpStatus.URI_TOO_LONG).body(error)
                        );
                    }

                    System.out.println("请求验证通过");
                    return chain.proceed(request);
                }
            }

            // SQL注入防护过滤器
            @Filter("/api/**")
            public class SqlInjectionFilter implements HttpServerFilter {

                private static final Pattern SQL_INJECTION_PATTERN =
                    Pattern.compile("('.*(or|and|union|select|insert|update|delete|drop|create|alter).*')",
                                  Pattern.CASE_INSENSITIVE);

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    // 检查查询参数中的SQL注入
                    for (Map.Entry<String, List<String>> entry : request.getParameters().asMap().entrySet()) {
                        for (String value : entry.getValue()) {
                            if (SQL_INJECTION_PATTERN.matcher(value).find()) {
                                System.out.println("SQL注入检测: 参数=" + entry.getKey() + ", 值=" + value);
                                ErrorResponse error = new ErrorResponse(
                                    "SQL_INJECTION_DETECTED",
                                    "检测到潜在的SQL注入攻击",
                                    "参数: " + entry.getKey()
                                );
                                return Flux.just(HttpResponse.badRequest(error));
                            }
                        }
                    }

                    return chain.proceed(request);
                }
            }

            // XSS防护过滤器
            @Filter("/api/**")
            public class XssFilter implements HttpServerFilter {

                private static final Pattern XSS_PATTERN =
                    Pattern.compile("<script[^>]*>.*?</script>|javascript:|onerror=|onclick=",
                                  Pattern.CASE_INSENSITIVE);

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    // 检查查询参数中的XSS攻击
                    for (Map.Entry<String, List<String>> entry : request.getParameters().asMap().entrySet()) {
                        for (String value : entry.getValue()) {
                            if (XSS_PATTERN.matcher(value).find()) {
                                System.out.println("XSS检测: 参数=" + entry.getKey());
                                ErrorResponse error = new ErrorResponse(
                                    "XSS_DETECTED",
                                    "检测到潜在的XSS攻击",
                                    "参数: " + entry.getKey()
                                );
                                return Flux.just(HttpResponse.badRequest(error));
                            }
                        }
                    }

                    return chain.proceed(request);
                }
            }
            ---

03.响应拦截
    a.响应修改
        a.修改响应内容
            过滤器可以修改响应的状态码、头部、响应体等信息,实现响应后处理、添加通用响应头、响应转换等功能。
        b.响应修改示例
            ---
            @Filter("/api/**")
            public class ResponseModificationFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    return Flux.from(chain.proceed(request))
                        .map(response -> {
                            System.out.println("修改响应");

                            // 1. 添加通用响应头
                            response.header("X-Powered-By", "Micronaut")
                                   .header("X-Response-Time", String.valueOf(System.currentTimeMillis()))
                                   .header("X-Server-Region", "us-west-1");

                            // 2. 添加CORS头
                            response.header("Access-Control-Allow-Origin", "*")
                                   .header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
                                   .header("Access-Control-Allow-Headers", "Content-Type, Authorization")
                                   .header("Access-Control-Max-Age", "3600");

                            // 3. 添加安全头
                            response.header("X-Content-Type-Options", "nosniff")
                                   .header("X-Frame-Options", "DENY")
                                   .header("X-XSS-Protection", "1; mode=block")
                                   .header("Strict-Transport-Security", "max-age=31536000; includeSubDomains");

                            System.out.println("响应头已添加");
                            return response;
                        });
                }
            }

            // 响应压缩标记过滤器
            @Filter("/api/**")
            public class CompressionFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    String acceptEncoding = request.getHeaders().get("Accept-Encoding");

                    return Flux.from(chain.proceed(request))
                        .map(response -> {
                            // 如果客户端支持gzip压缩
                            if (acceptEncoding != null && acceptEncoding.contains("gzip")) {
                                // 获取响应体大小
                                Object body = response.body();
                                if (body != null) {
                                    String bodyStr = body.toString();
                                    if (bodyStr.length() > 1024) {
                                        // 响应体大于1KB,标记为可压缩
                                        response.header("Content-Encoding", "gzip");
                                        System.out.println("响应将被压缩: 原始大小=" + bodyStr.length());
                                    }
                                }
                            }
                            return response;
                        });
                }
            }

            // 响应缓存过滤器
            @Filter("/api/**")
            public class CacheResponseFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    return Flux.from(chain.proceed(request))
                        .map(response -> {
                            // 只缓存成功的GET请求
                            if (request.getMethod().equals(HttpMethod.GET) &&
                                response.getStatus().equals(HttpStatus.OK)) {

                                String path = request.getPath();

                                // 根据路径设置不同的缓存策略
                                if (path.startsWith("/api/public/")) {
                                    // 公共资源,缓存1小时
                                    response.header("Cache-Control", "public, max-age=3600");
                                    System.out.println("公共资源缓存: 1小时");

                                } else if (path.startsWith("/api/static/")) {
                                    // 静态资源,缓存1天
                                    response.header("Cache-Control", "public, max-age=86400");
                                    System.out.println("静态资源缓存: 1天");

                                } else {
                                    // 私有资源,不缓存
                                    response.header("Cache-Control", "private, no-cache, no-store, must-revalidate");
                                    System.out.println("私有资源: 禁止缓存");
                                }

                                // 添加ETag
                                String etag = generateETag(response.body());
                                response.header("ETag", etag);
                            }

                            return response;
                        });
                }

                private String generateETag(Object body) {
                    // 简化的ETag生成逻辑
                    if (body != null) {
                        return "W/\"" + body.hashCode() + "\"";
                    }
                    return "W/\"empty\"";
                }
            }

            // 统一响应包装过滤器
            @Filter("/api/**")
            @Order(200)
            public class ResponseWrapperFilter implements HttpServerFilter {

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    return Flux.from(chain.proceed(request))
                        .map(response -> {
                            // 只包装成功的响应
                            if (response.getStatus().getCode() >= 200 &&
                                response.getStatus().getCode() < 300) {

                                Object originalBody = response.body();

                                // 创建统一响应格式
                                ApiResponse<?> wrappedResponse = new ApiResponse<>(
                                    200,
                                    "success",
                                    originalBody,
                                    System.currentTimeMillis()
                                );

                                System.out.println("响应已包装为统一格式");
                                return response.body(wrappedResponse);
                            }

                            return response;
                        });
                }
            }

            // 统一响应格式
            public class ApiResponse<T> {
                private int code;
                private String message;
                private T data;
                private long timestamp;

                public ApiResponse(int code, String message, T data, long timestamp) {
                    this.code = code;
                    this.message = message;
                    this.data = data;
                    this.timestamp = timestamp;
                }

                // Getter省略
            }
            ---
    b.性能监控
        a.请求度量
            通过过滤器收集请求处理时间、响应大小、错误率等性能指标,实现请求监控和性能分析。
        b.性能监控示例
            ---
            import java.util.concurrent.ConcurrentHashMap;
            import java.util.concurrent.atomic.AtomicLong;

            @Singleton
            @Filter("/api/**")
            @Order(-500)
            public class PerformanceMonitorFilter implements HttpServerFilter {

                // 请求计数器
                private final AtomicLong requestCount = new AtomicLong(0);
                private final AtomicLong errorCount = new AtomicLong(0);

                // 路径统计
                private final ConcurrentHashMap<String, PathStats> pathStatsMap = new ConcurrentHashMap<>();

                @Override
                public Publisher<MutableHttpResponse<?>> doFilter(
                    HttpRequest<?> request,
                    ServerFilterChain chain) {

                    long requestId = requestCount.incrementAndGet();
                    long startTime = System.currentTimeMillis();
                    String path = request.getPath();
                    String method = request.getMethod().name();
                    String key = method + " " + path;

                    System.out.println("=== 请求 #" + requestId + " 开始 ===");
                    System.out.println(method + " " + path);

                    return Flux.from(chain.proceed(request))
                        .doOnNext(response -> {
                            // 请求成功
                            long duration = System.currentTimeMillis() - startTime;

                            // 更新统计信息
                            PathStats stats = pathStatsMap.computeIfAbsent(key, k -> new PathStats());
                            stats.incrementCount();
                            stats.addDuration(duration);

                            // 计算响应大小
                            long responseSize = calculateResponseSize(response);
                            stats.addResponseSize(responseSize);

                            System.out.println("状态: " + response.getStatus().getCode());
                            System.out.println("耗时: " + duration + "ms");
                            System.out.println("响应大小: " + responseSize + " bytes");
                            System.out.println("平均耗时: " + stats.getAverageDuration() + "ms");
                            System.out.println("=== 请求 #" + requestId + " 完成 ===\n");

                            // 添加性能头到响应
                            response.header("X-Response-Time", duration + "ms")
                                   .header("X-Request-Id", String.valueOf(requestId));
                        })
                        .doOnError(error -> {
                            // 请求失败
                            long duration = System.currentTimeMillis() - startTime;
                            errorCount.incrementAndGet();

                            PathStats stats = pathStatsMap.computeIfAbsent(key, k -> new PathStats());
                            stats.incrementErrorCount();

                            System.err.println("请求失败 #" + requestId);
                            System.err.println("错误: " + error.getMessage());
                            System.err.println("耗时: " + duration + "ms");
                            System.err.println("=== 请求 #" + requestId + " 失败 ===\n");
                        });
                }

                private long calculateResponseSize(MutableHttpResponse<?> response) {
                    Object body = response.body();
                    if (body == null) {
                        return 0;
                    }
                    if (body instanceof byte[]) {
                        return ((byte[]) body).length;
                    }
                    if (body instanceof String) {
                        return ((String) body).length();
                    }
                    // 估算JSON序列化后的大小
                    return body.toString().length();
                }

                // 获取统计信息的端点
                @Get("/api/stats")
                public Map<String, Object> getStats() {
                    Map<String, Object> stats = new HashMap<>();
                    stats.put("totalRequests", requestCount.get());
                    stats.put("totalErrors", errorCount.get());
                    stats.put("errorRate", String.format("%.2f",
                                     (usedMemory * 100.0 / maxMemory)));
                }

                // 对比传统JPA
                public void compareWithTraditionalJPA() {
                    System.out.println("\n=== Micronaut Data vs 传统JPA ===");
                    System.out.println("\nMicronaut Data优势:");
                    System.out.println("1. 编译时生成 - 无运行时反射");
                    System.out.println("2. 更快的启动速度 - 通常快50-90%");
                    System.out.println("3. 更低的内存占用 - 减少30-50%");
                    System.out.println("4. 更小的应用体积 - 减少依赖");
                    System.out.println("5. AOT编译友好 - 支持GraalVM Native Image");

                    System.out.println("\n传统JPA特点:");
                    System.out.println("1. 运行时生成代理 - 使用反射");
                    System.out.println("2. 较慢的启动速度 - 需要初始化EntityManager");
                    System.out.println("3. 较高的内存占用 - 代理和缓存开销");
                    System.out.println("4. 成熟的生态系统 - 更多工具和集成");
                }
            }

            // 性能测试输出示例
            // === 启动性能测试 ===
            // 启动时间: 1200ms
            // Bean数量: 245
            //
            // === 查询性能测试 ===
            // findAll() x1000: 450ms
            // 平均: 0.45ms
            //
            // findByUsername() x1000: 520ms
            // 平均: 0.52ms
            //
            // save() x100: 180ms
            // 平均: 1.8ms
            //
            // === 内存占用测试 ===
            // 已用内存: 128 MB
            // 最大内存: 512 MB
            // 使用率: 25.00%
            ---

02.支持的数据库
    a.关系型数据库
        a.主流数据库支持
            Micronaut Data支持MySQL、PostgreSQL、Oracle、SQL Server、H2等主流关系型数据库,通过JDBC或R2DBC访问。提供数据库方言自动适配,简化多数据库支持。
        b.多数据库配置示例
            ---
            // application.yml - 多数据源配置
            datasources:
              # 主数据源 - MySQL
              default:
                url: jdbc:mysql://localhost:3306/app_db
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD}
                dialect: MYSQL
                maximum-pool-size: 10
                minimum-idle: 2

              # 从数据源 - PostgreSQL
              analytics:
                url: jdbc:postgresql://localhost:5432/analytics_db
                driverClassName: org.postgresql.Driver
                username: analytics_user
                password: ${ANALYTICS_DB_PASSWORD}
                dialect: POSTGRES
                maximum-pool-size: 5

              # H2内存数据库 - 用于测试
              test:
                url: jdbc:h2:mem:testDb
                driverClassName: org.h2.Driver
                username: sa
                password: ''
                dialect: H2

            jpa:
              default:
                properties:
                  hibernate:
                    hbm2ddl:
                      auto: update
                    show_sql: true

            // MySQL实体示例
            @Entity
            @Table(name = "products")
            public class Product {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false, length = 100)
                private String name;

                @Column(precision = 10, scale = 2)
                private BigDecimal price;

                @Column(columnDefinition = "TEXT")
                private String description;

                @Column(name = "created_at", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
                private LocalDateTime createdAt;

                // Getter和Setter省略
            }

            // MySQL Repository
            @Repository
            public interface ProductRepository extends JpaRepository<Product, Long> {
                @Query("SELECT p FROM Product p WHERE p.price BETWEEN :minPrice AND :maxPrice")
                List<Product> findByPriceRange(
                    @Param("minPrice") BigDecimal minPrice,
                    @Param("maxPrice") BigDecimal maxPrice
                );

                @Query("SELECT p FROM Product p WHERE LOWER(p.name) LIKE LOWER(CONCAT('%', :keyword, '%'))")
                List<Product> searchByName(@Param("keyword") String keyword);
            }

            // PostgreSQL实体示例
            @Entity
            @Table(name = "analytics_events")
            public class AnalyticsEvent {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(name = "event_type", nullable = false)
                private String eventType;

                @Column(name = "user_id")
                private Long userId;

                @Column(columnDefinition = "jsonb")
                private String properties;  // PostgreSQL JSON类型

                @Column(name = "occurred_at", nullable = false)
                private LocalDateTime occurredAt;

                // Getter和Setter省略
            }

            // PostgreSQL Repository - 使用特定数据源
            @Repository("analytics")
            @JdbcRepository(dialect = Dialect.POSTGRES)
            public interface AnalyticsEventRepository extends CrudRepository<AnalyticsEvent, Long> {
                @Query("SELECT * FROM analytics_events WHERE occurred_at >= :startDate " +
                       "AND occurred_at < :endDate ORDER BY occurred_at DESC")
                List<AnalyticsEvent> findEventsByDateRange(
                    LocalDateTime startDate,
                    LocalDateTime endDate
                );

                @Query("SELECT event_type, COUNT(*) as count FROM analytics_events " +
                       "WHERE occurred_at >= :date GROUP BY event_type")
                List<Map<String, Object>> getEventCountsByType(LocalDateTime date);
            }

            // 多数据源服务
            @Singleton
            public class MultiDataSourceService {
                private final ProductRepository productRepository;
                private final AnalyticsEventRepository analyticsRepository;

                public MultiDataSourceService(ProductRepository productRepository,
                                            AnalyticsEventRepository analyticsRepository) {
                    this.productRepository = productRepository;
                    this.analyticsRepository = analyticsRepository;
                    System.out.println("多数据源服务初始化");
                }

                @Transactional("default")  // 使用主数据源事务
                public Product createProduct(String name, BigDecimal price) {
                    System.out.println("创建产品: " + name);

                    Product product = new Product();
                    product.setName(name);
                    product.setPrice(price);
                    product.setCreatedAt(LocalDateTime.now());

                    Product saved = productRepository.save(product);

                    // 记录分析事件到PostgreSQL
                    recordAnalyticsEvent("product_created", saved.getId());

                    return saved;
                }

                @Transactional("analytics")  // 使用分析数据源事务
                public void recordAnalyticsEvent(String eventType, Long entityId) {
                    System.out.println("记录分析事件: " + eventType);

                    AnalyticsEvent event = new AnalyticsEvent();
                    event.setEventType(eventType);
                    event.setUserId(entityId);
                    event.setOccurredAt(LocalDateTime.now());
                    event.setProperties("{\"entity_id\": " + entityId + "}");

                    analyticsRepository.save(event);
                }

                public List<Product> searchProducts(String keyword) {
                    System.out.println("搜索产品: " + keyword);
                    return productRepository.searchByName(keyword);
                }

                public Map<String, Object> getAnalyticsSummary(LocalDateTime startDate) {
                    System.out.println("获取分析摘要");

                    List<Map<String, Object>> eventCounts =
                        analyticsRepository.getEventCountsByType(startDate);

                    Map<String, Object> summary = new HashMap<>();
                    summary.put("startDate", startDate);
                    summary.put("eventCounts", eventCounts);
                    summary.put("generatedAt", LocalDateTime.now());

                    return summary;
                }
            }

            // 数据库方言特定功能
            @Singleton
            public class DatabaseDialectService {

                // MySQL特定 - 全文搜索
                @Query(value = "SELECT * FROM products WHERE MATCH(name, description) " +
                              "AGAINST(:keyword IN NATURAL LANGUAGE MODE)",
                       nativeQuery = true)
                public List<Product> fullTextSearch(String keyword) {
                    // MySQL全文搜索功能
                    return Collections.emptyList();
                }

                // PostgreSQL特定 - 数组操作
                @Query(value = "SELECT * FROM users WHERE :tag = ANY(tags)",
                       nativeQuery = true)
                public List<User> findByTag(String tag) {
                    // PostgreSQL数组查询
                    return Collections.emptyList();
                }

                // Oracle特定 - 分页查询
                @Query(value = "SELECT * FROM (SELECT a.*, ROWNUM rnum FROM " +
                              "(SELECT * FROM products ORDER BY id) a WHERE ROWNUM <= :end) " +
                              "WHERE rnum > :start",
                       nativeQuery = true)
                public List<Product> findWithOraclePagination(int start, int end) {
                    // Oracle特定分页
                    return Collections.emptyList();
                }
            }
            ---
    b.NoSQL支持
        a.MongoDB集成
            通过Micronaut Data MongoDB模块支持MongoDB,提供与关系型数据库相同的Repository抽象。支持文档映射、查询构建、聚合操作等MongoDB特性。
        b.MongoDB配置示例
            ---
            // build.gradle - MongoDB依赖
            dependencies {
                annotationProcessor("io.micronaut.data:micronaut-data-processor")
                implementation("io.micronaut.data:micronaut-data-mongodb")
                runtimeOnly("org.mongodb:mongodb-driver-sync")
            }

            // application.yml - MongoDB配置
            mongodb:
              uri: mongodb://localhost:27017/mydb
              package-names:
                - com.example.domain

            // MongoDB文档实体
            import io.micronaut.data.mongodb.annotation.MongoRepository;
            import org.bson.types.ObjectId;
            import io.micronaut.data.annotation.Id;
            import io.micronaut.data.annotation.MappedEntity;

            @MappedEntity
            public class Article {
                @Id
                private ObjectId id;

                private String title;
                private String content;
                private String author;
                private List<String> tags;
                private LocalDateTime publishedAt;
                private int viewCount;
                private Map<String, Object> metadata;

                // 构造函数
                public Article() {}

                public Article(String title, String content, String author) {
                    this.title = title;
                    this.content = content;
                    this.author = author;
                    this.tags = new ArrayList<>();
                    this.publishedAt = LocalDateTime.now();
                    this.viewCount = 0;
                    this.metadata = new HashMap<>();
                }

                // Getter和Setter
                public ObjectId getId() { return id; }
                public void setId(ObjectId id) { this.id = id; }

                public String getTitle() { return title; }
                public void setTitle(String title) { this.title = title; }

                public String getContent() { return content; }
                public void setContent(String content) { this.content = content; }

                public String getAuthor() { return author; }
                public void setAuthor(String author) { this.author = author; }

                public List<String> getTags() { return tags; }
                public void setTags(List<String> tags) { this.tags = tags; }

                public LocalDateTime getPublishedAt() { return publishedAt; }
                public void setPublishedAt(LocalDateTime publishedAt) { this.publishedAt = publishedAt; }

                public int getViewCount() { return viewCount; }
                public void setViewCount(int viewCount) { this.viewCount = viewCount; }

                public Map<String, Object> getMetadata() { return metadata; }
                public void setMetadata(Map<String, Object> metadata) { this.metadata = metadata; }
            }

            // MongoDB Repository
            @MongoRepository
            public interface ArticleRepository extends CrudRepository<Article, ObjectId> {
                // 方法名查询
                List<Article> findByAuthor(String author);

                List<Article> findByTitleContaining(String keyword);

                List<Article> findByPublishedAtAfter(LocalDateTime date);

                List<Article> findByViewCountGreaterThan(int count);

                // 自定义查询
                @Query("{\"tags\": {\"$in\": :tags}}")
                List<Article> findByTags(List<String> tags);

                @Query("{\"author\": :author, \"publishedAt\": {\"$gte\": :startDate, \"$lt\": :endDate}}")
                List<Article> findByAuthorAndDateRange(
                    String author,
                    LocalDateTime startDate,
                    LocalDateTime endDate
                );

                // 聚合查询
                @Query(value = "{\"$group\": {\"_id\": \"$author\", \"count\": {\"$sum\": 1}}}")
                List<Map<String, Object>> countArticlesByAuthor();

                // 更新操作
                @Query(value = "{\"_id\": :id}",
                       update = "{\"$inc\": {\"viewCount\": 1}}")
                void incrementViewCount(ObjectId id);
            }

            // MongoDB服务
            @Singleton
            public class ArticleService {
                private final ArticleRepository articleRepository;

                public ArticleService(ArticleRepository articleRepository) {
                    this.articleRepository = articleRepository;
                    System.out.println("ArticleService初始化");
                }

                public Article createArticle(String title, String content, String author) {
                    System.out.println("创建文章: " + title);

                    Article article = new Article(title, content, author);
                    Article saved = articleRepository.save(article);

                    System.out.println("文章已保存, ID: " + saved.getId());
                    return saved;
                }

                public void addTags(ObjectId articleId, List<String> tags) {
                    System.out.println("添加标签: " + tags);

                    Optional<Article> optionalArticle = articleRepository.findById(articleId);
                    if (optionalArticle.isPresent()) {
                        Article article = optionalArticle.get();
                        article.getTags().addAll(tags);
                        articleRepository.update(article);
                        System.out.println("标签已添加");
                    }
                }

                public List<Article> findByTags(List<String> tags) {
                    System.out.println("按标签查询: " + tags);
                    return articleRepository.findByTags(tags);
                }

                public void incrementViewCount(ObjectId articleId) {
                    System.out.println("增加浏览次数: " + articleId);
                    articleRepository.incrementViewCount(articleId);
                }

                public List<Article> getPopularArticles(int minViews) {
                    System.out.println("查询热门文章 (浏览 > " + minViews + ")");
                    return articleRepository.findByViewCountGreaterThan(minViews);
                }

                public Map<String, Long> getArticleCountByAuthor() {
                    System.out.println("统计作者文章数");

                    List<Map<String, Object>> results = articleRepository.countArticlesByAuthor();
                    Map<String, Long> counts = new HashMap<>();

                    for (Map<String, Object> result : results) {
                        String author = (String) result.get("_id");
                        Number count = (Number) result.get("count");
                        counts.put(author, count.longValue());
                    }

                    return counts;
                }
            }

            // MongoDB控制器
            @Controller("/api/articles")
            public class ArticleController {
                private final ArticleService articleService;

                public ArticleController(ArticleService articleService) {
                    this.articleService = articleService;
                }

                @Post
                public Article create(@Body CreateArticleRequest request) {
                    return articleService.createArticle(
                        request.getTitle(),
                        request.getContent(),
                        request.getAuthor()
                    );
                }

                @Post("/{id}/tags")
                public void addTags(String id, @Body List<String> tags) {
                    articleService.addTags(new ObjectId(id), tags);
                }

                @Get("/tags")
                public List<Article> findByTags(@QueryValue List<String> tags) {
                    return articleService.findByTags(tags);
                }

                @Get("/popular")
                public List<Article> getPopular(
                    @QueryValue(defaultValue = "100") int minViews) {
                    return articleService.getPopularArticles(minViews);
                }

                @Get("/stats/authors")
                public Map<String, Long> getAuthorStats() {
                    return articleService.getArticleCountByAuthor();
                }
            }

            // 请求对象
            public class CreateArticleRequest {
                private String title;
                private String content;
                private String author;

                // Getter和Setter省略
            }
            ---

03.查询方法
    a.方法名派生
        a.命名规范
            根据方法名自动生成查询实现,支持丰富的关键字如findBy、countBy、deleteBy、existsBy等。支持And、Or、Between、LessThan、GreaterThan等条件组合。
        b.方法名查询示例
            ---
            @Repository
            public interface UserRepository extends JpaRepository<User, Long> {

                // === 基础查询 ===

                // 按单个字段查询
                Optional<User> findByUsername(String username);
                List<User> findByEmail(String email);

                // 查询所有
                List<User> findByActive(boolean active);

                // 计数
                long countByActive(boolean active);
                long countByCreatedAtAfter(LocalDateTime date);

                // 存在性检查
                boolean existsByUsername(String username);
                boolean existsByEmail(String email);

                // 删除
                void deleteByUsername(String username);
                long deleteByActiveAndCreatedAtBefore(boolean active, LocalDateTime date);

                // === 条件组合 ===

                // And条件
                Optional<User> findByUsernameAndEmail(String username, String email);
                List<User> findByActiveAndCreatedAtAfter(boolean active, LocalDateTime date);

                // Or条件
                List<User> findByUsernameOrEmail(String username, String email);
                List<User> findByActiveOrVerified(boolean active, boolean verified);

                // === 比较操作 ===

                // 大于/小于
                List<User> findByAgeGreaterThan(int age);
                List<User> findByAgeLessThan(int age);
                List<User> findByAgeGreaterThanEqual(int age);
                List<User> findByAgeLessThanEqual(int age);

                // Between
                List<User> findByAgeBetween(int minAge, int maxAge);
                List<User> findByCreatedAtBetween(LocalDateTime start, LocalDateTime end);

                // === 字符串操作 ===

                // Like
                List<User> findByUsernameLike(String pattern);
                List<User> findByEmailContaining(String emailPart);
                List<User> findByUsernameStartingWith(String prefix);
                List<User> findByUsernameEndingWith(String suffix);

                // IgnoreCase
                Optional<User> findByUsernameIgnoreCase(String username);
                List<User> findByEmailContainingIgnoreCase(String emailPart);

                // === 空值处理 ===

                List<User> findByPhoneIsNull();
                List<User> findByPhoneIsNotNull();

                // === 集合操作 ===

                List<User> findByIdIn(List<Long> ids);
                List<User> findByUsernameIn(Collection<String> usernames);
                List<User> findByIdNotIn(List<Long> ids);

                // === 排序 ===

                List<User> findByActiveOrderByCreatedAtDesc(boolean active);
                List<User> findByActiveOrderByUsernameAscCreatedAtDesc(boolean active);

                // === 分页和限制 ===

                // 限制结果数量
                List<User> findTop10ByActive(boolean active);
                List<User> findFirst5ByActiveOrderByCreatedAtDesc(boolean active);

                // 使用Pageable分页
                Page<User> findByActive(boolean active, Pageable pageable);
                Slice<User> findByEmailContaining(String emailPart, Pageable pageable);

                // === 投��查询 ===

                // 只查询特定字段
                List<String> findUsernameByActive(boolean active);
                List<UserProjection> findProjectionByActive(boolean active);

                // === Distinct ===

                List<String> findDistinctEmailByActive(boolean active);

                // === 复杂组合示例 ===

                List<User> findByActiveAndAgeBetweenAndEmailContainingIgnoreCaseOrderByCreatedAtDesc(
                    boolean active,
                    int minAge,
                    int maxAge,
                    String emailPart
                );

                List<User> findTop10ByActiveOrVerifiedAndCreatedAtAfterOrderByUsernameAsc(
                    boolean active,
                    boolean verified,
                    LocalDateTime date
                );
            }

            // 投影接口
            public interface UserProjection {
                String getUsername();
                String getEmail();
                LocalDateTime getCreatedAt();
            }

            // 使用示例
            @Singleton
            public class QueryMethodService {
                private final UserRepository userRepository;

                public QueryMethodService(UserRepository userRepository) {
                    this.userRepository = userRepository;
                }

                public void demonstrateQueryMethods() {
                    System.out.println("=== 查询方法演示 ===\n");

                    // 基础查询
                    System.out.println("1. 按用户名查询:");
                    Optional<User> user = userRepository.findByUsername("john");
                    user.ifPresent(u -> System.out.println("  找到: " + u));

                    // 条件组合
                    System.out.println("\n2. And条件查询:");
                    LocalDateTime cutoffDate = LocalDateTime.now().minusDays(30);
                    List<User> activeUsers = userRepository.findByActiveAndCreatedAtAfter(
                        true, cutoffDate
                    );
                    System.out.println("  找到 " + activeUsers.size() + " 个活跃用户");

                    // 字符串模糊查询
                    System.out.println("\n3. 邮箱模糊查询:");
                    List<User> gmailUsers = userRepository.findByEmailContaining("gmail");
                    System.out.println("  找到 " + gmailUsers.size() + " 个Gmail用户");

                    // 范围查询
                    System.out.println("\n4. 年龄范围查询:");
                    List<User> adults = userRepository.findByAgeBetween(18, 65);
                    System.out.println("  找到 " + adults.size() + " 个成年用户");

                    // 排序查询
                    System.out.println("\n5. 排序查询:");
                    List<User> sortedUsers = userRepository
                        .findByActiveOrderByCreatedAtDesc(true);
                    System.out.println("  按时间倒序查询到 " + sortedUsers.size() + " 个用户");

                    // 分页查询
                    System.out.println("\n6. 分页查询:");
                    Pageable pageable = Pageable.from(0, 10);
                    Page<User> page = userRepository.findByActive(true, pageable);
                    System.out.println("  第1页: " + page.getContent().size() + " 个用户");
                    System.out.println("  总数: " + page.getTotalSize());
                    System.out.println("  总页数: " + page.getTotalPages());

                    // 限制结果
                    System.out.println("\n7. Top N查询:");
                    List<User> topUsers = userRepository
                        .findTop10ByActive(true);
                    System.out.println("  查询到前 " + topUsers.size() + " 个用户");

                    // 存在性检查
                    System.out.println("\n8. 存在性检查:");
                    boolean exists = userRepository.existsByUsername("admin");
                    System.out.println("  admin用户" + (exists ? "存在" : "不存在"));

                    // 计数
                    System.out.println("\n9. 计数查询:");
                    long count = userRepository.countByActive(true);
                    System.out.println("  活跃用户数: " + count);
                }
            }

            // 查询方法命名规则总结
            // 前缀: find, read, get, query, search, stream
            // 条件: By + 字段名 + 操作符
            // 操作符:
            //   - 相等: 无后缀 (findByName)
            //   - Like: Like, Containing, StartingWith, EndingWith
            //   - 比较: GreaterThan, LessThan, Between
            //   - 空值: IsNull, IsNotNull
            //   - 集合: In, NotIn
            //   - 逻辑: And, Or
            //   - 忽略大小写: IgnoreCase
            // 排序: OrderBy + 字段名 + Asc/Desc
            // 限制: Top/First + 数字
            ---
    b.@Query注解
        a.自定义查询
            使用@Query注解编写JPQL或原生SQL查询,实现复杂查询逻辑。支持命名参数、位置参数、动态查询等,提供更灵活的查询能力。
        b.自定义查询示例
            ---
            @Repository
            public interface AdvancedUserRepository extends JpaRepository<User, Long> {

                // === JPQL查询 ===

                // 基础JPQL
                @Query("SELECT u FROM User u WHERE u.username = :username")
                Optional<User> findUserByUsername(@Param("username") String username);

                @Query("SELECT u FROM User u WHERE u.active = :active ORDER BY u.createdAt DESC")
                List<User> findActiveUsers(@Param("active") boolean active);

                // 联接查询
                @Query("SELECT u FROM User u LEFT JOIN FETCH u.roles WHERE u.id = :id")
                Optional<User> findUserWithRoles(@Param("id") Long id);

                @Query("SELECT u FROM User u JOIN u.orders o WHERE o.status = :status")
                List<User> findUsersWithOrderStatus(@Param("status") String status);

                // 聚合查询
                @Query("SELECT COUNT(u) FROM User u WHERE u.createdAt >= :date")
                long countNewUsers(@Param("date") LocalDateTime date);

                @Query("SELECT u.department, COUNT(u) FROM User u GROUP BY u.department")
                List<Object[]> countUsersByDepartment();

                // 子查询
                @Query("SELECT u FROM User u WHERE u.id IN " +
                       "(SELECT o.userId FROM Order o WHERE o.total > :amount)")
                List<User> findUsersWithLargeOrders(@Param("amount") BigDecimal amount);

                // === 原生SQL查询 ===

                @Query(value = "SELECT * FROM users WHERE username LIKE CONCAT(:prefix, '%')",
                       nativeQuery = true)
                List<User> findByUsernamePrefix(@Param("prefix") String prefix);

                @Query(value = "SELECT u.*, COUNT(o.id) as order_count FROM users u " +
                              "LEFT JOIN orders o ON u.id = o.user_id " +
                              "GROUP BY u.id HAVING COUNT(o.id) > :minOrders",
                       nativeQuery = true)
                List<Object[]> findUsersWithMinOrders(@Param("minOrders") int minOrders);

                // 数据库特定功能
                @Query(value = "SELECT * FROM users WHERE MATCH(username, email) " +
                              "AGAINST(:keyword IN BOOLEAN MODE)",
                       nativeQuery = true)
                List<User> fullTextSearch(@Param("keyword") String keyword);

                // === 修改查询 ===

                @Modifying
                @Query("UPDATE User u SET u.active = :active WHERE u.lastLoginAt < :date")
                int deactivateInactiveUsers(
                    @Param("active") boolean active,
                    @Param("date") LocalDateTime date
                );

                @Modifying
                @Query("DELETE FROM User u WHERE u.active = false AND u.createdAt < :date")
                int deleteInactiveUsers(@Param("date") LocalDateTime date);

                @Modifying
                @Query("UPDATE User u SET u.loginCount = u.loginCount + 1, " +
                       "u.lastLoginAt = :now WHERE u.id = :id")
                void updateLoginInfo(@Param("id") Long id, @Param("now") LocalDateTime now);

                // === 动态查询 ===

                @Query("SELECT u FROM User u WHERE " +
                       "(:username IS NULL OR u.username LIKE CONCAT('%', :username, '%')) AND " +
                       "(:email IS NULL OR u.email LIKE CONCAT('%', :email, '%')) AND " +
                       "(:active IS NULL OR u.active = :active)")
                List<User> dynamicSearch(
                    @Param("username") @Nullable String username,
                    @Param("email") @Nullable String email,
                    @Param("active") @Nullable Boolean active
                );

                // === 投影查询 ===

                @Query("SELECT new map(u.username as username, u.email as email, " +
                       "u.createdAt as createdAt) FROM User u WHERE u.active = true")
                List<Map<String, Object>> findActiveUserProjections();

                @Query("SELECT u.username FROM User u WHERE u.department = :dept")
                List<String> findUsernamesByDepartment(@Param("dept") String department);

                // DTO投影
                @Query("SELECT new com.example.dto.UserSummaryDTO(u.id, u.username, u.email) " +
                       "FROM User u WHERE u.active = true")
                List<UserSummaryDTO> findUserSummaries();

                // === 分页查询 ===

                @Query("SELECT u FROM User u WHERE u.department = :dept ORDER BY u.createdAt DESC")
                Page<User> findByDepartment(@Param("dept") String department, Pageable pageable);

                @Query(value = "SELECT * FROM users WHERE department = :dept",
                       countQuery = "SELECT COUNT(*) FROM users WHERE department = :dept",
                       nativeQuery = true)
                Page<User> findByDepartmentNative(@Param("dept") String department, Pageable pageable);

                // === 命名参数 vs 位置参数 ===

                // 命名参数 (推荐)
                @Query("SELECT u FROM User u WHERE u.username = :username AND u.email = :email")
                Optional<User> findByUsernameAndEmail(
                    @Param("username") String username,
                    @Param("email") String email
                );

                // 位置参数
                @Query("SELECT u FROM User u WHERE u.username = ?1 AND u.email = ?2")
                Optional<User> findByUsernameAndEmailPositional(String username, String email);

                // === 集合参数 ===

                @Query("SELECT u FROM User u WHERE u.id IN :ids")
                List<User> findByIds(@Param("ids") List<Long> ids);

                @Query("SELECT u FROM User u WHERE u.role IN :roles AND u.active = true")
                List<User> findByRoles(@Param("roles") Collection<String> roles);
            }

            // DTO对象
            public class UserSummaryDTO {
                private Long id;
                private String username;
                private String email;

                public UserSummaryDTO(Long id, String username, String email) {
                    this.id = id;
                    this.username = username;
                    this.email = email;
                }

                // Getter省略
            }

            // 使用示例
            @Singleton
            public class CustomQueryService {
                private final AdvancedUserRepository userRepository;

                public CustomQueryService(AdvancedUserRepository userRepository) {
                    this.userRepository = userRepository;
                }

                public void demonstrateCustomQueries() {
                    System.out.println("=== 自定义查询演示 ===\n");

                    // JPQL查询
                    System.out.println("1. JPQL查询:");
                    List<User> activeUsers = userRepository.findActiveUsers(true);
                    System.out.println("  找到 " + activeUsers.size() + " 个活跃用户");

                    // 聚合查询
                    System.out.println("\n2. 聚合查询:");
                    List<Object[]> deptCounts = userRepository.countUsersByDepartment();
                    deptCounts.forEach(row ->
                        System.out.println("  " + row[0] + ": " + row[1] + " 人")
                    );

                    // 动态查���
                    System.out.println("\n3. 动态查询:");
                    List<User> searchResults = userRepository.dynamicSearch(
                        "john",
                        null,
                        true
                    );
                    System.out.println("  找到 " + searchResults.size() + " 个匹配用户");

                    // 投影查询
                    System.out.println("\n4. 投影查询:");
                    List<UserSummaryDTO> summaries = userRepository.findUserSummaries();
                    System.out.println("  查询到 " + summaries.size() + " 个用户摘要");

                    // 修改查询
                    System.out.println("\n5. 批量更新:");
                    LocalDateTime cutoffDate = LocalDateTime.now().minusMonths(6);
                    int deactivated = userRepository.deactivateInactiveUsers(false, cutoffDate);
                    System.out.println("  停用了 " + deactivated + " 个不活跃用户");

                    // 分页查询
                    System.out.println("\n6. 分页查询:");
                    Pageable pageable = Pageable.from(0, 10);
                    Page<User> page = userRepository.findByDepartment("Engineering", pageable);
                    System.out.println("  第1页: " + page.getContent().size() + " 个用户");
                    System.out.println("  总数: " + page.getTotalSize());
                }
            }
            ---

5.2 Repository模式

01.Repository接口
    a.CrudRepository
        a.基础CRUD操作
            CrudRepository提供基本的增删改查操作,包括save、findById、findAll、delete等方法。作为最基础的Repository接口,适合简单的数据访问需求。
        b.CrudRepository示例
            ---
            import io.micronaut.data.repository.CrudRepository;
            import io.micronaut.data.annotation.Repository;

            // 基础CRUD Repository
            @Repository
            public interface ProductRepository extends CrudRepository<Product, Long> {
                // 继承的方法:
                // - <S extends Product> S save(S entity)
                // - <S extends Product> Iterable<S> saveAll(Iterable<S> entities)
                // - Optional<Product> findById(Long id)
                // - boolean existsById(Long id)
                // - Iterable<Product> findAll()
                // - long count()
                // - void deleteById(Long id)
                // - void delete(Product entity)
                // - void deleteAll(Iterable<? extends Product> entities)
                // - void deleteAll()
            }

            // 产品实体
            @Entity
            @Table(name = "products")
            public class Product {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                @Column(precision = 10, scale = 2)
                private BigDecimal price;

                @Column
                private Integer stock;

                @Column
                private String category;

                @Column(name = "created_at")
                private LocalDateTime createdAt;

                // 构造函数
                public Product() {}

                public Product(String name, BigDecimal price, Integer stock) {
                    this.name = name;
                    this.price = price;
                    this.stock = stock;
                    this.createdAt = LocalDateTime.now();
                }

                // Getter和Setter省略
            }

            // 使用CrudRepository
            @Singleton
            public class ProductService {
                private final ProductRepository productRepository;

                public ProductService(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                    System.out.println("ProductService初始化");
                }

                // 创建产品
                public Product createProduct(String name, BigDecimal price, Integer stock) {
                    System.out.println("创建产品: " + name);

                    Product product = new Product(name, price, stock);
                    Product saved = productRepository.save(product);

                    System.out.println("  产品已保存, ID: " + saved.getId());
                    return saved;
                }

                // 批量创建
                public List<Product> createProducts(List<Product> products) {
                    System.out.println("批量创建产品: " + products.size() + " 个");

                    Iterable<Product> saved = productRepository.saveAll(products);
                    List<Product> result = new ArrayList<>();
                    saved.forEach(result::add);

                    System.out.println("  批量保存完成");
                    return result;
                }

                // 查询单个产品
                public Optional<Product> findProduct(Long id) {
                    System.out.println("查询产品: " + id);
                    return productRepository.findById(id);
                }

                // 查询所有产品
                public List<Product> findAllProducts() {
                    System.out.println("查询所有产品");

                    Iterable<Product> products = productRepository.findAll();
                    List<Product> result = new ArrayList<>();
                    products.forEach(result::add);

                    System.out.println("  找到 " + result.size() + " 个产品");
                    return result;
                }

                // 检查产品是否存在
                public boolean productExists(Long id) {
                    System.out.println("检查产品是否存在: " + id);
                    return productRepository.existsById(id);
                }

                // 统计产品数量
                public long countProducts() {
                    long count = productRepository.count();
                    System.out.println("产品总数: " + count);
                    return count;
                }

                // 更新产品
                public Product updateProduct(Long id, String name, BigDecimal price) {
                    System.out.println("更新产品: " + id);

                    Optional<Product> optionalProduct = productRepository.findById(id);
                    if (optionalProduct.isEmpty()) {
                        throw new IllegalArgumentException("产品不存在: " + id);
                    }

                    Product product = optionalProduct.get();
                    product.setName(name);
                    product.setPrice(price);

                    Product updated = productRepository.update(product);
                    System.out.println("  产品已更新");
                    return updated;
                }

                // 删除产品
                public void deleteProduct(Long id) {
                    System.out.println("删除产品: " + id);
                    productRepository.deleteById(id);
                    System.out.println("  产品已删除");
                }

                // 批量删除
                public void deleteProducts(List<Long> ids) {
                    System.out.println("批量删除产品: " + ids.size() + " 个");

                    List<Product> products = ids.stream()
                        .map(id -> {
                            Product p = new Product();
                            p.setId(id);
                            return p;
                        })
                        .collect(Collectors.toList());

                    productRepository.deleteAll(products);
                    System.out.println("  批量删除完成");
                }

                // 清空所有产品
                public void deleteAllProducts() {
                    System.out.println("删除所有产品");
                    productRepository.deleteAll();
                    System.out.println("  所有产品已删除");
                }
            }

            // 控制器
            @Controller("/api/products")
            public class ProductController {
                private final ProductService productService;

                public ProductController(ProductService productService) {
                    this.productService = productService;
                }

                @Post
                public Product create(@Body CreateProductRequest request) {
                    return productService.createProduct(
                        request.getName(),
                        request.getPrice(),
                        request.getStock()
                    );
                }

                @Get("/{id}")
                public Optional<Product> get(Long id) {
                    return productService.findProduct(id);
                }

                @Get
                public List<Product> getAll() {
                    return productService.findAllProducts();
                }

                @Put("/{id}")
                public Product update(Long id, @Body UpdateProductRequest request) {
                    return productService.updateProduct(
                        id,
                        request.getName(),
                        request.getPrice()
                    );
                }

                @Delete("/{id}")
                @Status(HttpStatus.NO_CONTENT)
                public void delete(Long id) {
                    productService.deleteProduct(id);
                }

                @Get("/count")
                public Map<String, Long> count() {
                    return Map.of("count", productService.countProducts());
                }
            }

            // 请求对象
            public class CreateProductRequest {
                private String name;
                private BigDecimal price;
                private Integer stock;

                // Getter和Setter省略
            }

            public class UpdateProductRequest {
                private String name;
                private BigDecimal price;

                // Getter和Setter省略
            }
            ---
    b.JpaRepository
        a.JPA扩展功能
            JpaRepository扩展CrudRepository,添加flush、saveAndFlush等JPA特定方法。提供批量操作优化,支持实体状态管理,适合使用JPA的应用。
        b.JpaRepository示例
            ---
            import io.micronaut.data.jpa.repository.JpaRepository;
            import io.micronaut.data.jpa.repository.criteria.Specification;

            @Repository
            public interface OrderRepository extends JpaRepository<Order, Long> {
                // 继承CrudRepository的所有方法,额外提供:
                // - void flush()
                // - <S extends Order> S saveAndFlush(S entity)
                // - void deleteInBatch(Iterable<Order> entities)
                // - void deleteAllInBatch()
                // - Order getOne(Long id)
                // - List<Order> findAll(Specification<Order> spec)
            }

            // 订单实体
            @Entity
            @Table(name = "orders")
            public class Order {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(name = "order_number", unique = true)
                private String orderNumber;

                @Column(name = "user_id")
                private Long userId;

                @Column
                private String status;  // PENDING, CONFIRMED, SHIPPED, DELIVERED

                @Column(precision = 10, scale = 2)
                private BigDecimal total;

                @OneToMany(mappedBy = "order", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
                private List<OrderItem> items = new ArrayList<>();

                @Column(name = "created_at")
                private LocalDateTime createdAt;

                @Column(name = "updated_at")
                private LocalDateTime updatedAt;

                @PrePersist
                protected void onCreate() {
                    createdAt = LocalDateTime.now();
                    updatedAt = LocalDateTime.now();
                }

                @PreUpdate
                protected void onUpdate() {
                    updatedAt = LocalDateTime.now();
                }

                // Getter和Setter省略
            }

            // 订单项实体
            @Entity
            @Table(name = "order_items")
            public class OrderItem {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @ManyToOne(fetch = FetchType.LAZY)
                @JoinColumn(name = "order_id")
                private Order order;

                @Column(name = "product_id")
                private Long productId;

                @Column
                private Integer quantity;

                @Column(precision = 10, scale = 2)
                private BigDecimal price;

                // Getter和Setter省略
            }

            // 使用JpaRepository
            @Singleton
            public class OrderService {
                private final OrderRepository orderRepository;

                public OrderService(OrderRepository orderRepository) {
                    this.orderRepository = orderRepository;
                    System.out.println("OrderService初始化");
                }

                // 创建订单并立即刷新
                @Transactional
                public Order createOrderAndFlush(Long userId, List<OrderItem> items) {
                    System.out.println("创建订单: 用户ID=" + userId);

                    Order order = new Order();
                    order.setOrderNumber(generateOrderNumber());
                    order.setUserId(userId);
                    order.setStatus("PENDING");

                    // 添加订单项
                    BigDecimal total = BigDecimal.ZERO;
                    for (OrderItem item : items) {
                        item.setOrder(order);
                        order.getItems().add(item);
                        total = total.add(item.getPrice().multiply(
                            BigDecimal.valueOf(item.getQuantity())
                        ));
                    }
                    order.setTotal(total);

                    // 保存并立即刷新到数据库
                    Order saved = orderRepository.saveAndFlush(order);
                    System.out.println("  订单已保存并刷新, ID: " + saved.getId());
                    System.out.println("  订单号: " + saved.getOrderNumber());

                    return saved;
                }

                // 批量删除订单
                @Transactional
                public void deleteOrdersInBatch(List<Long> orderIds) {
                    System.out.println("批量删除订单: " + orderIds.size() + " 个");

                    List<Order> orders = orderIds.stream()
                        .map(id -> {
                            Order order = new Order();
                            order.setId(id);
                            return order;
                        })
                        .collect(Collectors.toList());

                    // 批量删除,减少数据库交互
                    orderRepository.deleteInBatch(orders);
                    System.out.println("  批量删除完成");
                }

                // 手动刷新
                @Transactional
                public void updateOrderStatus(Long orderId, String newStatus) {
                    System.out.println("更新订单状态: " + orderId + " -> " + newStatus);

                    Optional<Order> optionalOrder = orderRepository.findById(orderId);
                    if (optionalOrder.isEmpty()) {
                        throw new IllegalArgumentException("订单不存在: " + orderId);
                    }

                    Order order = optionalOrder.get();
                    order.setStatus(newStatus);

                    // 保存但不立即刷新
                    orderRepository.save(order);

                    // 执行其他操作...

                    // 手动刷新到数据库
                    orderRepository.flush();
                    System.out.println("  订单状态已更新并刷新");
                }

                // 获取订单引用
                public Order getOrderReference(Long id) {
                    System.out.println("获取订单引用: " + id);
                    // getOne返回懒加载代理,不立即查询数据库
                    return orderRepository.getOne(id);
                }

                // 查询订单
                public Optional<Order> findOrder(Long id) {
                    System.out.println("查询订单: " + id);
                    return orderRepository.findById(id);
                }

                // 统计订单
                public Map<String, Object> getOrderStatistics() {
                    System.out.println("统计订单信息");

                    long totalOrders = orderRepository.count();

                    Map<String, Object> stats = new HashMap<>();
                    stats.put("totalOrders", totalOrders);
                    stats.put("timestamp", LocalDateTime.now());

                    return stats;
                }

                private String generateOrderNumber() {
                    return "ORD-" + System.currentTimeMillis();
                }
            }

            // 控制器
            @Controller("/api/orders")
            public class OrderController {
                private final OrderService orderService;

                public OrderController(OrderService orderService) {
                    this.orderService = orderService;
                }

                @Post
                public Order create(@Body CreateOrderRequest request) {
                    return orderService.createOrderAndFlush(
                        request.getUserId(),
                        request.getItems()
                    );
                }

                @Get("/{id}")
                public Optional<Order> get(Long id) {
                    return orderService.findOrder(id);
                }

                @Put("/{id}/status")
                public void updateStatus(Long id, @Body UpdateStatusRequest request) {
                    orderService.updateOrderStatus(id, request.getStatus());
                }

                @Delete("/batch")
                @Status(HttpStatus.NO_CONTENT)
                public void deleteBatch(@Body List<Long> orderIds) {
                    orderService.deleteOrdersInBatch(orderIds);
                }

                @Get("/statistics")
                public Map<String, Object> getStatistics() {
                    return orderService.getOrderStatistics();
                }
            }

            // 请求对象
            public class CreateOrderRequest {
                private Long userId;
                private List<OrderItem> items;

                // Getter和Setter省略
            }

            public class UpdateStatusRequest {
                private String status;

                // Getter和Setter省略
            }
            ---

02.分页与排序
    a.Pageable接口
        a.分页查询
            使用Pageable接口实现分页查询,支持页码、页大小、排序等参数。返回Page对象包含数据列表、总数、总页数等分页信息,简化分页实现。
        b.分页查询示例
            ---
            import io.micronaut.data.model.Page;
            import io.micronaut.data.model.Pageable;
            import io.micronaut.data.model.Sort;

            @Repository
            public interface BookRepository extends JpaRepository<Book, Long> {
                // 基础分页
                Page<Book> findAll(Pageable pageable);

                // 条件分页
                Page<Book> findByCategory(String category, Pageable pageable);

                Page<Book> findByAuthor(String author, Pageable pageable);

                Page<Book> findByPriceBetween(BigDecimal minPrice, BigDecimal maxPrice, Pageable pageable);

                // 复杂条件分页
                Page<Book> findByTitleContainingAndCategoryOrderByPublishedDateDesc(
                    String title,
                    String category,
                    Pageable pageable
                );
            }

            // 图书实体
            @Entity
            @Table(name = "books")
            public class Book {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String title;

                @Column
                private String author;

                @Column
                private String category;

                @Column
                private String isbn;

                @Column(precision = 10, scale = 2)
                private BigDecimal price;

                @Column(name = "published_date")
                private LocalDate publishedDate;

                @Column
                private Integer pageCount;

                @Column(columnDefinition = "TEXT")
                private String description;

                // Getter和Setter省略
            }

            // 分页服务
            @Singleton
            public class BookService {
                private final BookRepository bookRepository;

                public BookService(BookRepository bookRepository) {
                    this.bookRepository = bookRepository;
                    System.out.println("BookService初始化");
                }

                // 基础分页查询
                public Page<Book> findBooks(int page, int size) {
                    System.out.println("分页查询图书: page=" + page + ", size=" + size);

                    Pageable pageable = Pageable.from(page, size);
                    Page<Book> result = bookRepository.findAll(pageable);

                    System.out.println("  当前页: " + result.getPageNumber());
                    System.out.println("  页大小: " + result.getSize());
                    System.out.println("  总记录数: " + result.getTotalSize());
                    System.out.println("  总页数: " + result.getTotalPages());
                    System.out.println("  当前页记录数: " + result.getContent().size());

                    return result;
                }

                // 带排序的分页
                public Page<Book> findBooksWithSort(int page, int size, String sortBy, String direction) {
                    System.out.println("排序分页查询: page=" + page + ", size=" + size +
                                     ", sort=" + sortBy + " " + direction);

                    Sort.Order order = direction.equalsIgnoreCase("ASC") ?
                        Sort.Order.asc(sortBy) :
                        Sort.Order.desc(sortBy);

                    Pageable pageable = Pageable.from(page, size, Sort.of(order));
                    Page<Book> result = bookRepository.findAll(pageable);

                    System.out.println("  找到 " + result.getContent().size() + " 本图书");
                    return result;
                }

                // 多字段排序
                public Page<Book> findBooksWithMultipleSort(int page, int size) {
                    System.out.println("多字段排序分页查询");

                    Sort sort = Sort.of(
                        Sort.Order.desc("publishedDate"),
                        Sort.Order.asc("title")
                    );

                    Pageable pageable = Pageable.from(page, size, sort);
                    Page<Book> result = bookRepository.findAll(pageable);

                    return result;
                }

                // 按分类分页
                public Page<Book> findBooksByCategory(String category, int page, int size) {
                    System.out.println("按分类分页: " + category);

                    Pageable pageable = Pageable.from(page, size);
                    Page<Book> result = bookRepository.findByCategory(category, pageable);

                    System.out.println("  分类 '" + category + "' 总数: " + result.getTotalSize());
                    return result;
                }

                // 价格范围分页
                public Page<Book> findBooksByPriceRange(BigDecimal minPrice, BigDecimal maxPrice,
                                                        int page, int size) {
                    System.out.println("价格范围分页: " + minPrice + " - " + maxPrice);

                    Sort sort = Sort.of(Sort.Order.asc("price"));
                    Pageable pageable = Pageable.from(page, size, sort);

                    Page<Book> result = bookRepository.findByPriceBetween(minPrice, maxPrice, pageable);

                    System.out.println("  找到 " + result.getTotalSize() + " 本符合价格范围的图书");
                    return result;
                }

                // 搜索分页
                public Page<Book> searchBooks(String keyword, String category, int page, int size) {
                    System.out.println("搜索图书: keyword=" + keyword + ", category=" + category);

                    Sort sort = Sort.of(Sort.Order.desc("publishedDate"));
                    Pageable pageable = Pageable.from(page, size, sort);

                    Page<Book> result = bookRepository
                        .findByTitleContainingAndCategoryOrderByPublishedDateDesc(
                            keyword,
                            category,
                            pageable
                        );

                    return result;
                }

                // 分页导航
                public Map<String, Object> getPageInfo(Page<Book> page) {
                    Map<String, Object> info = new HashMap<>();

                    info.put("currentPage", page.getPageNumber());
                    info.put("pageSize", page.getSize());
                    info.put("totalPages", page.getTotalPages());
                    info.put("totalElements", page.getTotalSize());
                    info.put("hasNext", page.getPageNumber() < page.getTotalPages() - 1);
                    info.put("hasPrevious", page.getPageNumber() > 0);
                    info.put("isFirst", page.getPageNumber() == 0);
                    info.put("isLast", page.getPageNumber() == page.getTotalPages() - 1);
                    info.put("content", page.getContent());

                    return info;
                }
            }

            // 分页控制器
            @Controller("/api/books")
            public class BookController {
                private final BookService bookService;

                public BookController(BookService bookService) {
                    this.bookService = bookService;
                }

                // 基础分页
                @Get
                public Page<Book> list(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    return bookService.findBooks(page, size);
                }

                // 带排序的分页
                @Get("/sorted")
                public Page<Book> listSorted(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size,
                    @QueryValue(defaultValue = "title") String sort,
                    @QueryValue(defaultValue = "ASC") String direction) {
                    return bookService.findBooksWithSort(page, size, sort, direction);
                }

                // 按分类分页
                @Get("/category/{category}")
                public Page<Book> listByCategory(
                    String category,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    return bookService.findBooksByCategory(category, page, size);
                }

                // 价格范围分页
                @Get("/price-range")
                public Page<Book> listByPriceRange(
                    @QueryValue BigDecimal minPrice,
                    @QueryValue BigDecimal maxPrice,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    return bookService.findBooksByPriceRange(minPrice, maxPrice, page, size);
                }

                // 搜索分页
                @Get("/search")
                public Page<Book> search(
                    @QueryValue String keyword,
                    @QueryValue String category,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    return bookService.searchBooks(keyword, category, page, size);
                }

                // 分页信息
                @Get("/page-info")
                public Map<String, Object> getPageInfo(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size) {
                    Page<Book> bookPage = bookService.findBooks(page, size);
                    return bookService.getPageInfo(bookPage);
                }
            }

            // 分页响应示例
            // GET /api/books?page=0&size=10
            // {
            //   "content": [...],
            //   "pageable": {
            //     "number": 0,
            //     "size": 10,
            //     "sort": {
            //       "sorted": false
            //     }
            //   },
            //   "totalPages": 15,
            //   "totalSize": 150,
            //   "size": 10,
            //   "number": 0
            // }
            ---
    b.Sort排序
        a.排序配置
            通过Sort对象配置查询结果的排序方式,支持单字段和多字段排序,可指定升序或降序。排序配置可独立使用或与分页结合。
        b.排序配置示例
            ---
            @Singleton
            public class SortingService {
                private final BookRepository bookRepository;

                public SortingService(BookRepository bookRepository) {
                    this.bookRepository = bookRepository;
                }

                // 单字段排序
                public List<Book> findBooksSortedByTitle() {
                    System.out.println("按标题排序查询");

                    Sort sort = Sort.of(Sort.Order.asc("title"));
                    Pageable pageable = Pageable.from(0, 100, sort);

                    return bookRepository.findAll(pageable).getContent();
                }

                // 多字段排序
                public List<Book> findBooksSortedByMultipleFields() {
                    System.out.println("多字段排序查询");

                    Sort sort = Sort.of(
                        Sort.Order.desc("publishedDate"),  // 首先按出版日期降序
                        Sort.Order.asc("title"),           // 然后按标题升序
                        Sort.Order.desc("price")           // 最后按价格降序
                    );

                    Pageable pageable = Pageable.from(0, 100, sort);
                    return bookRepository.findAll(pageable).getContent();
                }

                // 忽略大小写排序
                public List<Book> findBooksSortedIgnoreCase() {
                    System.out.println("忽略大小写排序");

                    Sort sort = Sort.of(
                        Sort.Order.asc("title").ignoreCase()
                    );

                    Pageable pageable = Pageable.from(0, 100, sort);
                    return bookRepository.findAll(pageable).getContent();
                }

                // 空值处理排序
                public List<Book> findBooksSortedWithNullHandling() {
                    System.out.println("空值处理排序");

                    Sort sort = Sort.of(
                        Sort.Order.desc("publishedDate")
                            .nullsLast()  // 空值放在最后
                    );

                    Pageable pageable = Pageable.from(0, 100, sort);
                    return bookRepository.findAll(pageable).getContent();
                }

                // 动态排序
                public List<Book> findBooksWithDynamicSort(String sortField, String direction) {
                    System.out.println("动态排序: " + sortField + " " + direction);

                    Sort.Order order;
                    if ("ASC".equalsIgnoreCase(direction)) {
                        order = Sort.Order.asc(sortField);
                    } else {
                        order = Sort.Order.desc(sortField);
                    }

                    Sort sort = Sort.of(order);
                    Pageable pageable = Pageable.from(0, 100, sort);

                    return bookRepository.findAll(pageable).getContent();
                }

                // 条件排序
                public List<Book> findBooksWithConditionalSort(String category, String sortBy) {
                    System.out.println("条件排序: category=" + category + ", sortBy=" + sortBy);

                    Sort sort = switch (sortBy) {
                        case "price-asc" -> Sort.of(Sort.Order.asc("price"));
                        case "price-desc" -> Sort.of(Sort.Order.desc("price"));
                        case "date-new" -> Sort.of(Sort.Order.desc("publishedDate"));
                        case "date-old" -> Sort.of(Sort.Order.asc("publishedDate"));
                        case "title" -> Sort.of(Sort.Order.asc("title"));
                        default -> Sort.of(Sort.Order.desc("publishedDate"));
                    };

                    Pageable pageable = Pageable.from(0, 100, sort);
                    return bookRepository.findByCategory(category, pageable).getContent();
                }

                // 复合排序示例
                public List<Book> findBooksWithComplexSort() {
                    System.out.println("复合排序");

                    // 按分类升序,同分类内按价格降序,同价格按标题升序
                    Sort sort = Sort.of(
                        Sort.Order.asc("category"),
                        Sort.Order.desc("price"),
                        Sort.Order.asc("title").ignoreCase()
                    );

                    Pageable pageable = Pageable.from(0, 100, sort);
                    return bookRepository.findAll(pageable).getContent();
                }
            }

            // 排序控制器
            @Controller("/api/books/sort")
            public class SortingController {
                private final SortingService sortingService;

                public SortingController(SortingService sortingService) {
                    this.sortingService = sortingService;
                }

                @Get("/title")
                public List<Book> sortByTitle() {
                    return sortingService.findBooksSortedByTitle();
                }

                @Get("/multiple")
                public List<Book> sortByMultiple() {
                    return sortingService.findBooksSortedByMultipleFields();
                }

                @Get("/dynamic")
                public List<Book> sortDynamic(
                    @QueryValue String field,
                    @QueryValue String direction) {
                    return sortingService.findBooksWithDynamicSort(field, direction);
                }

                @Get("/conditional")
                public List<Book> sortConditional(
                    @QueryValue String category,
                    @QueryValue String sortBy) {
                    return sortingService.findBooksWithConditionalSort(category, sortBy);
                }
            }
            ---

03.自定义Repository
    a.接口扩展
        a.添加自定义方法
            通过接口继承和实现类扩展Repository功能,添加复杂查询逻辑。可以混合使用派生查询、@Query注解和自定义实现方法。
        b.接口扩展示例
            ---
            // 自定义Repository接口
            public interface CustomUserRepository {
                List<User> findUsersWithCustomLogic(String criteria);

                Map<String, Long> getUserStatistics();

                void bulkUpdateUserStatus(List<Long> userIds, String status);
            }

            // 标准Repository接口
            @Repository
            public interface UserRepository extends JpaRepository<User, Long>, CustomUserRepository {
                // 标准查询方法
                Optional<User> findByUsername(String username);

                List<User> findByActive(boolean active);

                // 同时继承CustomUserRepository的自定义方法
            }

            // 自定义Repository实现
            @Singleton
            public class CustomUserRepositoryImpl implements CustomUserRepository {
                private final EntityManager entityManager;

                public CustomUserRepositoryImpl(EntityManager entityManager) {
                    this.entityManager = entityManager;
                    System.out.println("CustomUserRepositoryImpl初始化");
                }

                @Override
                @Transactional
                public List<User> findUsersWithCustomLogic(String criteria) {
                    System.out.println("自定义查询逻辑: " + criteria);

                    // 使用EntityManager执行复杂查询
                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<User> query = cb.createQuery(User.class);
                    Root<User> root = query.from(User.class);

                    // 构建复杂查询条件
                    List<Predicate> predicates = new ArrayList<>();

                    if (criteria.contains("active")) {
                        predicates.add(cb.equal(root.get("active"), true));
                    }

                    if (criteria.contains("verified")) {
                        predicates.add(cb.equal(root.get("verified"), true));
                    }

                    if (criteria.contains("recent")) {
                        LocalDateTime cutoff = LocalDateTime.now().minusDays(30);
                        predicates.add(cb.greaterThan(root.get("createdAt"), cutoff));
                    }

                    query.where(predicates.toArray(new Predicate[0]));
                    query.orderBy(cb.desc(root.get("createdAt")));

                    List<User> results = entityManager.createQuery(query).getResultList();
                    System.out.println("  找到 " + results.size() + " 个用户");

                    return results;
                }

                @Override
                public Map<String, Long> getUserStatistics() {
                    System.out.println("获取用户统计信息");

                    Map<String, Long> stats = new HashMap<>();

                    // 总用户数
                    Long totalUsers = entityManager.createQuery(
                        "SELECT COUNT(u) FROM User u",
                        Long.class
                    ).getSingleResult();
                    stats.put("totalUsers", totalUsers);

                    // 活跃用户数
                    Long activeUsers = entityManager.createQuery(
                        "SELECT COUNT(u) FROM User u WHERE u.active = true",
                        Long.class
                    ).getSingleResult();
                    stats.put("activeUsers", activeUsers);

                    // 已验证用户数
                    Long verifiedUsers = entityManager.createQuery(
                        "SELECT COUNT(u) FROM User u WHERE u.verified = true",
                        Long.class
                    ).getSingleResult();
                    stats.put("verifiedUsers", verifiedUsers);

                    // 本月新用户数
                    LocalDateTime monthStart = LocalDateTime.now().withDayOfMonth(1).withHour(0).withMinute(0);
                    Long newUsersThisMonth = entityManager.createQuery(
                        "SELECT COUNT(u) FROM User u WHERE u.createdAt >= :monthStart",
                        Long.class
                    ).setParameter("monthStart", monthStart).getSingleResult();
                    stats.put("newUsersThisMonth", newUsersThisMonth);

                    System.out.println("  统计结果: " + stats);
                    return stats;
                }

                @Override
                @Transactional
                public void bulkUpdateUserStatus(List<Long> userIds, String status) {
                    System.out.println("批量更新用户状态: " + userIds.size() + " 个用户");

                    int updated = entityManager.createQuery(
                        "UPDATE User u SET u.status = :status, u.updatedAt = :now " +
                        "WHERE u.id IN :ids"
                    )
                    .setParameter("status", status)
                    .setParameter("now", LocalDateTime.now())
                    .setParameter("ids", userIds)
                    .executeUpdate();

                    System.out.println("  更新了 " + updated + " 个用户");
                }
            }

            // 使用自定义Repository
            @Singleton
            public class UserManagementService {
                private final UserRepository userRepository;

                public UserManagementService(UserRepository userRepository) {
                    this.userRepository = userRepository;
                    System.out.println("UserManagementService初始化");
                }

                // 使用标准方法
                public Optional<User> findByUsername(String username) {
                    return userRepository.findByUsername(username);
                }

                // 使用自定义方法
                public List<User> findActiveRecentUsers() {
                    return userRepository.findUsersWithCustomLogic("active,recent");
                }

                // 获取统计信息
                public Map<String, Long> getStatistics() {
                    return userRepository.getUserStatistics();
                }

                // 批量更新
                public void suspendUsers(List<Long> userIds) {
                    userRepository.bulkUpdateUserStatus(userIds, "SUSPENDED");
                }
            }
            ---
    b.Repository组合
        a.多Repository协作
            在服务层组合多个Repository实现复杂业务逻辑,协调不同实体的数据访问。通过事务管理保证数据一致性,实现跨Repository的业务操作。
        b.Repository组合示例
            ---
            // 多个Repository
            @Repository
            public interface UserRepository extends JpaRepository<User, Long> {
                Optional<User> findByUsername(String username);
                List<User> findByIdIn(List<Long> ids);
            }

            @Repository
            public interface OrderRepository extends JpaRepository<Order, Long> {
                List<Order> findByUserId(Long userId);
                List<Order> findByStatus(String status);
            }

            @Repository
            public interface ProductRepository extends JpaRepository<Product, Long> {
                List<Product> findByIdIn(List<Long> ids);
            }

            @Repository
            public interface WalletRepository extends JpaRepository<Wallet, Long> {
                Optional<Wallet> findByUserId(Long userId);
            }

            // 钱包实体
            @Entity
            @Table(name = "wallets")
            public class Wallet {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(name = "user_id", unique = true)
                private Long userId;

                @Column(precision = 10, scale = 2)
                private BigDecimal balance;

                @Version
                private Long version;  // 乐观锁

                // Getter和Setter省略
            }

            // 组合多Repository的服务
            @Singleton
            public class OrderManagementService {
                private final OrderRepository orderRepository;
                private final UserRepository userRepository;
                private final ProductRepository productRepository;
                private final WalletRepository walletRepository;

                public OrderManagementService(
                    OrderRepository orderRepository,
                    UserRepository userRepository,
                    ProductRepository productRepository,
                    WalletRepository walletRepository) {

                    this.orderRepository = orderRepository;
                    this.userRepository = userRepository;
                    this.productRepository = productRepository;
                    this.walletRepository = walletRepository;
                    System.out.println("OrderManagementService初始化");
                }

                // 创建订单 - 涉及多个Repository
                @Transactional
                public Order createOrder(Long userId, List<OrderItemRequest> items) {
                    System.out.println("创建订单: 用户ID=" + userId);

                    // 1. 验证用户存在
                    User user = userRepository.findById(userId)
                        .orElseThrow(() -> new IllegalArgumentException("用户不存在"));

                    // 2. 获取产品信息
                    List<Long> productIds = items.stream()
                        .map(OrderItemRequest::getProductId)
                        .collect(Collectors.toList());

                    List<Product> products = productRepository.findByIdIn(productIds);
                    if (products.size() != productIds.size()) {
                        throw new IllegalArgumentException("部分产品不存在");
                    }

                    // 3. 计算总价
                    BigDecimal total = BigDecimal.ZERO;
                    for (OrderItemRequest item : items) {
                        Product product = products.stream()
                            .filter(p -> p.getId().equals(item.getProductId()))
                            .findFirst()
                            .orElseThrow();

                        BigDecimal itemTotal = product.getPrice()
                            .multiply(BigDecimal.valueOf(item.getQuantity()));
                        total = total.add(itemTotal);
                    }

                    // 4. 创建订单
                    Order order = new Order();
                    order.setOrderNumber("ORD-" + System.currentTimeMillis());
                    order.setUserId(userId);
                    order.setStatus("PENDING");
                    order.setTotal(total);

                    Order savedOrder = orderRepository.save(order);
                    System.out.println("  订单已创建: " + savedOrder.getOrderNumber());

                    return savedOrder;
                }

                // 支付订单 - 涉及订单和钱包
                @Transactional
                public void payOrder(Long orderId) {
                    System.out.println("支付订单: " + orderId);

                    // 1. 获取订单
                    Order order = orderRepository.findById(orderId)
                        .orElseThrow(() -> new IllegalArgumentException("订单不存在"));

                    if (!"PENDING".equals(order.getStatus())) {
                        throw new IllegalStateException("订单状态不正确");
                    }

                    // 2. 获取用户钱包
                    Wallet wallet = walletRepository.findByUserId(order.getUserId())
                        .orElseThrow(() -> new IllegalArgumentException("钱包不存在"));

                    // 3. 检查余额
                    if (wallet.getBalance().compareTo(order.getTotal()) < 0) {
                        throw new IllegalStateException("余额不足");
                    }

                    // 4. 扣除余额
                    wallet.setBalance(wallet.getBalance().subtract(order.getTotal()));
                    walletRepository.update(wallet);

                    // 5. 更新订单状态
                    order.setStatus("PAID");
                    orderRepository.update(order);

                    System.out.println("  订单支付成功");
                }

                // 获取用户订单摘要
                @Transactional(readOnly = true)
                public UserOrderSummary getUserOrderSummary(Long userId) {
                    System.out.println("获取用户订单摘要: " + userId);

                    // 1. 获取用户信息
                    User user = userRepository.findById(userId)
                        .orElseThrow(() -> new IllegalArgumentException("用户不存在"));

                    // 2. 获取用户所有订单
                    List<Order> orders = orderRepository.findByUserId(userId);

                    // 3. 获取钱包余额
                    Wallet wallet = walletRepository.findByUserId(userId)
                        .orElse(null);

                    // 4. 统计订单信息
                    long totalOrders = orders.size();
                    long paidOrders = orders.stream()
                        .filter(o -> "PAID".equals(o.getStatus()))
                        .count();
                    BigDecimal totalSpent = orders.stream()
                        .filter(o -> "PAID".equals(o.getStatus()))
                        .map(Order::getTotal)
                        .reduce(BigDecimal.ZERO, BigDecimal::add);

                    UserOrderSummary summary = new UserOrderSummary(
                        user.getUsername(),
                        totalOrders,
                        paidOrders,
                        totalSpent,
                        wallet != null ? wallet.getBalance() : BigDecimal.ZERO
                    );

                    System.out.println("  摘要: " + summary);
                    return summary;
                }

                // 批量处理待支付订单
                @Transactional
                public Map<String, Integer> processPendingOrders() {
                    System.out.println("批量处理待支付订单");

                    List<Order> pendingOrders = orderRepository.findByStatus("PENDING");
                    System.out.println("  待支付订单: " + pendingOrders.size());

                    int processed = 0;
                    int failed = 0;

                    for (Order order : pendingOrders) {
                        try {
                            payOrder(order.getId());
                            processed++;
                        } catch (Exception e) {
                            System.err.println("  订单支付失败: " + order.getId() + " - " + e.getMessage());
                            failed++;
                        }
                    }

                    Map<String, Integer> result = new HashMap<>();
                    result.put("processed", processed);
                    result.put("failed", failed);

                    System.out.println("  处理完成: 成功=" + processed + ", 失败=" + failed);
                    return result;
                }
            }

            // 订单项请求
            public class OrderItemRequest {
                private Long productId;
                private Integer quantity;

                // Getter和Setter省略
            }

            // 用户订单摘要
            public class UserOrderSummary {
                private String username;
                private long totalOrders;
                private long paidOrders;
                private BigDecimal totalSpent;
                private BigDecimal walletBalance;

                public UserOrderSummary(String username, long totalOrders, long paidOrders,
                                      BigDecimal totalSpent, BigDecimal walletBalance) {
                    this.username = username;
                    this.totalOrders = totalOrders;
                    this.paidOrders = paidOrders;
                    this.totalSpent = totalSpent;
                    this.walletBalance = walletBalance;
                }

                @Override
                public String toString() {
                    return "UserOrderSummary{username='" + username + "', totalOrders=" + totalOrders +
                           ", paidOrders=" + paidOrders + ", totalSpent=" + totalSpent +
                           ", walletBalance=" + walletBalance + "}";
                }

                // Getter省略
            }
            ---

5.3 JPA集成

01.实体映射
    a.@Entity注解
        a.实体类定义
            使用@Entity标记JPA实体类,@Table指定表名,@Column配置列属性。实体类通过注解映射到数据库表,实现对象关系映射(ORM)。
        b.实体映射示例
            ---
            import jakarta.persistence.*;
            import java.time.LocalDateTime;

            // 基础实体映射
            @Entity
            @Table(name = "employees")
            public class Employee {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(name = "employee_number", unique = true, nullable = false, length = 20)
                private String employeeNumber;

                @Column(name = "first_name", nullable = false, length = 50)
                private String firstName;

                @Column(name = "last_name", nullable = false, length = 50)
                private String lastName;

                @Column(nullable = false, unique = true, length = 100)
                private String email;

                @Column(length = 20)
                private String phone;

                @Column(length = 50)
                private String department;

                @Column(length = 50)
                private String position;

                @Column(precision = 10, scale = 2)
                private BigDecimal salary;

                @Column(name = "hire_date", nullable = false)
                private LocalDate hireDate;

                @Column(name = "is_active", nullable = false)
                private Boolean active = true;

                @Column(name = "created_at", nullable = false, updatable = false)
                private LocalDateTime createdAt;

                @Column(name = "updated_at")
                private LocalDateTime updatedAt;

                // 生命周期回调
                @PrePersist
                protected void onCreate() {
                    createdAt = LocalDateTime.now();
                    updatedAt = LocalDateTime.now();
                    System.out.println("准备保存员工: " + employeeNumber);
                }

                @PreUpdate
                protected void onUpdate() {
                    updatedAt = LocalDateTime.now();
                    System.out.println("准备更新员工: " + employeeNumber);
                }

                @PostPersist
                protected void afterCreate() {
                    System.out.println("员工已保存: " + id);
                }

                @PostUpdate
                protected void afterUpdate() {
                    System.out.println("员工已更新: " + id);
                }

                @PostLoad
                protected void afterLoad() {
                    System.out.println("员工已加载: " + employeeNumber);
                }

                // 构造函数
                public Employee() {}

                public Employee(String employeeNumber, String firstName, String lastName, String email) {
                    this.employeeNumber = employeeNumber;
                    this.firstName = firstName;
                    this.lastName = lastName;
                    this.email = email;
                    this.hireDate = LocalDate.now();
                }

                // Getter和Setter省略
            }

            // 枚举类型映射
            @Entity
            @Table(name = "tasks")
            public class Task {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String title;

                @Column(columnDefinition = "TEXT")
                private String description;

                // 枚举映射为字符串
                @Enumerated(EnumType.STRING)
                @Column(length = 20)
                private TaskStatus status;

                // 枚举映射为整数
                @Enumerated(EnumType.ORDINAL)
                @Column
                private TaskPriority priority;

                @Column(name = "due_date")
                private LocalDate dueDate;

                // Getter和Setter省略
            }

            // 任务状态枚举
            public enum TaskStatus {
                TODO,
                IN_PROGRESS,
                REVIEW,
                DONE,
                CANCELLED
            }

            // 任务优先级枚举
            public enum TaskPriority {
                LOW,      // 0
                MEDIUM,   // 1
                HIGH,     // 2
                URGENT    // 3
            }

            // 大对象(LOB)映射
            @Entity
            @Table(name = "documents")
            public class Document {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String title;

                // 大文本对象
                @Lob
                @Column(columnDefinition = "TEXT")
                private String content;

                // 二进制大对象
                @Lob
                @Column(columnDefinition = "BLOB")
                private byte[] fileData;

                @Column(name = "file_name")
                private String fileName;

                @Column(name = "file_type")
                private String fileType;

                // Getter和Setter省略
            }

            // 嵌入式对象
            @Embeddable
            public class Address {
                @Column(length = 100)
                private String street;

                @Column(length = 50)
                private String city;

                @Column(length = 50)
                private String state;

                @Column(name = "zip_code", length = 10)
                private String zipCode;

                @Column(length = 50)
                private String country;

                // 构造函数
                public Address() {}

                public Address(String street, String city, String state, String zipCode, String country) {
                    this.street = street;
                    this.city = city;
                    this.state = state;
                    this.zipCode = zipCode;
                    this.country = country;
                }

                // Getter和Setter省略
            }

            // 使用嵌入式对象的实体
            @Entity
            @Table(name = "customers")
            public class Customer {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                @Column(nullable = false, unique = true)
                private String email;

                // 嵌入地址对象
                @Embedded
                @AttributeOverrides({
                    @AttributeOverride(name = "street", column = @Column(name = "billing_street")),
                    @AttributeOverride(name = "city", column = @Column(name = "billing_city")),
                    @AttributeOverride(name = "state", column = @Column(name = "billing_state")),
                    @AttributeOverride(name = "zipCode", column = @Column(name = "billing_zip")),
                    @AttributeOverride(name = "country", column = @Column(name = "billing_country"))
                })
                private Address billingAddress;

                @Embedded
                @AttributeOverrides({
                    @AttributeOverride(name = "street", column = @Column(name = "shipping_street")),
                    @AttributeOverride(name = "city", column = @Column(name = "shipping_city")),
                    @AttributeOverride(name = "state", column = @Column(name = "shipping_state")),
                    @AttributeOverride(name = "zipCode", column = @Column(name = "shipping_zip")),
                    @AttributeOverride(name = "country", column = @Column(name = "shipping_country"))
                })
                private Address shippingAddress;

                // Getter和Setter省略
            }

            // Repository使用示例
            @Repository
            public interface EmployeeRepository extends JpaRepository<Employee, Long> {
                Optional<Employee> findByEmployeeNumber(String employeeNumber);
                List<Employee> findByDepartment(String department);
                List<Employee> findByActiveTrue();
                List<Employee> findByHireDateBetween(LocalDate start, LocalDate end);
            }

            @Repository
            public interface TaskRepository extends JpaRepository<Task, Long> {
                List<Task> findByStatus(TaskStatus status);
                List<Task> findByPriority(TaskPriority priority);
                List<Task> findByDueDateBefore(LocalDate date);
            }

            @Repository
            public interface CustomerRepository extends JpaRepository<Customer, Long> {
                Optional<Customer> findByEmail(String email);
            }

            // 服务层使用
            @Singleton
            public class EmployeeService {
                private final EmployeeRepository employeeRepository;

                public EmployeeService(EmployeeRepository employeeRepository) {
                    this.employeeRepository = employeeRepository;
                }

                @Transactional
                public Employee createEmployee(String empNumber, String firstName,
                                             String lastName, String email) {
                    System.out.println("创建员工: " + empNumber);

                    Employee employee = new Employee(empNumber, firstName, lastName, email);
                    employee.setDepartment("Engineering");
                    employee.setPosition("Software Engineer");
                    employee.setSalary(new BigDecimal("80000.00"));

                    Employee saved = employeeRepository.save(employee);
                    System.out.println("员工已创建: " + saved.getId());

                    return saved;
                }

                public List<Employee> findByDepartment(String department) {
                    System.out.println("查询部门员工: " + department);
                    return employeeRepository.findByDepartment(department);
                }
            }
            ---
    b.关系映射
        a.一对一、一对多、多对多
            使用@OneToOne、@OneToMany、@ManyToOne、@ManyToMany注解定义实体间关系。支持级联操作、懒加载、fetch策略等配置,实现复杂的对象关系映射。
        b.关系映射示例
            ---
            // === 一对一关系 ===

            // 用户实体
            @Entity
            @Table(name = "users")
            public class User {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(unique = true, nullable = false)
                private String username;

                @Column(nullable = false)
                private String email;

                // 一对一关系 - 用户详情
                @OneToOne(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
                private UserProfile profile;

                // 构造函数
                public User() {}

                public User(String username, String email) {
                    this.username = username;
                    this.email = email;
                }

                // Getter和Setter省略
            }

            // 用户详情实体
            @Entity
            @Table(name = "user_profiles")
            public class UserProfile {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @OneToOne(fetch = FetchType.LAZY)
                @JoinColumn(name = "user_id", unique = true, nullable = false)
                private User user;

                @Column(name = "full_name")
                private String fullName;

                @Column(name = "phone_number")
                private String phoneNumber;

                @Column
                private LocalDate birthDate;

                @Column(columnDefinition = "TEXT")
                private String bio;

                // Getter和Setter省略
            }

            // === 一对多 / 多对一关系 ===

            // 部门实体
            @Entity
            @Table(name = "departments")
            public class Department {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(unique = true, nullable = false)
                private String name;

                @Column
                private String description;

                // 一对多关系 - 部门有多个员工
                @OneToMany(mappedBy = "department", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
                private List<Employee> employees = new ArrayList<>();

                // 便捷方法
                public void addEmployee(Employee employee) {
                    employees.add(employee);
                    employee.setDepartment(this);
                }

                public void removeEmployee(Employee employee) {
                    employees.remove(employee);
                    employee.setDepartment(null);
                }

                // Getter和Setter省略
            }

            // 员工实体(扩展)
            @Entity
            @Table(name = "employees")
            public class Employee {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                // 多对一关系 - 员工属于一个部门
                @ManyToOne(fetch = FetchType.LAZY)
                @JoinColumn(name = "department_id")
                private Department department;

                // Getter和Setter省略
            }

            // === 多对多关系 ===

            // 学生实体
            @Entity
            @Table(name = "students")
            public class Student {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                @Column(unique = true)
                private String studentNumber;

                // 多对多关系 - 学生选修多门课程
                @ManyToMany(fetch = FetchType.LAZY)
                @JoinTable(
                    name = "student_courses",
                    joinColumns = @JoinColumn(name = "student_id"),
                    inverseJoinColumns = @JoinColumn(name = "course_id")
                )
                private Set<Course> courses = new HashSet<>();

                // 便捷方法
                public void enrollCourse(Course course) {
                    courses.add(course);
                    course.getStudents().add(this);
                }

                public void dropCourse(Course course) {
                    courses.remove(course);
                    course.getStudents().remove(this);
                }

                // Getter和Setter省略
            }

            // 课程实体
            @Entity
            @Table(name = "courses")
            public class Course {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                @Column(unique = true)
                private String courseCode;

                @Column
                private Integer credits;

                // 多对多关系 - 课程有多个学生
                @ManyToMany(mappedBy = "courses", fetch = FetchType.LAZY)
                private Set<Student> students = new HashSet<>();

                // Getter和Setter省略
            }

            // === 带属性的多对多关系 ===

            // 订单实体
            @Entity
            @Table(name = "orders")
            public class Order {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(name = "order_number")
                private String orderNumber;

                // 一对多关系 - 订单有多个订单项
                @OneToMany(mappedBy = "order", cascade = CascadeType.ALL, orphanRemoval = true)
                private List<OrderItem> orderItems = new ArrayList<>();

                // 便捷方法
                public void addOrderItem(Product product, Integer quantity, BigDecimal price) {
                    OrderItem orderItem = new OrderItem(this, product, quantity, price);
                    orderItems.add(orderItem);
                }

                // Getter和Setter省略
            }

            // 产品实体
            @Entity
            @Table(name = "products")
            public class Product {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false)
                private String name;

                @Column(precision = 10, scale = 2)
                private BigDecimal price;

                // 一对多关系 - 产品在多个订单项中
                @OneToMany(mappedBy = "product")
                private List<OrderItem> orderItems = new ArrayList<>();

                // Getter和Setter省略
            }

            // 订单项实体 - 关联实体
            @Entity
            @Table(name = "order_items")
            public class OrderItem {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                // 多对一关系 - 订单
                @ManyToOne(fetch = FetchType.LAZY)
                @JoinColumn(name = "order_id", nullable = false)
                private Order order;

                // 多对一关系 - 产品
                @ManyToOne(fetch = FetchType.LAZY)
                @JoinColumn(name = "product_id", nullable = false)
                private Product product;

                @Column(nullable = false)
                private Integer quantity;

                @Column(precision = 10, scale = 2, nullable = false)
                private BigDecimal price;

                // 构造函数
                public OrderItem() {}

                public OrderItem(Order order, Product product, Integer quantity, BigDecimal price) {
                    this.order = order;
                    this.product = product;
                    this.quantity = quantity;
                    this.price = price;
                }

                // Getter和Setter省略
            }

            // Repository
            @Repository
            public interface DepartmentRepository extends JpaRepository<Department, Long> {
                Optional<Department> findByName(String name);

                @Query("SELECT d FROM Department d LEFT JOIN FETCH d.employees WHERE d.id = :id")
                Optional<Department> findByIdWithEmployees(@Param("id") Long id);
            }

            @Repository
            public interface StudentRepository extends JpaRepository<Student, Long> {
                Optional<Student> findByStudentNumber(String studentNumber);

                @Query("SELECT s FROM Student s LEFT JOIN FETCH s.courses WHERE s.id = :id")
                Optional<Student> findByIdWithCourses(@Param("id") Long id);
            }

            @Repository
            public interface OrderRepository extends JpaRepository<Order, Long> {
                @Query("SELECT o FROM Order o LEFT JOIN FETCH o.orderItems WHERE o.id = :id")
                Optional<Order> findByIdWithItems(@Param("id") Long id);
            }

            // 服务层使用
            @Singleton
            public class RelationshipService {
                private final DepartmentRepository departmentRepository;
                private final StudentRepository studentRepository;
                private final OrderRepository orderRepository;
                private final ProductRepository productRepository;

                public RelationshipService(DepartmentRepository departmentRepository,
                                         StudentRepository studentRepository,
                                         OrderRepository orderRepository,
                                         ProductRepository productRepository) {
                    this.departmentRepository = departmentRepository;
                    this.studentRepository = studentRepository;
                    this.orderRepository = orderRepository;
                    this.productRepository = productRepository;
                }

                // 一对多示例
                @Transactional
                public void demonstrateOneToMany() {
                    System.out.println("\n=== 一对多关系演示 ===");

                    // 创建部门
                    Department department = new Department();
                    department.setName("Engineering");
                    department.setDescription("Engineering Department");

                    // 创建员工
                    Employee emp1 = new Employee();
                    emp1.setName("John Doe");

                    Employee emp2 = new Employee();
                    emp2.setName("Jane Smith");

                    // 建立关系
                    department.addEmployee(emp1);
                    department.addEmployee(emp2);

                    // 保存(级联保存员工)
                    departmentRepository.save(department);
                    System.out.println("部门及员工已保存");
                }

                // 多对多示例
                @Transactional
                public void demonstrateManyToMany() {
                    System.out.println("\n=== 多对多关系演示 ===");

                    // 创建学生
                    Student student = new Student();
                    student.setName("Alice Johnson");
                    student.setStudentNumber("S001");

                    // 创建课程
                    Course course1 = new Course();
                    course1.setName("Java Programming");
                    course1.setCourseCode("CS101");

                    Course course2 = new Course();
                    course2.setName("Database Systems");
                    course2.setCourseCode("CS201");

                    // 学生选课
                    student.enrollCourse(course1);
                    student.enrollCourse(course2);

                    // 保存
                    studentRepository.save(student);
                    System.out.println("学生及选课已保存");
                }

                // 带属性的多对多示例
                @Transactional
                public void demonstrateOrderItems() {
                    System.out.println("\n=== 订单项关系演示 ===");

                    // 创建订单
                    Order order = new Order();
                    order.setOrderNumber("ORD-001");

                    // 获取产品
                    Product product1 = productRepository.findById(1L).orElseThrow();
                    Product product2 = productRepository.findById(2L).orElseThrow();

                    // 添加订单项
                    order.addOrderItem(product1, 2, product1.getPrice());
                    order.addOrderItem(product2, 1, product2.getPrice());

                    // 保存
                    orderRepository.save(order);
                    System.out.println("订单及订单项已保存");
                }
            }
            ---

02.EntityManager
    a.实体管理
        a.持久化上下文
            EntityManager管理实体的生命周期,包括托管、游离、删除状态。提供persist、merge、remove、find等方法操作实体,管理实体与数据库的同步。
        b.EntityManager使用示例
            ---
            import jakarta.persistence.EntityManager;
            import jakarta.persistence.TypedQuery;
            import jakarta.persistence.criteria.*;

            @Singleton
            public class EntityManagerService {
                private final EntityManager entityManager;

                public EntityManagerService(EntityManager entityManager) {
                    this.entityManager = entityManager;
                    System.out.println("EntityManagerService初始化");
                }

                // 持久化新实体
                @Transactional
                public Employee persistEmployee(Employee employee) {
                    System.out.println("持久化员工: " + employee.getName());

                    // persist将新实体添加到持久化上下文
                    entityManager.persist(employee);
                    System.out.println("  员工已添加到持久化上下文");

                    // flush将更改同步到数据库
                    entityManager.flush();
                    System.out.println("  更改已刷新到数据库, ID: " + employee.getId());

                    return employee;
                }

                // 查找实体
                @Transactional(readOnly = true)
                public Employee findEmployee(Long id) {
                    System.out.println("查找员工: " + id);

                    // find立即从数据库加载
                    Employee employee = entityManager.find(Employee.class, id);

                    if (employee != null) {
                        System.out.println("  找到员工: " + employee.getName());
                        System.out.println("  实体状态: 托管(Managed)");
                    } else {
                        System.out.println("  员工不存在");
                    }

                    return employee;
                }

                // 获取实体引用
                @Transactional(readOnly = true)
                public Employee getEmployeeReference(Long id) {
                    System.out.println("获取员工引用: " + id);

                    // getReference返回代理,不立即访问数据库
                    Employee employee = entityManager.getReference(Employee.class, id);
                    System.out.println("  获得代理对象");

                    // 访问属性时才真正加载
                    System.out.println("  员工姓名: " + employee.getName());

                    return employee;
                }

                // 合并游离实体
                @Transactional
                public Employee mergeEmployee(Employee detachedEmployee) {
                    System.out.println("合并游离实体: " + detachedEmployee.getId());

                    // merge将游离实体的状态合并到托管实体
                    Employee managedEmployee = entityManager.merge(detachedEmployee);
                    System.out.println("  实体已合并,状态: 托管(Managed)");

                    return managedEmployee;
                }

                // 刷新实体
                @Transactional
                public Employee refreshEmployee(Long id) {
                    System.out.println("刷新实体: " + id);

                    Employee employee = entityManager.find(Employee.class, id);
                    if (employee != null) {
                        // refresh从数据库重新加载实体状态
                        entityManager.refresh(employee);
                        System.out.println("  实体已从数据库刷新");
                    }

                    return employee;
                }

                // 分离实体
                @Transactional
                public Employee detachEmployee(Long id) {
                    System.out.println("分离实体: " + id);

                    Employee employee = entityManager.find(Employee.class, id);
                    if (employee != null) {
                        // detach将实体从持久化上下文移除
                        entityManager.detach(employee);
                        System.out.println("  实体已分离,状态: 游离(Detached)");

                        // 对游离实体的修改不会同步到数据库
                        employee.setName("Modified Name");
                        System.out.println("  修改游离实体(不会保存到数据库)");
                    }

                    return employee;
                }

                // 删除实体
                @Transactional
                public void removeEmployee(Long id) {
                    System.out.println("删除实体: " + id);

                    Employee employee = entityManager.find(Employee.class, id);
                    if (employee != null) {
                        // remove标记实体为删除状态
                        entityManager.remove(employee);
                        System.out.println("  实体已标记删除");

                        // flush执行实际的DELETE语句
                        entityManager.flush();
                        System.out.println("  DELETE语句已执行");
                    }
                }

                // 检查实体是否被管理
                @Transactional
                public void checkEntityState(Long id) {
                    System.out.println("\n=== 检查实体状态 ===");

                    Employee employee = entityManager.find(Employee.class, id);
                    System.out.println("1. find后: " + (entityManager.contains(employee) ? "托管" : "游离"));

                    entityManager.detach(employee);
                    System.out.println("2. detach后: " + (entityManager.contains(employee) ? "托管" : "游离"));

                    Employee merged = entityManager.merge(employee);
                    System.out.println("3. merge后: " + (entityManager.contains(merged) ? "托管" : "游离"));
                }

                // 清空持久化上下文
                @Transactional
                public void clearPersistenceContext() {
                    System.out.println("清空持久化上下文");

                    // clear分离所有托管实体
                    entityManager.clear();
                    System.out.println("  所有实体已分离");
                }

                // 手动刷新
                @Transactional
                public void manualFlush() {
                    System.out.println("手动刷新演示");

                    Employee employee = new Employee();
                    employee.setName("Test Employee");
                    entityManager.persist(employee);
                    System.out.println("  实体已persist (未刷新到数据库)");

                    // 手动刷新
                    entityManager.flush();
                    System.out.println("  已刷新到数据库, ID: " + employee.getId());
                }

                // 实体生命周期演示
                @Transactional
                public void demonstrateEntityLifecycle() {
                    System.out.println("\n=== 实体生命周期演示 ===");

                    // 1. 新建(New)状态
                    Employee employee = new Employee();
                    employee.setName("Lifecycle Demo");
                    System.out.println("1. 新建状态: contains=" + entityManager.contains(employee));

                    // 2. 托管(Managed)状态
                    entityManager.persist(employee);
                    System.out.println("2. persist后: contains=" + entityManager.contains(employee));

                    // 3. 修改托管实体
                    employee.setName("Modified Name");
                    System.out.println("3. 修改托管实体(自动同步)");

                    // 4. 刷新到数据库
                    entityManager.flush();
                    System.out.println("4. flush后: ID=" + employee.getId());

                    // 5. 分离(Detached)状态
                    entityManager.detach(employee);
                    System.out.println("5. detach后: contains=" + entityManager.contains(employee));

                    // 6. 重新托管
                    Employee managed = entityManager.merge(employee);
                    System.out.println("6. merge后: contains=" + entityManager.contains(managed));

                    // 7. 删除(Removed)状态
                    entityManager.remove(managed);
                    System.out.println("7. remove后: 标记为删除");
                }
            }
            ---
    b.JPQL查询
        a.对象查询语言
            JPQL是面向对象的查询语言,使用实体和属性而非表和列。支持SELECT、UPDATE、DELETE操作,提供丰富的查询功能如聚合、分组、排序、子查询等。
        b.JPQL查询示例
            ---
            @Singleton
            public class JPQLQueryService {
                private final EntityManager entityManager;

                public JPQLQueryService(EntityManager entityManager) {
                    this.entityManager = entityManager;
                }

                // 基础查询
                @Transactional(readOnly = true)
                public List<Employee> findAllEmployees() {
                    System.out.println("JPQL: 查询所有员工");

                    String jpql = "SELECT e FROM Employee e";
                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);

                    List<Employee> results = query.getResultList();
                    System.out.println("  找到 " + results.size() + " 个员工");

                    return results;
                }

                // 条件查询
                @Transactional(readOnly = true)
                public List<Employee> findEmployeesByDepartment(String department) {
                    System.out.println("JPQL: 按部门查询");

                    String jpql = "SELECT e FROM Employee e WHERE e.department = :dept";
                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);
                    query.setParameter("dept", department);

                    return query.getResultList();
                }

                // 多条件查询
                @Transactional(readOnly = true)
                public List<Employee> findEmployeesWithCriteria(String department, BigDecimal minSalary) {
                    System.out.println("JPQL: 多条件查询");

                    String jpql = "SELECT e FROM Employee e " +
                                 "WHERE e.department = :dept AND e.salary >= :minSalary " +
                                 "ORDER BY e.salary DESC";

                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);
                    query.setParameter("dept", department);
                    query.setParameter("minSalary", minSalary);

                    return query.getResultList();
                }

                // 聚合查询
                @Transactional(readOnly = true)
                public Map<String, Object> getEmployeeStatistics() {
                    System.out.println("JPQL: 聚合查询");

                    // 统计员工总数
                    String countJpql = "SELECT COUNT(e) FROM Employee e WHERE e.active = true";
                    Long count = entityManager.createQuery(countJpql, Long.class).getSingleResult();

                    // 计算平均工资
                    String avgJpql = "SELECT AVG(e.salary) FROM Employee e WHERE e.active = true";
                    Double avgSalary = entityManager.createQuery(avgJpql, Double.class).getSingleResult();

                    // 最高工资
                    String maxJpql = "SELECT MAX(e.salary) FROM Employee e";
                    BigDecimal maxSalary = entityManager.createQuery(maxJpql, BigDecimal.class).getSingleResult();

                    // 最低工资
                    String minJpql = "SELECT MIN(e.salary) FROM Employee e WHERE e.active = true";
                    BigDecimal minSalary = entityManager.createQuery(minJpql, BigDecimal.class).getSingleResult();

                    Map<String, Object> stats = new HashMap<>();
                    stats.put("totalEmployees", count);
                    stats.put("averageSalary", avgSalary);
                    stats.put("maxSalary", maxSalary);
                    stats.put("minSalary", minSalary);

                    System.out.println("  统计结果: " + stats);
                    return stats;
                }

                // 分组查询
                @Transactional(readOnly = true)
                public List<Object[]> getEmployeeCountByDepartment() {
                    System.out.println("JPQL: 分组查询");

                    String jpql = "SELECT e.department, COUNT(e), AVG(e.salary) " +
                                 "FROM Employee e " +
                                 "WHERE e.active = true " +
                                 "GROUP BY e.department " +
                                 "HAVING COUNT(e) > 0 " +
                                 "ORDER BY COUNT(e) DESC";

                    List<Object[]> results = entityManager.createQuery(jpql).getResultList();

                    System.out.println("  部门统计:");
                    for (Object[] row : results) {
                        System.out.println("    " + row[0] + ": " + row[1] + " 人, 平均工资: " + row[2]);
                    }

                    return results;
                }

                // 连接查询
                @Transactional(readOnly = true)
                public List<Employee> findEmployeesWithDepartment() {
                    System.out.println("JPQL: 连接查询");

                    String jpql = "SELECT e FROM Employee e " +
                                 "JOIN FETCH e.department d " +
                                 "WHERE d.name = :deptName";

                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);
                    query.setParameter("deptName", "Engineering");

                    return query.getResultList();
                }

                // 子查询
                @Transactional(readOnly = true)
                public List<Employee> findHighEarners() {
                    System.out.println("JPQL: 子查询");

                    String jpql = "SELECT e FROM Employee e " +
                                 "WHERE e.salary > (SELECT AVG(e2.salary) FROM Employee e2)";

                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);
                    return query.getResultList();
                }

                // 更新查询
                @Transactional
                public int updateEmployeeSalary(String department, BigDecimal increment) {
                    System.out.println("JPQL: 批量更新");

                    String jpql = "UPDATE Employee e " +
                                 "SET e.salary = e.salary + :increment " +
                                 "WHERE e.department = :dept";

                    int updated = entityManager.createQuery(jpql)
                        .setParameter("increment", increment)
                        .setParameter("dept", department)
                        .executeUpdate();

                    System.out.println("  更新了 " + updated + " 个员工");
                    return updated;
                }

                // 删除查询
                @Transactional
                public int deleteInactiveEmployees(LocalDate before) {
                    System.out.println("JPQL: 批量删除");

                    String jpql = "DELETE FROM Employee e " +
                                 "WHERE e.active = false AND e.hireDate < :date";

                    int deleted = entityManager.createQuery(jpql)
                        .setParameter("date", before)
                        .executeUpdate();

                    System.out.println("  删除了 " + deleted + " 个员工");
                    return deleted;
                }

                // 分页查询
                @Transactional(readOnly = true)
                public List<Employee> findEmployeesWithPagination(int page, int size) {
                    System.out.println("JPQL: 分页查询");

                    String jpql = "SELECT e FROM Employee e ORDER BY e.id";
                    TypedQuery<Employee> query = entityManager.createQuery(jpql, Employee.class);

                    query.setFirstResult(page * size);
                    query.setMaxResults(size);

                    List<Employee> results = query.getResultList();
                    System.out.println("  第 " + page + " 页, 共 " + results.size() + " 条");

                    return results;
                }

                // 命名查询
                @Transactional(readOnly = true)
                public List<Employee> useNamedQuery(String department) {
                    System.out.println("JPQL: 使用命名查询");

                    TypedQuery<Employee> query = entityManager.createNamedQuery(
                        "Employee.findByDepartment",
                        Employee.class
                    );
                    query.setParameter("dept", department);

                    return query.getResultList();
                }
            }

            // 在Employee实体中定义命名查询
            @Entity
            @Table(name = "employees")
            @NamedQueries({
                @NamedQuery(
                    name = "Employee.findByDepartment",
                    query = "SELECT e FROM Employee e WHERE e.department = :dept"
                ),
                @NamedQuery(
                    name = "Employee.findActive",
                    query = "SELECT e FROM Employee e WHERE e.active = true ORDER BY e.name"
                )
            })
            public class Employee {
                // ... 实体定义
            }
            ---

03.Criteria API
    a.类型安全查询
        a.Criteria构建器
            Criteria API提供类型安全的查询构建方式,通过Java代码而非字符串构建查询。编译时检查类型错误,支持动态查询条件组合,适合复杂查询场景。
        b.Criteria查询示例
            ---
            @Singleton
            public class CriteriaQueryService {
                private final EntityManager entityManager;

                public CriteriaQueryService(EntityManager entityManager) {
                    this.entityManager = entityManager;
                }

                // 基础Criteria查询
                @Transactional(readOnly = true)
                public List<Employee> findAllWithCriteria() {
                    System.out.println("Criteria: 查询所有员工");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    cq.select(root);

                    TypedQuery<Employee> query = entityManager.createQuery(cq);
                    return query.getResultList();
                }

                // 条件查询
                @Transactional(readOnly = true)
                public List<Employee> findByDepartmentWithCriteria(String department) {
                    System.out.println("Criteria: 按部门查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // 构建WHERE条件
                    Predicate predicate = cb.equal(root.get("department"), department);
                    cq.where(predicate);

                    return entityManager.createQuery(cq).getResultList();
                }

                // 多条件组合
                @Transactional(readOnly = true)
                public List<Employee> findWithMultipleConditions(
                    String department, BigDecimal minSalary, Boolean active) {

                    System.out.println("Criteria: 多条件查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    List<Predicate> predicates = new ArrayList<>();

                    // 添加部门条件
                    if (department != null) {
                        predicates.add(cb.equal(root.get("department"), department));
                    }

                    // 添加工资条件
                    if (minSalary != null) {
                        predicates.add(cb.greaterThanOrEqualTo(root.get("salary"), minSalary));
                    }

                    // 添加状态条件
                    if (active != null) {
                        predicates.add(cb.equal(root.get("active"), active));
                    }

                    // 组合所有条件(AND)
                    cq.where(predicates.toArray(new Predicate[0]));

                    // 排序
                    cq.orderBy(cb.desc(root.get("salary")));

                    return entityManager.createQuery(cq).getResultList();
                }

                // OR条件
                @Transactional(readOnly = true)
                public List<Employee> findWithOrConditions(String dept1, String dept2) {
                    System.out.println("Criteria: OR条件查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // OR条件
                    Predicate or = cb.or(
                        cb.equal(root.get("department"), dept1),
                        cb.equal(root.get("department"), dept2)
                    );

                    cq.where(or);
                    return entityManager.createQuery(cq).getResultList();
                }

                // LIKE查询
                @Transactional(readOnly = true)
                public List<Employee> searchByName(String keyword) {
                    System.out.println("Criteria: LIKE查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // LIKE条件
                    Predicate like = cb.like(
                        cb.lower(root.get("name")),
                        "%" + keyword.toLowerCase() + "%"
                    );

                    cq.where(like);
                    return entityManager.createQuery(cq).getResultList();
                }

                // 范围查询
                @Transactional(readOnly = true)
                public List<Employee> findBySalaryRange(BigDecimal min, BigDecimal max) {
                    System.out.println("Criteria: 范围查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // BETWEEN条件
                    Predicate between = cb.between(root.get("salary"), min, max);
                    cq.where(between);

                    return entityManager.createQuery(cq).getResultList();
                }

                // 聚合查询
                @Transactional(readOnly = true)
                public Long countEmployeesByDepartment(String department) {
                    System.out.println("Criteria: 统计查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Long> cq = cb.createQuery(Long.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // COUNT聚合
                    cq.select(cb.count(root));
                    cq.where(cb.equal(root.get("department"), department));

                    return entityManager.createQuery(cq).getSingleResult();
                }

                // 分组查询
                @Transactional(readOnly = true)
                public List<Object[]> getAverageSalaryByDepartment() {
                    System.out.println("Criteria: 分组查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Object[]> cq = cb.createQuery(Object[].class);
                    Root<Employee> root = cq.from(Employee.class);

                    // 选择部门和平均工资
                    cq.multiselect(
                        root.get("department"),
                        cb.avg(root.get("salary"))
                    );

                    // 按部门分组
                    cq.groupBy(root.get("department"));

                    // HAVING条件
                    cq.having(cb.gt(cb.count(root), 0));

                    return entityManager.createQuery(cq).getResultList();
                }

                // 连接查询
                @Transactional(readOnly = true)
                public List<Employee> findEmployeesWithDepartmentCriteria() {
                    System.out.println("Criteria: 连接查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    // JOIN FETCH
                    root.fetch("department", JoinType.LEFT);

                    cq.select(root);
                    return entityManager.createQuery(cq).getResultList();
                }

                // 排序
                @Transactional(readOnly = true)
                public List<Employee> findWithSort(boolean ascending) {
                    System.out.println("Criteria: 排序查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    cq.select(root);

                    // 动态排序
                    if (ascending) {
                        cq.orderBy(cb.asc(root.get("salary")));
                    } else {
                        cq.orderBy(cb.desc(root.get("salary")));
                    }

                    return entityManager.createQuery(cq).getResultList();
                }

                // 分页
                @Transactional(readOnly = true)
                public List<Employee> findWithPagination(int page, int size) {
                    System.out.println("Criteria: 分页查询");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    cq.select(root);
                    cq.orderBy(cb.asc(root.get("id")));

                    TypedQuery<Employee> query = entityManager.createQuery(cq);
                    query.setFirstResult(page * size);
                    query.setMaxResults(size);

                    return query.getResultList();
                }

                // 动态查询构建器
                @Transactional(readOnly = true)
                public List<Employee> dynamicSearch(EmployeeSearchCriteria criteria) {
                    System.out.println("Criteria: 动态搜索");

                    CriteriaBuilder cb = entityManager.getCriteriaBuilder();
                    CriteriaQuery<Employee> cq = cb.createQuery(Employee.class);
                    Root<Employee> root = cq.from(Employee.class);

                    List<Predicate> predicates = new ArrayList<>();

                    // 姓名搜索
                    if (criteria.getName() != null && !criteria.getName().isEmpty()) {
                        predicates.add(cb.like(
                            cb.lower(root.get("name")),
                            "%" + criteria.getName().toLowerCase() + "%"
                        ));
                    }

                    // 部门筛选
                    if (criteria.getDepartment() != null) {
                        predicates.add(cb.equal(root.get("department"), criteria.getDepartment()));
                    }

                    // 工资范围
                    if (criteria.getMinSalary() != null) {
                        predicates.add(cb.greaterThanOrEqualTo(
                            root.get("salary"),
                            criteria.getMinSalary()
                        ));
                    }
                    if (criteria.getMaxSalary() != null) {
                        predicates.add(cb.lessThanOrEqualTo(
                            root.get("salary"),
                            criteria.getMaxSalary()
                        ));
                    }

                    // 入职日期范围
                    if (criteria.getHireDateFrom() != null) {
                        predicates.add(cb.greaterThanOrEqualTo(
                            root.get("hireDate"),
                            criteria.getHireDateFrom()
                        ));
                    }
                    if (criteria.getHireDateTo() != null) {
                        predicates.add(cb.lessThanOrEqualTo(
                            root.get("hireDate"),
                            criteria.getHireDateTo()
                        ));
                    }

                    // 状态筛选
                    if (criteria.getActive() != null) {
                        predicates.add(cb.equal(root.get("active"), criteria.getActive()));
                    }

                    // 组合所有条件
                    cq.where(predicates.toArray(new Predicate[0]));

                    // 排序
                    if (criteria.getSortBy() != null) {
                        if (criteria.isAscending()) {
                            cq.orderBy(cb.asc(root.get(criteria.getSortBy())));
                        } else {
                            cq.orderBy(cb.desc(root.get(criteria.getSortBy())));
                        }
                    }

                    TypedQuery<Employee> query = entityManager.createQuery(cq);

                    // 分页
                    if (criteria.getPage() != null && criteria.getSize() != null) {
                        query.setFirstResult(criteria.getPage() * criteria.getSize());
                        query.setMaxResults(criteria.getSize());
                    }

                    return query.getResultList();
                }
            }

            // 搜索条件对象
            public class EmployeeSearchCriteria {
                private String name;
                private String department;
                private BigDecimal minSalary;
                private BigDecimal maxSalary;
                private LocalDate hireDateFrom;
                private LocalDate hireDateTo;
                private Boolean active;
                private String sortBy;
                private boolean ascending = true;
                private Integer page;
                private Integer size;

                // Getter和Setter省略
            }
            ---
    b.动态查询构建
        a.条件组合器
            使用Specification模式或Predicate组合实现灵活的动态查询构建。根据运行时条件动态添加查询子句,避免硬编码大量查询方法。
        b.Specification模式示例
            ---
            import io.micronaut.data.jpa.repository.criteria.Specification;

            // Specification工具类
            public class EmployeeSpecifications {

                public static Specification<Employee> hasName(String name) {
                    return (root, query, cb) -> {
                        if (name == null || name.isEmpty()) {
                            return cb.conjunction();
                        }
                        return cb.like(cb.lower(root.get("name")),
                                      "%" + name.toLowerCase() + "%");
                    };
                }

                public static Specification<Employee> hasDepartment(String department) {
                    return (root, query, cb) -> {
                        if (department == null) {
                            return cb.conjunction();
                        }
                        return cb.equal(root.get("department"), department);
                    };
                }

                public static Specification<Employee> salaryBetween(BigDecimal min, BigDecimal max) {
                    return (root, query, cb) -> {
                        if (min == null && max == null) {
                            return cb.conjunction();
                        }
                        if (min != null && max != null) {
                            return cb.between(root.get("salary"), min, max);
                        }
                        if (min != null) {
                            return cb.greaterThanOrEqualTo(root.get("salary"), min);
                        }
                        return cb.lessThanOrEqualTo(root.get("salary"), max);
                    };
                }

                public static Specification<Employee> isActive(Boolean active) {
                    return (root, query, cb) -> {
                        if (active == null) {
                            return cb.conjunction();
                        }
                        return cb.equal(root.get("active"), active);
                    };
                }

                public static Specification<Employee> hiredAfter(LocalDate date) {
                    return (root, query, cb) -> {
                        if (date == null) {
                            return cb.conjunction();
                        }
                        return cb.greaterThanOrEqualTo(root.get("hireDate"), date);
                    };
                }
            }

            // 使用Specification
            @Singleton
            public class EmployeeSpecificationService {
                private final EmployeeRepository employeeRepository;

                public EmployeeSpecificationService(EmployeeRepository employeeRepository) {
                    this.employeeRepository = employeeRepository;
                }

                public List<Employee> searchEmployees(String name, String department,
                                                     BigDecimal minSalary, BigDecimal maxSalary) {
                    System.out.println("Specification搜索");

                    // 组合多个Specification
                    Specification<Employee> spec = Specification
                        .where(EmployeeSpecifications.hasName(name))
                        .and(EmployeeSpecifications.hasDepartment(department))
                        .and(EmployeeSpecifications.salaryBetween(minSalary, maxSalary))
                        .and(EmployeeSpecifications.isActive(true));

                    return employeeRepository.findAll(spec);
                }

                public List<Employee> complexSearch(EmployeeSearchCriteria criteria) {
                    System.out.println("复杂Specification搜索");

                    Specification<Employee> spec = Specification.where(null);

                    if (criteria.getName() != null) {
                        spec = spec.and(EmployeeSpecifications.hasName(criteria.getName()));
                    }

                    if (criteria.getDepartment() != null) {
                        spec = spec.and(EmployeeSpecifications.hasDepartment(criteria.getDepartment()));
                    }

                    if (criteria.getMinSalary() != null || criteria.getMaxSalary() != null) {
                        spec = spec.and(EmployeeSpecifications.salaryBetween(
                            criteria.getMinSalary(),
                            criteria.getMaxSalary()
                        ));
                    }

                    if (criteria.getHireDateFrom() != null) {
                        spec = spec.and(EmployeeSpecifications.hiredAfter(criteria.getHireDateFrom()));
                    }

                    if (criteria.getActive() != null) {
                        spec = spec.and(EmployeeSpecifications.isActive(criteria.getActive()));
                    }

                    return employeeRepository.findAll(spec);
                }
            }
            ---

5.4 JDBC支持

01.JDBC配置
    a.数据源配置
        a.连接池设置
            配置JDBC数据源和连接池,包括URL、驱动、用户名、密码、连接池大小等参数。Micronaut Data JDBC提供轻量级的数据访问方式,无需JPA的额外开销。
        b.JDBC配置示例
            ---
            // build.gradle - JDBC依赖
            dependencies {
                annotationProcessor("io.micronaut.data:micronaut-data-processor")
                implementation("io.micronaut.data:micronaut-data-jdbc")
                implementation("io.micronaut.sql:micronaut-jdbc-hikari")
                runtimeOnly("mysql:mysql-connector-java")
            }

            // application.yml - JDBC配置
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/mydb
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD}
                dialect: MYSQL
                # HikariCP连接池配置
                maximum-pool-size: 10
                minimum-idle: 2
                connection-timeout: 30000
                idle-timeout: 600000
                max-lifetime: 1800000

            // JDBC实体
            import io.micronaut.data.annotation.*;
            import io.micronaut.data.model.naming.NamingStrategies;

            @MappedEntity(value = "products", namingStrategy = NamingStrategies.UnderScoreSeparated.class)
            public class Product {
                @Id
                @GeneratedValue
                private Long id;

                private String name;
                private BigDecimal price;
                private Integer stock;
                private String category;

                @DateCreated
                private LocalDateTime createdAt;

                @DateUpdated
                private LocalDateTime updatedAt;

                // 构造函数
                public Product() {}

                public Product(String name, BigDecimal price, Integer stock) {
                    this.name = name;
                    this.price = price;
                    this.stock = stock;
                }

                // Getter和Setter省略
            }

            // JDBC Repository
            import io.micronaut.data.jdbc.annotation.JdbcRepository;
            import io.micronaut.data.model.query.builder.sql.Dialect;

            @JdbcRepository(dialect = Dialect.MYSQL)
            public interface ProductRepository extends CrudRepository<Product, Long> {
                List<Product> findByCategory(String category);
                List<Product> findByPriceBetween(BigDecimal min, BigDecimal max);
                Optional<Product> findByName(String name);

                @Query("SELECT * FROM products WHERE stock < :threshold")
                List<Product> findLowStock(int threshold);
            }

            // JDBC服务
            @Singleton
            public class ProductJdbcService {
                private final ProductRepository productRepository;

                public ProductJdbcService(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                    System.out.println("ProductJdbcService初始化");
                }

                @Transactional
                public Product createProduct(String name, BigDecimal price, Integer stock) {
                    System.out.println("JDBC创建产品: " + name);

                    Product product = new Product(name, price, stock);
                    product.setCategory("Electronics");

                    Product saved = productRepository.save(product);
                    System.out.println("  产品已保存, ID: " + saved.getId());

                    return saved;
                }

                public List<Product> findByCategory(String category) {
                    System.out.println("JDBC查询分类: " + category);
                    return productRepository.findByCategory(category);
                }

                public List<Product> findLowStockProducts() {
                    System.out.println("JDBC查询低库存产品");
                    return productRepository.findLowStock(10);
                }
            }
            ---
    b.原生SQL
        a.@Query原生SQL
            使用@Query注解编写原生SQL语句,直接操作数据库。支持命名参数、位置参数,适合需要数据库特定功能或优化查询的场景。
        b.原生SQL示例
            ---
            @JdbcRepository(dialect = Dialect.MYSQL)
            public interface NativeSQLRepository extends CrudRepository<Product, Long> {

                // 原生SQL查询
                @Query(value = "SELECT * FROM products WHERE price > :price ORDER BY price DESC",
                       nativeQuery = true)
                List<Product> findExpensiveProducts(BigDecimal price);

                // 原生SQL聚合
                @Query(value = "SELECT category, COUNT(*), AVG(price) FROM products GROUP BY category",
                       nativeQuery = true)
                List<Map<String, Object>> getCategoryStatistics();

                // 原生SQL更新
                @Query(value = "UPDATE products SET stock = stock + :amount WHERE id = :id",
                       nativeQuery = true)
                int increaseStock(Long id, int amount);

                // 原生SQL删除
                @Query(value = "DELETE FROM products WHERE stock = 0 AND created_at < :date",
                       nativeQuery = true)
                int deleteZeroStockProducts(LocalDateTime date);

                // MySQL特定功能 - 全文搜索
                @Query(value = "SELECT * FROM products WHERE MATCH(name, description) " +
                              "AGAINST(:keyword IN NATURAL LANGUAGE MODE)",
                       nativeQuery = true)
                List<Product> fullTextSearch(String keyword);
            }

            @Singleton
            public class NativeSQLService {
                private final NativeSQLRepository repository;

                public NativeSQLService(NativeSQLRepository repository) {
                    this.repository = repository;
                }

                public void demonstrateNativeSQL() {
                    System.out.println("=== 原生SQL演示 ===");

                    // 查询贵重产品
                    List<Product> expensive = repository.findExpensiveProducts(
                        new BigDecimal("1000")
                    );
                    System.out.println("贵重产品数: " + expensive.size());

                    // 分类统计
                    List<Map<String, Object>> stats = repository.getCategoryStatistics();
                    stats.forEach(stat ->
                        System.out.println("  " + stat.get("category") + ": " +
                                         stat.get("COUNT(*)") + " 个, 平均价格: " +
                                         stat.get("AVG(price)"))
                    );

                    // 增加库存
                    int updated = repository.increaseStock(1L, 50);
                    System.out.println("更新库存: " + updated + " 条记录");
                }
            }
            ---

02.批量操作
    a.批量插入
        a.saveAll批量保存
            使用saveAll方法批量保存实体,JDBC实现通过批处理优化多条INSERT语句的执行,提升大量数据插入的性能。
        b.批量插入示例
            ---
            @Singleton
            public class BatchInsertService {
                private final ProductRepository productRepository;

                public BatchInsertService(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                @Transactional
                public List<Product> batchInsert(int count) {
                    System.out.println("批量插入: " + count + " 个产品");

                    List<Product> products = new ArrayList<>();
                    for (int i = 0; i < count; i++) {
                        Product product = new Product();
                        product.setName("Product " + i);
                        product.setPrice(BigDecimal.valueOf(100 + i));
                        product.setStock(100);
                        product.setCategory("Category" + (i % 5));
                        products.add(product);
                    }

                    long start = System.currentTimeMillis();
                    Iterable<Product> saved = productRepository.saveAll(products);
                    long duration = System.currentTimeMillis() - start;

                    List<Product> result = new ArrayList<>();
                    saved.forEach(result::add);

                    System.out.println("  批量插入完成: " + duration + "ms");
                    System.out.println("  平均: " + (duration * 1.0 / count) + "ms/条");

                    return result;
                }

                @Transactional
                public void batchUpdate(List<Long> ids, String newCategory) {
                    System.out.println("批量更新: " + ids.size() + " 个产品");

                    List<Product> products = new ArrayList<>();
                    for (Long id : ids) {
                        Product product = productRepository.findById(id).orElse(null);
                        if (product != null) {
                            product.setCategory(newCategory);
                            products.add(product);
                        }
                    }

                    productRepository.updateAll(products);
                    System.out.println("  批量更新完成");
                }
            }
            ---
    b.批量更新和删除
        a.批量操作优化
            使用批量更新和删除方法减少数据库交互次数,通过单条SQL语句处理多条记录,显著提升大批量数据操作的性能。
        b.批量操作示例
            ---
            @JdbcRepository(dialect = Dialect.MYSQL)
            public interface BatchOperationRepository extends CrudRepository<Product, Long> {

                // 批量更新
                @Query("UPDATE products SET stock = stock - :amount WHERE id IN (:ids)")
                int decreaseStockBatch(List<Long> ids, int amount);

                @Query("UPDATE products SET category = :category WHERE id IN (:ids)")
                int updateCategoryBatch(List<Long> ids, String category);

                // 批量删除
                @Query("DELETE FROM products WHERE id IN (:ids)")
                int deleteBatch(List<Long> ids);

                void deleteAll(Iterable<Product> products);
            }

            @Singleton
            public class BatchOperationService {
                private final BatchOperationRepository repository;

                public BatchOperationService(BatchOperationRepository repository) {
                    this.repository = repository;
                }

                @Transactional
                public void batchDecreaseStock(List<Long> productIds, int amount) {
                    System.out.println("批量减少库存: " + productIds.size() + " 个产品");

                    int updated = repository.decreaseStockBatch(productIds, amount);
                    System.out.println("  更新了 " + updated + " 条记录");
                }

                @Transactional
                public void batchDelete(List<Long> ids) {
                    System.out.println("批量删除: " + ids.size() + " 个产品");

                    int deleted = repository.deleteBatch(ids);
                    System.out.println("  删除了 " + deleted + " 条记录");
                }
            }
            ---

03.事务管理
    a.@Transactional
        a.声明式事务
            使用@Transactional注解声明事务边界,支持事务传播、隔离级别、只读事务等配置。框架自动管理事务的开启、提交、回滚。
        b.事务管理示例
            ---
            @Singleton
            public class TransactionService {
                private final ProductRepository productRepository;
                private final OrderRepository orderRepository;

                public TransactionService(ProductRepository productRepository,
                                        OrderRepository orderRepository) {
                    this.productRepository = productRepository;
                    this.orderRepository = orderRepository;
                }

                // 基础事务
                @Transactional
                public void createOrder(Long productId, int quantity) {
                    System.out.println("创建订单(事务)");

                    // 减少库存
                    Product product = productRepository.findById(productId)
                        .orElseThrow(() -> new IllegalArgumentException("产品不存在"));

                    if (product.getStock() < quantity) {
                        throw new IllegalStateException("库存不足");
                    }

                    product.setStock(product.getStock() - quantity);
                    productRepository.update(product);

                    // 创建订单
                    Order order = new Order();
                    order.setProductId(productId);
                    order.setQuantity(quantity);
                    order.setTotal(product.getPrice().multiply(BigDecimal.valueOf(quantity)));
                    orderRepository.save(order);

                    System.out.println("  订单创建成功(事务提交)");
                }

                // 只读事务
                @Transactional(readOnly = true)
                public List<Product> findAllProducts() {
                    System.out.println("查询所有产品(只读事务)");
                    return productRepository.findAll();
                }

                // 事务回滚
                @Transactional
                public void failingOperation() {
                    System.out.println("失败操作(事务回滚)");

                    Product product = new Product("Test", BigDecimal.TEN, 100);
                    productRepository.save(product);

                    // 抛出异常,触发回滚
                    throw new RuntimeException("模拟异常");
                }

                // 嵌套事务
                @Transactional
                public void outerTransaction() {
                    System.out.println("外层事务");
                    Product product = new Product("Outer", BigDecimal.TEN, 100);
                    productRepository.save(product);

                    try {
                        innerTransaction();
                    } catch (Exception e) {
                        System.out.println("  内层事务失败,但外层继续");
                    }

                    System.out.println("  外层事务完成");
                }

                @Transactional(propagation = Propagation.REQUIRES_NEW)
                public void innerTransaction() {
                    System.out.println("  内层事务(独立事务)");
                    Product product = new Product("Inner", BigDecimal.TEN, 100);
                    productRepository.save(product);
                    throw new RuntimeException("内层失败");
                }
            }
            ---
    b.编程式事务
        a.TransactionOperations
            使用TransactionOperations接口编程式控制事务,提供更灵活的事务管理方式。适合需要动态控制事务边界或复杂事务逻辑的场景。
        b.编程式事务示例
            ---
            import io.micronaut.transaction.TransactionOperations;
            import io.micronaut.transaction.TransactionStatus;

            @Singleton
            public class ProgrammaticTransactionService {
                private final TransactionOperations<Connection> transactionManager;
                private final ProductRepository productRepository;

                public ProgrammaticTransactionService(
                    TransactionOperations<Connection> transactionManager,
                    ProductRepository productRepository) {
                    this.transactionManager = transactionManager;
                    this.productRepository = productRepository;
                }

                public void executeInTransaction() {
                    System.out.println("编程式事务");

                    transactionManager.executeWrite(status -> {
                        System.out.println("  事务已开始");

                        Product product = new Product("Test", BigDecimal.TEN, 100);
                        productRepository.save(product);
                        System.out.println("  产品已保存");

                        return product;
                    });

                    System.out.println("  事务已提交");
                }

                public void conditionalTransaction(boolean shouldCommit) {
                    System.out.println("条件事务: shouldCommit=" + shouldCommit);

                    transactionManager.executeWrite(status -> {
                        Product product = new Product("Conditional", BigDecimal.TEN, 100);
                        productRepository.save(product);

                        if (!shouldCommit) {
                            System.out.println("  手动回滚");
                            status.setRollbackOnly();
                        }

                        return product;
                    });
                }

                public <T> T executeWithRetry(Supplier<T> operation, int maxRetries) {
                    System.out.println("带重试的事务");

                    int attempt = 0;
                    while (attempt < maxRetries) {
                        try {
                            return transactionManager.executeWrite(status -> {
                                System.out.println("  尝试 " + (attempt + 1));
                                return operation.get();
                            });
                        } catch (Exception e) {
                            attempt++;
                            if (attempt >= maxRetries) {
                                throw e;
                            }
                            System.out.println("  失败,重试...");
                        }
                    }

                    throw new RuntimeException("重试失败");
                }
            }
            ---

04.性能优化
    a.连接池调优
        a.HikariCP配置
            调整连接池参数优化数据库连接管理,包括最大连接数、最小空闲连接、连接超时、空闲超时等。合理配置连接池提升应用性能和资源利用率。
        b.连接池优化示例
            ---
            // application.yml - HikariCP优化配置
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/mydb?useSSL=false&serverTimezone=UTC
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD}

                # 连接池大小
                maximum-pool-size: 20          # 最大连接数
                minimum-idle: 5                # 最小空闲连接

                # 超时设置
                connection-timeout: 30000      # 连接超时(30秒)
                idle-timeout: 600000           # 空闲超时(10分钟)
                max-lifetime: 1800000          # 连接最大生命周期(30分钟)

                # 性能优化
                auto-commit: true
                connection-test-query: SELECT 1
                leak-detection-threshold: 60000  # 连接泄漏检测(60秒)

                # 连接池名称
                pool-name: HikariPool-Default

            // 连接池监控
            @Singleton
            public class ConnectionPoolMonitor {
                private final DataSource dataSource;

                public ConnectionPoolMonitor(DataSource dataSource) {
                    this.dataSource = dataSource;
                }

                public Map<String, Object> getPoolStatistics() {
                    if (dataSource instanceof HikariDataSource) {
                        HikariDataSource hikari = (HikariDataSource) dataSource;
                        HikariPoolMXBean pool = hikari.getHikariPoolMXBean();

                        Map<String, Object> stats = new HashMap<>();
                        stats.put("activeConnections", pool.getActiveConnections());
                        stats.put("idleConnections", pool.getIdleConnections());
                        stats.put("totalConnections", pool.getTotalConnections());
                        stats.put("threadsAwaitingConnection", pool.getThreadsAwaitingConnection());

                        System.out.println("连接池统计:");
                        System.out.println("  活跃连接: " + pool.getActiveConnections());
                        System.out.println("  空闲连接: " + pool.getIdleConnections());
                        System.out.println("  总连接数: " + pool.getTotalConnections());

                        return stats;
                    }
                    return Collections.emptyMap();
                }
            }
            ---
    b.查询优化
        a.索引和查询计划
            通过创建索引、优化查询语句、使用EXPLAIN分析查询计划等方式提升查询性能。避免全表扫描,合理使用索引和查询条件。
        b.查询优化示例
            ---
            @Singleton
            public class QueryOptimizationService {
                private final ProductRepository productRepository;
                private final EntityManager entityManager;

                public QueryOptimizationService(ProductRepository productRepository,
                                              EntityManager entityManager) {
                    this.productRepository = productRepository;
                    this.entityManager = entityManager;
                }

                // 批量查询优化
                public List<Product> findProductsBatch(List<Long> ids) {
                    System.out.println("批量查询优化: " + ids.size() + " 个ID");

                    // 使用IN查询,避免多次单独查询
                    String jpql = "SELECT p FROM Product p WHERE p.id IN :ids";
                    return entityManager.createQuery(jpql, Product.class)
                        .setParameter("ids", ids)
                        .getResultList();
                }

                // 投影查询优化
                @Query("SELECT p.id, p.name, p.price FROM Product p WHERE p.category = :category")
                public List<Object[]> findProductProjection(String category) {
                    // 只查询需要的字段,减少数据传输
                    System.out.println("投影查询: " + category);
                    return Collections.emptyList();
                }

                // 分页查询优化
                public Page<Product> findWithOptimizedPagination(int page, int size) {
                    System.out.println("优化分页查询");

                    // 使用覆盖索引
                    Sort sort = Sort.of(Sort.Order.asc("id"));
                    Pageable pageable = Pageable.from(page, size, sort);

                    return productRepository.findAll(pageable);
                }

                // 避免N+1查询
                @Query("SELECT p FROM Product p LEFT JOIN FETCH p.category WHERE p.id IN :ids")
                public List<Product> findWithCategory(List<Long> ids) {
                    // 使用JOIN FETCH一次性加载关联数据
                    System.out.println("避免N+1查询");
                    return Collections.emptyList();
                }
            }
            ---

5.5 缓存策略

01.缓存配置
    a.@Cacheable注解
        a.方法级缓存
            使用@Cacheable注解在方法级别启用缓存,减少数据库访问次数。首次调用执行数据库查询并缓存结果,后续调用直接返回缓存数据,显著提升查询性能。
        b.缓存配置示例
            ---
            // build.gradle - 缓存依赖
            dependencies {
                implementation("io.micronaut.cache:micronaut-cache-caffeine")
                implementation("io.micronaut.cache:micronaut-cache-redis")
            }

            // application.yml - 缓存配置
            micronaut:
              caches:
                # Caffeine本地缓存
                users:
                  maximum-size: 1000
                  expire-after-write: 10m
                  expire-after-access: 5m
                  record-stats: true

                products:
                  maximum-size: 5000
                  expire-after-write: 30m
                  initial-capacity: 100

                # Redis分布式缓存
                sessions:
                  redis:
                    enabled: true
                    expire-after-write: 1h

            redis:
              uri: redis://localhost:6379
              caches:
                sessions:
                  expire-after-write: 3600s

            // 缓存实体
            @Entity
            @Table(name = "users")
            public class User {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(unique = true)
                private String username;

                @Column
                private String email;

                @Column
                private LocalDateTime lastModified;

                // 构造函数和Getter/Setter省略
            }

            // 使用@Cacheable的Repository
            @Repository
            public interface UserRepository extends JpaRepository<User, Long> {
                Optional<User> findByUsername(String username);

                List<User> findByEmail(String email);
            }

            // 缓存服务
            import io.micronaut.cache.annotation.Cacheable;
            import io.micronaut.cache.annotation.CacheInvalidate;
            import io.micronaut.cache.annotation.CachePut;

            @Singleton
            public class UserCacheService {
                private final UserRepository userRepository;

                public UserCacheService(UserRepository userRepository) {
                    this.userRepository = userRepository;
                    System.out.println("UserCacheService初始化");
                }

                // 方法结果缓存
                @Cacheable("users")
                public Optional<User> findById(Long id) {
                    System.out.println("从数据库查询用户: " + id);
                    return userRepository.findById(id);
                }

                // 使用复合键缓存
                @Cacheable(value = "users", parameters = {"username"})
                public Optional<User> findByUsername(String username) {
                    System.out.println("从数据库查询用户名: " + username);
                    return userRepository.findByUsername(username);
                }

                // 缓存列表结果
                @Cacheable(value = "users", parameters = {"email"})
                public List<User> findByEmail(String email) {
                    System.out.println("从数据库查询邮箱: " + email);
                    return userRepository.findByEmail(email);
                }

                // 创建用户(不缓存)
                public User createUser(String username, String email) {
                    System.out.println("创建用户: " + username);

                    User user = new User();
                    user.setUsername(username);
                    user.setEmail(email);
                    user.setLastModified(LocalDateTime.now());

                    return userRepository.save(user);
                }

                // 缓存统计
                public void logCacheStatistics() {
                    System.out.println("\n=== 缓存统计 ===");
                    System.out.println("缓存有效降低数据库访问次数");
                }
            }

            // 控制器使用缓存
            @Controller("/api/cached-users")
            public class CachedUserController {
                private final UserCacheService userService;

                public CachedUserController(UserCacheService userService) {
                    this.userService = userService;
                }

                @Get("/{id}")
                public Optional<User> get(Long id) {
                    // 第一次调用查询数据库并缓存
                    // 后续调用直接从缓存返回
                    return userService.findById(id);
                }

                @Get("/username/{username}")
                public Optional<User> getByUsername(String username) {
                    return userService.findByUsername(username);
                }

                @Get("/email/{email}")
                public List<User> getByEmail(String email) {
                    return userService.findByEmail(email);
                }

                @Post
                public User create(@Body CreateUserRequest request) {
                    return userService.createUser(
                        request.getUsername(),
                        request.getEmail()
                    );
                }
            }

            // 测试缓存效果
            @Singleton
            public class CacheTestService {
                private final UserCacheService userService;

                public CacheTestService(UserCacheService userService) {
                    this.userService = userService;
                }

                public void testCachePerformance() {
                    System.out.println("=== 缓存性能测试 ===\n");

                    Long userId = 1L;

                    // 第一次调用 - 查询数据库
                    System.out.println("第一次调用:");
                    long start1 = System.currentTimeMillis();
                    userService.findById(userId);
                    long duration1 = System.currentTimeMillis() - start1;
                    System.out.println("耗时: " + duration1 + "ms\n");

                    // 第二次调用 - 从缓存获取
                    System.out.println("第二次调用(缓存):");
                    long start2 = System.currentTimeMillis();
                    userService.findById(userId);
                    long duration2 = System.currentTimeMillis() - start2;
                    System.out.println("耗时: " + duration2 + "ms\n");

                    // 性能提升
                    double improvement = ((duration1 - duration2) * 100.0) / duration1;
                    System.out.println("性能提升: " + String.format("%.2f", stats.hitRate() * 100));
                            System.out.println("  加载耗时: " + stats.averageLoadPenalty() + "ns");
                            System.out.println("  淘汰次数: " + stats.evictionCount());
                        }
                    }
                }
            }
            ---
    b.分布式缓存
        a.Redis集成
            使用Redis实现分布式缓存,支持集群部署的多实例间缓存共享。提供缓存发布订阅、缓存失效通知等功能,适合分布式系统场景。
        b.Redis缓存示例
            ---
            // Redis缓存配置
            // application.yml
            redis:
              uri: redis://localhost:6379
              caches:
                users:
                  enabled: true
                  expire-after-write: 1800s
                  charset: UTF-8
                  value-serializer: io.micronaut.jackson.serialize.JacksonObjectSerializer

                sessions:
                  enabled: true
                  expire-after-write: 3600s

            // Redis缓存服务
            @Singleton
            public class RedisCacheService {
                private final UserRepository userRepository;

                public RedisCacheService(UserRepository userRepository) {
                    this.userRepository = userRepository;
                    System.out.println("RedisCacheService初始化");
                }

                // Redis缓存查询
                @Cacheable(value = "users", cacheResolver = RedisCache.class)
                public Optional<User> findUserById(Long id) {
                    System.out.println("Redis查询用户: " + id);
                    return userRepository.findById(id);
                }

                // Redis缓存更新
                @CachePut(value = "users", parameters = {"id"})
                public User updateUser(Long id, String email) {
                    System.out.println("Redis更新用户: " + id);

                    User user = userRepository.findById(id)
                        .orElseThrow(() -> new IllegalArgumentException("用户不存在"));

                    user.setEmail(email);
                    user.setLastModified(LocalDateTime.now());

                    return userRepository.update(user);
                }

                // Redis缓存失效
                @CacheInvalidate(value = "users", parameters = {"id"})
                public void deleteUser(Long id) {
                    System.out.println("Redis删除用户: " + id);
                    userRepository.deleteById(id);
                }
            }

            // Redis发布订阅
            import io.lettuce.core.pubsub.RedisPubSubAdapter;
            import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;

            @Singleton
            public class RedisPubSubService {
                private final StatefulRedisPubSubConnection<String, String> connection;

                @Inject
                public RedisPubSubService(RedisClient redisClient) {
                    this.connection = redisClient.connectPubSub();
                    setupSubscription();
                }

                private void setupSubscription() {
                    connection.addListener(new RedisPubSubAdapter<String, String>() {
                        @Override
                        public void message(String channel, String message) {
                            System.out.println("收到缓存失效消息: " + channel + " -> " + message);
                            handleCacheInvalidation(channel, message);
                        }
                    });

                    // 订阅缓存失效通道
                    connection.sync().subscribe("cache:invalidate");
                }

                private void handleCacheInvalidation(String channel, String message) {
                    // 处理缓存失效消息
                    System.out.println("  处理缓存失效: " + message);
                }

                // 发布缓存失效消息
                public void publishInvalidation(String cacheKey) {
                    System.out.println("发布缓存失效: " + cacheKey);
                    connection.sync().publish("cache:invalidate", cacheKey);
                }
            }

            // Redis集群缓存
            @Singleton
            public class RedisClusterCacheService {

                // 使用一致性哈希分布缓存
                @Cacheable(value = "users")
                public Optional<User> findUserInCluster(Long id) {
                    System.out.println("Redis集群查询: " + id);
                    // Redis Cluster自动处理数据分片
                    return Optional.empty();
                }

                // 批量操作Redis缓存
                public Map<Long, User> batchGetUsers(List<Long> ids) {
                    System.out.println("批量查询Redis: " + ids.size() + " 个用户");

                    Map<Long, User> result = new HashMap<>();

                    // 使用Pipeline批量查询
                    // 实际实现需要Redis Pipeline API

                    return result;
                }
            }
            ---

5.6 数据库迁移

01.Flyway集成
    a.迁移脚本
        a.版本化SQL脚本
            Flyway通过版本化SQL脚本管理数据库schema变更,自动追踪已执行的迁移,确保数据库结构一致性。支持可重复脚本、回调钩子等高级功能。
        b.Flyway配置示例
            ---
            // build.gradle - Flyway依赖
            dependencies {
                implementation("io.micronaut.flyway:micronaut-flyway")
                runtimeOnly("org.flywaydb:flyway-mysql")
            }

            // application.yml - Flyway配置
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/mydb
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD}

            flyway:
              datasources:
                default:
                  enabled: true
                  # 迁移脚本位置
                  locations: classpath:db/migration
                  # 基线版本
                  baseline-version: 1
                  baseline-on-migrate: true
                  # 验证迁移脚本
                  validate-on-migrate: true
                  # 清理数据库(生产环境禁用)
                  clean-disabled: true
                  # 占位符替换
                  placeholders:
                    table_prefix: app_

            // 迁移脚本目录结构
            // src/main/resources/db/migration/
            // ├── V1__Create_users_table.sql
            // ├── V2__Add_email_index.sql
            // ├── V3__Create_products_table.sql
            // ├── V4__Add_created_at_columns.sql
            // └── R__Create_views.sql

            // V1__Create_users_table.sql - 创建用户表
            CREATE TABLE ${table_prefix}users (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                username VARCHAR(50) NOT NULL UNIQUE,
                email VARCHAR(100) NOT NULL UNIQUE,
                password_hash VARCHAR(255) NOT NULL,
                active BOOLEAN DEFAULT TRUE,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                INDEX idx_username (username),
                INDEX idx_email (email)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            -- 插入初始管理员用户
            INSERT INTO ${table_prefix}users (username, email, password_hash, active)
            VALUES ('admin', 'admin@example.com', '$2a$10$...', TRUE);

            // V2__Add_email_index.sql - 添加邮箱索引
            CREATE INDEX idx_users_email_active ON ${table_prefix}users(email, active);

            -- 添加唯一约束
            ALTER TABLE ${table_prefix}users
            ADD CONSTRAINT uk_users_username UNIQUE (username);

            // V3__Create_products_table.sql - 创建产品表
            CREATE TABLE ${table_prefix}products (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                name VARCHAR(100) NOT NULL,
                description TEXT,
                price DECIMAL(10, 2) NOT NULL,
                stock INT NOT NULL DEFAULT 0,
                category VARCHAR(50),
                active BOOLEAN DEFAULT TRUE,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                INDEX idx_category (category),
                INDEX idx_price (price),
                INDEX idx_active (active)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            -- 创建产品分类表
            CREATE TABLE ${table_prefix}categories (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                name VARCHAR(50) NOT NULL UNIQUE,
                description VARCHAR(255),
                parent_id BIGINT,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                FOREIGN KEY (parent_id) REFERENCES ${table_prefix}categories(id) ON DELETE CASCADE
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            // V4__Add_created_at_columns.sql - 添加时间戳列
            ALTER TABLE ${table_prefix}products
            ADD COLUMN deleted_at TIMESTAMP NULL,
            ADD INDEX idx_deleted_at (deleted_at);

            -- 添加软删除标记
            ALTER TABLE ${table_prefix}users
            ADD COLUMN deleted_at TIMESTAMP NULL;

            // R__Create_views.sql - 可重复脚本(视图)
            -- 活跃用户视图
            CREATE OR REPLACE VIEW v_active_users AS
            SELECT id, username, email, created_at
            FROM ${table_prefix}users
            WHERE active = TRUE AND deleted_at IS NULL;

            -- 产品统计视图
            CREATE OR REPLACE VIEW v_product_stats AS
            SELECT
                category,
                COUNT(*) as product_count,
                AVG(price) as avg_price,
                SUM(stock) as total_stock
            FROM ${table_prefix}products
            WHERE active = TRUE AND deleted_at IS NULL
            GROUP BY category;

            // Flyway监听器
            import io.micronaut.flyway.event.FlywayMigrationFinishedEvent;
            import io.micronaut.runtime.event.annotation.EventListener;

            @Singleton
            public class FlywayEventListener {

                @EventListener
                public void onMigrationFinished(FlywayMigrationFinishedEvent event) {
                    System.out.println("=== Flyway迁移完成 ===");
                    System.out.println("数据源: " + event.getDataSourceName());
                    System.out.println("迁移结果: " + event.getMigrationResult());
                    System.out.println("执行时间: " + event.getMigrationResult().totalMigrationTime + "ms");
                    System.out.println("成功迁移数: " + event.getMigrationResult().migrationsExecuted);
                }
            }

            // 编程式Flyway控制
            @Singleton
            public class FlywayService {
                private final Flyway flyway;

                public FlywayService(Flyway flyway) {
                    this.flyway = flyway;
                }

                // 获取迁移信息
                public void getMigrationInfo() {
                    System.out.println("=== 迁移信息 ===");

                    MigrationInfoService info = flyway.info();

                    for (MigrationInfo migration : info.all()) {
                        System.out.println("版本: " + migration.getVersion());
                        System.out.println("  描述: " + migration.getDescription());
                        System.out.println("  类型: " + migration.getType());
                        System.out.println("  状态: " + migration.getState());
                        System.out.println("  执行时间: " + migration.getInstalledOn());
                        System.out.println("  执行耗时: " + migration.getExecutionTime() + "ms\n");
                    }
                }

                // 验证迁移
                public boolean validateMigrations() {
                    System.out.println("验证迁移脚本...");

                    try {
                        flyway.validate();
                        System.out.println("  验证通过");
                        return true;
                    } catch (Exception e) {
                        System.err.println("  验证失败: " + e.getMessage());
                        return false;
                    }
                }

                // 修复迁移(生产环境慎用)
                public void repairMigrations() {
                    System.out.println("修复迁移记录...");
                    flyway.repair();
                    System.out.println("  修复完成");
                }
            }

            // 迁移测试
            @MicronautTest
            public class FlywayMigrationTest {

                @Inject
                FlywayService flywayService;

                @Test
                public void testMigrationsApplied() {
                    System.out.println("测试迁移是否正确应用");

                    // 验证迁移
                    assertTrue(flywayService.validateMigrations());

                    // 检查迁移信息
                    flywayService.getMigrationInfo();
                }
            }
            ---
    b.版本控制
        a.迁移版本管理
            使用版本号(V1, V2, V3...)和时间戳管理迁移脚本执行顺序,Flyway自动追踪已执行版本。支持基线迁移、跳过版本等灵活配置。
        b.版本管理示例
            ---
            // 版本号命名规范
            // V{版本号}__{描述}.sql
            // V1__Initial_schema.sql
            // V2__Add_user_roles.sql
            // V2.1__Fix_user_constraints.sql

            // 时间戳命名
            // V{YYYYMMDDHHmmss}__{描述}.sql
            // V20240101120000__Create_orders_table.sql
            // V20240102093000__Add_payment_status.sql

            // V5__Create_orders_table.sql - 订单表
            CREATE TABLE ${table_prefix}orders (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                order_number VARCHAR(50) NOT NULL UNIQUE,
                user_id BIGINT NOT NULL,
                total_amount DECIMAL(10, 2) NOT NULL,
                status VARCHAR(20) NOT NULL DEFAULT 'PENDING',
                payment_method VARCHAR(20),
                payment_status VARCHAR(20) DEFAULT 'UNPAID',
                shipping_address TEXT,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                paid_at TIMESTAMP NULL,
                shipped_at TIMESTAMP NULL,
                delivered_at TIMESTAMP NULL,
                INDEX idx_user_id (user_id),
                INDEX idx_order_number (order_number),
                INDEX idx_status (status),
                INDEX idx_created_at (created_at),
                FOREIGN KEY (user_id) REFERENCES ${table_prefix}users(id) ON DELETE RESTRICT
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            -- 订单项表
            CREATE TABLE ${table_prefix}order_items (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                order_id BIGINT NOT NULL,
                product_id BIGINT NOT NULL,
                quantity INT NOT NULL,
                unit_price DECIMAL(10, 2) NOT NULL,
                subtotal DECIMAL(10, 2) NOT NULL,
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                INDEX idx_order_id (order_id),
                INDEX idx_product_id (product_id),
                FOREIGN KEY (order_id) REFERENCES ${table_prefix}orders(id) ON DELETE CASCADE,
                FOREIGN KEY (product_id) REFERENCES ${table_prefix}products(id) ON DELETE RESTRICT
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            // V6__Add_audit_columns.sql - 添加审计列
            -- 为主要表添加审计字段
            ALTER TABLE ${table_prefix}users
            ADD COLUMN created_by VARCHAR(50),
            ADD COLUMN updated_by VARCHAR(50);

            ALTER TABLE ${table_prefix}products
            ADD COLUMN created_by VARCHAR(50),
            ADD COLUMN updated_by VARCHAR(50);

            ALTER TABLE ${table_prefix}orders
            ADD COLUMN created_by VARCHAR(50),
            ADD COLUMN updated_by VARCHAR(50),
            ADD COLUMN cancelled_at TIMESTAMP NULL,
            ADD COLUMN cancelled_by VARCHAR(50);

            // V7__Create_audit_log_table.sql - 审计日志表
            CREATE TABLE ${table_prefix}audit_logs (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                table_name VARCHAR(50) NOT NULL,
                record_id BIGINT NOT NULL,
                action VARCHAR(20) NOT NULL,
                old_values JSON,
                new_values JSON,
                changed_by VARCHAR(50),
                changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                ip_address VARCHAR(45),
                user_agent TEXT,
                INDEX idx_table_record (table_name, record_id),
                INDEX idx_changed_at (changed_at),
                INDEX idx_changed_by (changed_by)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            // V8__Add_full_text_search.sql - 全文搜索索引
            -- 为产品表添加全文索引
            ALTER TABLE ${table_prefix}products
            ADD FULLTEXT INDEX ft_name_description (name, description);

            -- 创建搜索历史表
            CREATE TABLE ${table_prefix}search_history (
                id BIGINT AUTO_INCREMENT PRIMARY KEY,
                user_id BIGINT,
                search_query VARCHAR(255) NOT NULL,
                results_count INT,
                search_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                INDEX idx_user_id (user_id),
                INDEX idx_search_time (search_time),
                FOREIGN KEY (user_id) REFERENCES ${table_prefix}users(id) ON DELETE SET NULL
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

            // 迁移版本管理服务
            @Singleton
            public class MigrationVersionService {
                private final Flyway flyway;

                public MigrationVersionService(Flyway flyway) {
                    this.flyway = flyway;
                }

                // 获取当前版本
                public String getCurrentVersion() {
                    MigrationInfo current = flyway.info().current();
                    if (current != null) {
                        String version = current.getVersion().toString();
                        System.out.println("当前数据库版本: " + version);
                        return version;
                    }
                    return "未迁移";
                }

                // 获取所有待执行的迁移
                public List<String> getPendingMigrations() {
                    System.out.println("检查待执行的迁移...");

                    List<String> pending = new ArrayList<>();
                    for (MigrationInfo info : flyway.info().pending()) {
                        String migration = info.getVersion() + " - " + info.getDescription();
                        pending.add(migration);
                        System.out.println("  待执行: " + migration);
                    }

                    return pending;
                }

                // 获取已应用的迁移
                public List<String> getAppliedMigrations() {
                    System.out.println("已应用的迁移:");

                    List<String> applied = new ArrayList<>();
                    for (MigrationInfo info : flyway.info().applied()) {
                        String migration = info.getVersion() + " - " + info.getDescription();
                        applied.add(migration);
                        System.out.println("  " + migration +
                            " (执行于: " + info.getInstalledOn() + ")");
                    }

                    return applied;
                }
            }
            ---

02.Liquibase集成
    a.变更集管理
        a.XML/YAML变更日志
            Liquibase使用XML、YAML或JSON格式定义数据库变更集,提供比Flyway更丰富的抽象和数据库无关特性。支持回滚、标签、上下文等高级功能。
        b.Liquibase配置示例
            ---
            // build.gradle - Liquibase依赖
            dependencies {
                implementation("io.micronaut.liquibase:micronaut-liquibase")
            }

            // application.yml - Liquibase配置
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/mydb
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD}

            liquibase:
              datasources:
                default:
                  enabled: true
                  # 变更日志文件
                  change-log: classpath:db/changelog/db.changelog-master.xml
                  # 执行上下文
                  contexts: dev,test
                  # 标签过滤
                  labels: feature-a,feature-b
                  # 回滚失败时不停止
                  drop-first: false

            // 变更日志目录结构
            // src/main/resources/db/changelog/
            // ├── db.changelog-master.xml
            // ├── changes/
            // │   ├── v1.0-initial-schema.xml
            // │   ├── v1.1-add-indexes.xml
            // │   └── v2.0-add-orders.xml
            // └── data/
            //     └── initial-data.xml

            // db.changelog-master.xml - 主变更日志
            <?xml version="1.0" encoding="UTF-8"?>
            <databaseChangeLog
                xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">

                <!-- 包含所有变更集文件 -->
                <include file="classpath:db/changelog/changes/v1.0-initial-schema.xml"/>
                <include file="classpath:db/changelog/changes/v1.1-add-indexes.xml"/>
                <include file="classpath:db/changelog/changes/v2.0-add-orders.xml"/>
                <include file="classpath:db/changelog/data/initial-data.xml"/>
            </databaseChangeLog>

            // v1.0-initial-schema.xml - 初始schema
            <?xml version="1.0" encoding="UTF-8"?>
            <databaseChangeLog
                xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">

                <!-- 创建用户表 -->
                <changeSet id="1" author="developer">
                    <createTable tableName="users">
                        <column name="id" type="BIGINT" autoIncrement="true">
                            <constraints primaryKey="true" nullable="false"/>
                        </column>
                        <column name="username" type="VARCHAR(50)">
                            <constraints unique="true" nullable="false"/>
                        </column>
                        <column name="email" type="VARCHAR(100)">
                            <constraints unique="true" nullable="false"/>
                        </column>
                        <column name="password_hash" type="VARCHAR(255)">
                            <constraints nullable="false"/>
                        </column>
                        <column name="active" type="BOOLEAN" defaultValueBoolean="true"/>
                        <column name="created_at" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"/>
                        <column name="updated_at" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"/>
                    </createTable>

                    <!-- 回滚操作 -->
                    <rollback>
                        <dropTable tableName="users"/>
                    </rollback>
                </changeSet>

                <!-- 创建产品表 -->
                <changeSet id="2" author="developer">
                    <createTable tableName="products">
                        <column name="id" type="BIGINT" autoIncrement="true">
                            <constraints primaryKey="true"/>
                        </column>
                        <column name="name" type="VARCHAR(100)">
                            <constraints nullable="false"/>
                        </column>
                        <column name="description" type="TEXT"/>
                        <column name="price" type="DECIMAL(10,2)">
                            <constraints nullable="false"/>
                        </column>
                        <column name="stock" type="INT" defaultValueNumeric="0"/>
                        <column name="category" type="VARCHAR(50)"/>
                        <column name="active" type="BOOLEAN" defaultValueBoolean="true"/>
                        <column name="created_at" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"/>
                        <column name="updated_at" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"/>
                    </createTable>

                    <rollback>
                        <dropTable tableName="products"/>
                    </rollback>
                </changeSet>
            </databaseChangeLog>

            // v1.1-add-indexes.xml - 添加索引
            <?xml version="1.0" encoding="UTF-8"?>
            <databaseChangeLog
                xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">

                <!-- 为用户表添加索引 -->
                <changeSet id="3" author="developer">
                    <createIndex tableName="users" indexName="idx_username">
                        <column name="username"/>
                    </createIndex>

                    <createIndex tableName="users" indexName="idx_email">
                        <column name="email"/>
                    </createIndex>

                    <createIndex tableName="users" indexName="idx_active_created">
                        <column name="active"/>
                        <column name="created_at"/>
                    </createIndex>

                    <rollback>
                        <dropIndex tableName="users" indexName="idx_username"/>
                        <dropIndex tableName="users" indexName="idx_email"/>
                        <dropIndex tableName="users" indexName="idx_active_created"/>
                    </rollback>
                </changeSet>

                <!-- 为产品表添加索引 -->
                <changeSet id="4" author="developer">
                    <createIndex tableName="products" indexName="idx_category">
                        <column name="category"/>
                    </createIndex>

                    <createIndex tableName="products" indexName="idx_price">
                        <column name="price"/>
                    </createIndex>

                    <rollback>
                        <dropIndex tableName="products" indexName="idx_category"/>
                        <dropIndex tableName="products" indexName="idx_price"/>
                    </rollback>
                </changeSet>
            </databaseChangeLog>

            // YAML格式变更日志
            // db.changelog-master.yml
            databaseChangeLog:
              - include:
                  file: db/changelog/changes/v1.0-initial-schema.yml
              - include:
                  file: db/changelog/changes/v2.0-add-orders.yml

            // v2.0-add-orders.yml
            databaseChangeLog:
              - changeSet:
                  id: 5
                  author: developer
                  changes:
                    - createTable:
                        tableName: orders
                        columns:
                          - column:
                              name: id
                              type: BIGINT
                              autoIncrement: true
                              constraints:
                                primaryKey: true
                                nullable: false
                          - column:
                              name: order_number
                              type: VARCHAR(50)
                              constraints:
                                unique: true
                                nullable: false
                          - column:
                              name: user_id
                              type: BIGINT
                              constraints:
                                nullable: false
                                foreignKeyName: fk_orders_user
                                references: users(id)
                          - column:
                              name: total_amount
                              type: DECIMAL(10,2)
                              constraints:
                                nullable: false
                          - column:
                              name: status
                              type: VARCHAR(20)
                              defaultValue: PENDING
                          - column:
                              name: created_at
                              type: TIMESTAMP
                              defaultValueComputed: CURRENT_TIMESTAMP
                  rollback:
                    - dropTable:
                        tableName: orders

            // Liquibase服务
            @Singleton
            public class LiquibaseService {
                private final Liquibase liquibase;

                public LiquibaseService(Liquibase liquibase) {
                    this.liquibase = liquibase;
                }

                // 获取变更集状态
                public void getChangeSetStatus() {
                    System.out.println("=== Liquibase变更集状态 ===");

                    try {
                        List<ChangeSet> changeSets = liquibase.listUnrunChangeSets(
                            new Contexts(),
                            new LabelExpression()
                        );

                        System.out.println("未执行的变更集数: " + changeSets.size());

                        for (ChangeSet changeSet : changeSets) {
                            System.out.println("ID: " + changeSet.getId());
                            System.out.println("  作者: " + changeSet.getAuthor());
                            System.out.println("  文件: " + changeSet.getFilePath());
                            System.out.println("  描述: " + changeSet.getDescription());
                        }
                    } catch (Exception e) {
                        System.err.println("获取变更集状态失败: " + e.getMessage());
                    }
                }

                // 执行更新到指定标签
                public void updateToTag(String tag) {
                    System.out.println("更新数据库到标签: " + tag);

                    try {
                        liquibase.update(tag, new Contexts());
                        System.out.println("  更新完成");
                    } catch (Exception e) {
                        System.err.println("更新失败: " + e.getMessage());
                    }
                }

                // 回滚到指定标签
                public void rollbackToTag(String tag) {
                    System.out.println("回滚数据库到标签: " + tag);

                    try {
                        liquibase.rollback(tag, new Contexts());
                        System.out.println("  回滚完成");
                    } catch (Exception e) {
                        System.err.println("回滚失败: " + e.getMessage());
                    }
                }

                // 生成回滚SQL
                public String generateRollbackSQL(int count) {
                    System.out.println("生成回滚SQL (最近 " + count + " 个变更集)");

                    try {
                        StringWriter writer = new StringWriter();
                        liquibase.rollback(count, null, new Contexts(), writer);
                        return writer.toString();
                    } catch (Exception e) {
                        System.err.println("生成回滚SQL失败: " + e.getMessage());
                        return "";
                    }
                }
            }
            ---
    b.回滚策略
        a.变更回滚
            Liquibase支持定义回滚操作,可以回滚到特定版本或标签。提供回滚预览、回滚SQL生成等功能,确保数据库变更可逆。
        b.回滚策略示例
            ---
            // 定义回滚操作的变更集
            // v3.0-add-user-roles.xml
            <?xml version="1.0" encoding="UTF-8"?>
            <databaseChangeLog
                xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                    http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd">

                <!-- 创建角色表 -->
                <changeSet id="6" author="developer">
                    <createTable tableName="roles">
                        <column name="id" type="BIGINT" autoIncrement="true">
                            <constraints primaryKey="true"/>
                        </column>
                        <column name="name" type="VARCHAR(50)">
                            <constraints unique="true" nullable="false"/>
                        </column>
                        <column name="description" type="VARCHAR(255)"/>
                    </createTable>

                    <!-- 明确的回滚操作 -->
                    <rollback>
                        <dropTable tableName="roles"/>
                    </rollback>
                </changeSet>

                <!-- 创建用户角色关联表 -->
                <changeSet id="7" author="developer">
                    <createTable tableName="user_roles">
                        <column name="user_id" type="BIGINT">
                            <constraints nullable="false"
                                        foreignKeyName="fk_user_roles_user"
                                        references="users(id)"/>
                        </column>
                        <column name="role_id" type="BIGINT">
                            <constraints nullable="false"
                                        foreignKeyName="fk_user_roles_role"
                                        references="roles(id)"/>
                        </column>
                    </createTable>

                    <addPrimaryKey tableName="user_roles"
                                  columnNames="user_id, role_id"
                                  constraintName="pk_user_roles"/>

                    <!-- 回滚操作 -->
                    <rollback>
                        <dropTable tableName="user_roles"/>
                    </rollback>
                </changeSet>

                <!-- 插入初始角色数据 -->
                <changeSet id="8" author="developer">
                    <insert tableName="roles">
                        <column name="name" value="ADMIN"/>
                        <column name="description" value="管理员角色"/>
                    </insert>
                    <insert tableName="roles">
                        <column name="name" value="USER"/>
                        <column name="description" value="普通用户角色"/>
                    </insert>

                    <!-- 回滚:删除插入的数据 -->
                    <rollback>
                        <delete tableName="roles">
                            <where>name IN ('ADMIN', 'USER')</where>
                        </delete>
                    </rollback>
                </changeSet>

                <!-- 添加标签用于回滚 -->
                <changeSet id="9" author="developer">
                    <tagDatabase tag="version-1.0"/>
                </changeSet>
            </databaseChangeLog>

            // 使用自定义SQL的回滚
            <changeSet id="10" author="developer">
                <sql>
                    ALTER TABLE products ADD COLUMN discount DECIMAL(5,2) DEFAULT 0.00;
                    UPDATE products SET discount = 0.10 WHERE category = 'Electronics';
                </sql>

                <!-- 自定义SQL回滚 -->
                <rollback>
                    <sql>
                        ALTER TABLE products DROP COLUMN discount;
                    </sql>
                </rollback>
            </changeSet>

            // 复杂回滚操作
            <changeSet id="11" author="developer">
                <!-- 修改列类型 -->
                <modifyDataType tableName="products"
                               columnName="price"
                               newDataType="DECIMAL(12,2)"/>

                <!-- 自动生成回滚 -->
                <rollback changeSetId="11" changeSetAuthor="developer"/>
            </changeSet>

            // 回滚管理服务
            @Singleton
            public class RollbackManagementService {
                private final Liquibase liquibase;

                public RollbackManagementService(Liquibase liquibase) {
                    this.liquibase = liquibase;
                }

                // 回滚指定数量的变更集
                public void rollbackCount(int count) {
                    System.out.println("回滚最近 " + count + " 个变更集");

                    try {
                        liquibase.rollback(count, null, new Contexts());
                        System.out.println("  回滚完成");
                    } catch (Exception e) {
                        System.err.println("回滚失败: " + e.getMessage());
                    }
                }

                // 回滚到指定日期
                public void rollbackToDate(Date date) {
                    System.out.println("回滚到日期: " + date);

                    try {
                        liquibase.rollback(date, new Contexts());
                        System.out.println("  回滚完成");
                    } catch (Exception e) {
                        System.err.println("回滚失败: " + e.getMessage());
                    }
                }

                // 回滚到指定标签
                public void rollbackToTag(String tag) {
                    System.out.println("回滚到标签: " + tag);

                    try {
                        liquibase.rollback(tag, new Contexts());
                        System.out.println("  回滚完成");
                    } catch (Exception e) {
                        System.err.println("回滚失败: " + e.getMessage());
                    }
                }

                // 预览回滚SQL
                public String previewRollback(int count) {
                    System.out.println("预览回滚SQL (最近 " + count + " 个变更集)");

                    try {
                        StringWriter writer = new StringWriter();
                        liquibase.rollback(count, null, new Contexts(), writer);

                        String rollbackSQL = writer.toString();
                        System.out.println("\n回滚SQL:\n" + rollbackSQL);

                        return rollbackSQL;
                    } catch (Exception e) {
                        System.err.println("预览回滚失败: " + e.getMessage());
                        return "";
                    }
                }

                // 测试回滚(先更新再回滚)
                public void testRollback(String tag) {
                    System.out.println("测试回滚到标签: " + tag);

                    try {
                        // 1. 记录当前状态
                        System.out.println("  1. 记录当前状态");
                        String currentTag = "test-checkpoint-" + System.currentTimeMillis();
                        liquibase.tag(currentTag);

                        // 2. 执行更新
                        System.out.println("  2. 执行更新到标签: " + tag);
                        liquibase.update(tag, new Contexts());

                        // 3. 回滚到原状态
                        System.out.println("  3. 回滚到原状态");
                        liquibase.rollback(currentTag, new Contexts());

                        System.out.println("  测试回滚完成");
                    } catch (Exception e) {
                        System.err.println("测试回滚失败: " + e.getMessage());
                    }
                }
            }
            ---

03.Schema管理
    a.自动生成schema
        a.JPA自动DDL
            通过JPA的hbm2ddl.auto配置自动生成数据库schema,适合开发环境快速迭代。支持create、update、validate等模式,生产环境建议使用validate或关闭。
        b.自动DDL示例
            ---
            // application.yml - JPA自动DDL配置
            jpa:
              default:
                properties:
                  hibernate:
                    # DDL自动生成策略
                    hbm2ddl:
                      auto: update           # create | create-drop | update | validate | none
                    # SQL输出
                    show_sql: true
                    format_sql: true
                    use_sql_comments: true
                    # Schema命名策略
                    physical_naming_strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
                    implicit_naming_strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl

            // 实体定义自动生成表
            @Entity
            @Table(name = "customers",
                  indexes = {
                      @Index(name = "idx_email", columnList = "email"),
                      @Index(name = "idx_phone", columnList = "phone")
                  },
                  uniqueConstraints = {
                      @UniqueConstraint(name = "uk_customer_email", columnNames = {"email"})
                  })
            public class Customer {
                @Id
                @GeneratedValue(strategy = GenerationType.IDENTITY)
                private Long id;

                @Column(nullable = false, length = 100)
                private String name;

                @Column(nullable = false, unique = true, length = 100)
                private String email;

                @Column(length = 20)
                private String phone;

                @Embedded
                private Address address;

                @OneToMany(mappedBy = "customer", cascade = CascadeType.ALL, orphanRemoval = true)
                private List<Order> orders = new ArrayList<>();

                @Column(name = "created_at", nullable = false, updatable = false)
                @CreationTimestamp
                private LocalDateTime createdAt;

                @Column(name = "updated_at")
                @UpdateTimestamp
                private LocalDateTime updatedAt;

                // Getter和Setter省略
            }

            @Embeddable
            public class Address {
                @Column(length = 255)
                private String street;

                @Column(length = 50)
                private String city;

                @Column(length = 20)
                private String zipCode;

                @Column(length = 50)
                private String country;

                // Getter和Setter省略
            }

            // DDL生成服务
            @Singleton
            public class SchemaGenerationService {
                private final EntityManagerFactory entityManagerFactory;

                public SchemaGenerationService(EntityManagerFactory entityManagerFactory) {
                    this.entityManagerFactory = entityManagerFactory;
                }

                // 生成DDL脚本
                public void generateDDLScript() {
                    System.out.println("=== 生成DDL脚本 ===");

                    Map<String, Object> properties = new HashMap<>();
                    properties.put("javax.persistence.schema-generation.scripts.action", "create");
                    properties.put("javax.persistence.schema-generation.scripts.create-target",
                                  "target/generated-schema.sql");

                    // 触发schema生成
                    Persistence.generateSchema("default", properties);

                    System.out.println("DDL脚本已生成到: target/generated-schema.sql");
                }

                // 验证schema
                public void validateSchema() {
                    System.out.println("验证数据库Schema...");

                    SessionFactory sessionFactory =
                        entityManagerFactory.unwrap(SessionFactory.class);

                    // Hibernate会自动验证schema与实体映射的一致性
                    System.out.println("  Schema验证完成");
                }
            }

            // 环境特定配置
            // application-dev.yml - 开发环境
            jpa:
              default:
                properties:
                  hibernate:
                    hbm2ddl:
                      auto: update        # 开发环境自动更新
                    show_sql: true

            // application-prod.yml - 生产环境
            jpa:
              default:
                properties:
                  hibernate:
                    hbm2ddl:
                      auto: validate      # 生产环境只验证
                    show_sql: false

            // 初始化数据
            @Singleton
            public class DataInitializer {

                @EventListener
                public void onStartup(ServerStartupEvent event) {
                    System.out.println("=== 初始化数据 ===");
                    // 初始化逻辑
                }
            }
            ---
    b.Schema版本化
        a.迁移工具整合
            结合Flyway或Liquibase实现schema版本化管理,在生产环境使用迁移工具,开发环境可选择自动DDL。确保数据库变更可追踪、可回滚、可复现。
        b.整合示例
            ---
            // 混合使用JPA和Flyway
            // application.yml
            jpa:
              default:
                properties:
                  hibernate:
                    # 生产环境使用Flyway,验证schema
                    hbm2ddl:
                      auto: validate
                    show_sql: false

            flyway:
              datasources:
                default:
                  enabled: true
                  locations: classpath:db/migration
                  baseline-on-migrate: true

            // Schema同步服务
            @Singleton
            public class SchemaSyncService {
                private final EntityManagerFactory entityManagerFactory;
                private final Flyway flyway;

                public SchemaSyncService(EntityManagerFactory entityManagerFactory,
                                        Flyway flyway) {
                    this.entityManagerFactory = entityManagerFactory;
                    this.flyway = flyway;
                }

                // 生成迁移脚本
                public void generateMigrationScript() {
                    System.out.println("=== 生成迁移脚本 ===");

                    // 1. 生成当前实体的DDL
                    String ddl = generateEntityDDL();

                    // 2. 与现有schema对比
                    String diff = compareWithCurrentSchema(ddl);

                    // 3. 生成Flyway迁移脚本
                    if (!diff.isEmpty()) {
                        String version = getNextMigrationVersion();
                        String filename = String.format("V%s__Generated_migration.sql", version);

                        System.out.println("生成迁移文件: " + filename);
                        System.out.println("变更内容:\n" + diff);

                        // 写入迁移文件
                        saveMigrationScript(filename, diff);
                    } else {
                        System.out.println("Schema无变更");
                    }
                }

                private String generateEntityDDL() {
                    // 生成DDL逻辑
                    return "";
                }

                private String compareWithCurrentSchema(String ddl) {
                    // 对比逻辑
                    return "";
                }

                private String getNextMigrationVersion() {
                    MigrationInfo current = flyway.info().current();
                    if (current != null) {
                        String version = current.getVersion().toString();
                        int nextVersion = Integer.parseInt(version) + 1;
                        return String.valueOf(nextVersion);
                    }
                    return "1";
                }

                private void saveMigrationScript(String filename, String content) {
                    // 保存文件逻辑
                }
            }

            // CI/CD集成
            @Singleton
            public class MigrationCIService {

                // 验证迁移脚本
                public boolean validateMigrations() {
                    System.out.println("CI: 验证迁移脚本");

                    // 1. 检查迁移文件命名
                    // 2. 验证SQL语法
                    // 3. 检查是否有未提交的迁移
                    // 4. 验证回滚脚本

                    return true;
                }

                // 在测试数据库运行迁移
                public boolean testMigrations() {
                    System.out.println("CI: 测试迁移脚本");

                    // 1. 创建临时测试数据库
                    // 2. 运行所有迁移
                    // 3. 测试回滚
                    // 4. 清理测试数据库

                    return true;
                }
            }
            ---

5.7 R2DBC响应式数据访问

01.R2DBC概述
    a.核心概念
        R2DBC(Reactive Relational Database Connectivity)是响应式关系数据库连接规范,提供完全非阻塞的数据库访问能力。Micronaut Data R2DBC支持响应式流式查询,适用于高并发场景,充分利用系统资源。
    b.主要优势
        a.非阻塞I/O
            所有数据库操作都是异步非阻塞的,不会占用线程等待数据库响应,提升系统吞吐量。
        b.背压支持
            支持响应式流背压机制,消费者可以控制数据生产速率,避免内存溢出。
        c.流式处理
            支持大数据集的流式处理,逐条消费数据,内存占用低。

02.依赖配置
    a.添加依赖
        a.功能说明
            添加Micronaut Data R2DBC和数据库驱动依赖。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.data:micronaut-data-r2dbc")
                implementation("io.micronaut.r2dbc:micronaut-r2dbc-core")

                // MySQL驱动
                runtimeOnly("dev.miku:r2dbc-mysql")

                // PostgreSQL驱动
                // runtimeOnly("org.postgresql:r2dbc-postgresql")

                // H2驱动(测试用)
                // runtimeOnly("io.r2dbc:r2dbc-h2")

                annotationProcessor("io.micronaut.data:micronaut-data-processor")
            }
            ---
    b.数据源配置
        a.功能说明
            配置R2DBC数据源连接信息。
        b.配置示例
            ---
            // application.yml
            r2dbc:
              datasources:
                default:
                  url: r2dbc:mysql://localhost:3306/testdb
                  username: root
                  password: secret
                  driver: mysql
                  options:
                    # 连接池配置
                    initial-size: 5
                    max-size: 20
                    max-idle-time: 30m
                    max-acquire-time: 3s
                    max-create-connection-time: 3s
            ---

03.Repository定义
    a.响应式Repository
        a.功能说明
            继承ReactiveStreamsCrudRepository或CoroutineCrudRepository,定义响应式数据访问接口。
        b.代码示例
            ---
            import io.micronaut.data.annotation.*;
            import io.micronaut.data.model.query.builder.sql.Dialect;
            import io.micronaut.data.r2dbc.annotation.R2dbcRepository;
            import io.micronaut.data.repository.reactive.ReactiveStreamsCrudRepository;
            import reactor.core.publisher.Flux;
            import reactor.core.publisher.Mono;

            @R2dbcRepository(dialect = Dialect.MYSQL)
            public interface ProductRepository extends ReactiveStreamsCrudRepository<Product, Long> {

                // 返回Mono<Product>
                Mono<Product> findByName(String name);

                // 返��Flux<Product>
                Flux<Product> findByCategory(String category);

                // 自定义查询
                @Query("SELECT * FROM product WHERE price > :minPrice ORDER BY price")
                Flux<Product> findExpensiveProducts(Double minPrice);

                // 统计查询
                Mono<Long> countByCategory(String category);

                // 存在性检查
                Mono<Boolean> existsByName(String name);

                // 删除操作
                Mono<Long> deleteByCategory(String category);
            }
            ---
    b.实体类定义
        a.功能说明
            使用@MappedEntity定义实体类,映射到数据库表。
        b.代码示例
            ---
            import io.micronaut.data.annotation.*;
            import io.micronaut.serde.annotation.Serdeable;

            @Serdeable
            @MappedEntity("product")
            public class Product {

                @Id
                @GeneratedValue(GeneratedValue.Type.IDENTITY)
                private Long id;

                @Column(name = "name")
                private String name;

                @Column(name = "category")
                private String category;

                @Column(name = "price")
                private Double price;

                @Column(name = "stock")
                private Integer stock;

                @DateCreated
                private LocalDateTime createdAt;

                @DateUpdated
                private LocalDateTime updatedAt;

                // Constructors, Getters and Setters
                public Product() {}

                public Product(String name, String category, Double price, Integer stock) {
                    this.name = name;
                    this.category = category;
                    this.price = price;
                    this.stock = stock;
                }

                public Long getId() {
                    return id;
                }

                public void setId(Long id) {
                    this.id = id;
                }

                public String getName() {
                    return name;
                }

                public void setName(String name) {
                    this.name = name;
                }

                public String getCategory() {
                    return category;
                }

                public void setCategory(String category) {
                    this.category = category;
                }

                public Double getPrice() {
                    return price;
                }

                public void setPrice(Double price) {
                    this.price = price;
                }

                public Integer getStock() {
                    return stock;
                }

                public void setStock(Integer stock) {
                    this.stock = stock;
                }

                public LocalDateTime getCreatedAt() {
                    return createdAt;
                }

                public void setCreatedAt(LocalDateTime createdAt) {
                    this.createdAt = createdAt;
                }

                public LocalDateTime getUpdatedAt() {
                    return updatedAt;
                }

                public void setUpdatedAt(LocalDateTime updatedAt) {
                    this.updatedAt = updatedAt;
                }
            }
            ---

04.响应式Controller
    a.基本CRUD操作
        a.功能说明
            在Controller中使用响应式Repository,返回Mono或Flux。
        b.代码示例
            ---
            import io.micronaut.http.annotation.*;
            import reactor.core.publisher.Flux;
            import reactor.core.publisher.Mono;

            @Controller("/products")
            public class ProductController {

                private final ProductRepository productRepository;

                public ProductController(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                // 查询所有产品
                @Get
                public Flux<Product> listAll() {
                    return productRepository.findAll();
                }

                // 根据ID查询
                @Get("/{id}")
                public Mono<Product> findById(Long id) {
                    return productRepository.findById(id);
                }

                // 创建产品
                @Post
                public Mono<Product> create(@Body Product product) {
                    return productRepository.save(product);
                }

                // 更新产品
                @Put("/{id}")
                public Mono<Product> update(Long id, @Body Product product) {
                    return productRepository.findById(id)
                        .flatMap(existing -> {
                            existing.setName(product.getName());
                            existing.setPrice(product.getPrice());
                            existing.setStock(product.getStock());
                            return productRepository.update(existing);
                        });
                }

                // 删除产品
                @Delete("/{id}")
                public Mono<Void> delete(Long id) {
                    return productRepository.deleteById(id).then();
                }
            }
            ---
    b.复杂查询操作
        a.功能说明
            实现分页、排序、条件查询等复杂操作。
        b.代码示例
            ---
            import io.micronaut.data.model.Pageable;
            import io.micronaut.data.model.Page;

            @Controller("/products")
            public class ProductController {

                private final ProductRepository productRepository;

                public ProductController(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                // 按分类查询
                @Get("/category/{category}")
                public Flux<Product> findByCategory(String category) {
                    return productRepository.findByCategory(category);
                }

                // 查询高价产品
                @Get("/expensive")
                public Flux<Product> findExpensive(@QueryValue Double minPrice) {
                    return productRepository.findExpensiveProducts(minPrice);
                }

                // 统计分类产品数量
                @Get("/category/{category}/count")
                public Mono<Long> countByCategory(String category) {
                    return productRepository.countByCategory(category);
                }

                // 检查产品是否存在
                @Get("/exists/{name}")
                public Mono<Boolean> exists(String name) {
                    return productRepository.existsByName(name);
                }

                // 批量删除
                @Delete("/category/{category}")
                public Mono<Long> deleteByCategory(String category) {
                    return productRepository.deleteByCategory(category);
                }
            }
            ---

05.响应式事务
    a.声明式事务
        a.功能说明
            使用@TransactionalEventListener注解管理响应式事务。
        b.代码示例
            ---
            import io.micronaut.transaction.annotation.Transactional;
            import reactor.core.publisher.Mono;

            @Singleton
            public class OrderService {

                private final OrderRepository orderRepository;
                private final ProductRepository productRepository;

                public OrderService(OrderRepository orderRepository,
                                  ProductRepository productRepository) {
                    this.orderRepository = orderRepository;
                    this.productRepository = productRepository;
                }

                @Transactional
                public Mono<Order> createOrder(Order order) {
                    return productRepository.findById(order.getProductId())
                        .flatMap(product -> {
                            if (product.getStock() < order.getQuantity()) {
                                return Mono.error(new RuntimeException("库存不足"));
                            }

                            // 扣减库存
                            product.setStock(product.getStock() - order.getQuantity());

                            return productRepository.update(product)
                                .then(orderRepository.save(order));
                        });
                }

                @Transactional
                public Mono<Void> cancelOrder(Long orderId) {
                    return orderRepository.findById(orderId)
                        .flatMap(order ->
                            productRepository.findById(order.getProductId())
                                .flatMap(product -> {
                                    // 恢复库存
                                    product.setStock(product.getStock() + order.getQuantity());
                                    return productRepository.update(product);
                                })
                                .then(orderRepository.deleteById(orderId))
                        )
                        .then();
                }
            }
            ---
    b.编程式事务
        a.功能说明
            使用ReactiveTransactionOperations手动管理事务。
        b.代码示例
            ---
            import io.micronaut.transaction.reactive.ReactiveTransactionOperations;
            import reactor.core.publisher.Mono;

            @Singleton
            public class PaymentService {

                private final ReactiveTransactionOperations<Connection> transactionManager;
                private final OrderRepository orderRepository;
                private final PaymentRepository paymentRepository;

                public PaymentService(
                    ReactiveTransactionOperations<Connection> transactionManager,
                    OrderRepository orderRepository,
                    PaymentRepository paymentRepository
                ) {
                    this.transactionManager = transactionManager;
                    this.orderRepository = orderRepository;
                    this.paymentRepository = paymentRepository;
                }

                public Mono<Payment> processPayment(Long orderId, Payment payment) {
                    return transactionManager.withTransaction(status ->
                        orderRepository.findById(orderId)
                            .flatMap(order -> {
                                payment.setOrderId(orderId);
                                payment.setAmount(order.getTotalAmount());

                                return paymentRepository.save(payment)
                                    .flatMap(savedPayment -> {
                                        order.setStatus("PAID");
                                        return orderRepository.update(order)
                                            .thenReturn(savedPayment);
                                    });
                            })
                    );
                }
            }
            ---

06.流式处理
    a.大数据集处理
        a.功能说明
            使用Flux流式处理大量数据,避免一次性加载到内存。
        b.代码示例
            ---
            import reactor.core.publisher.Flux;
            import java.time.Duration;

            @Singleton
            public class ReportService {

                private final ProductRepository productRepository;

                public ReportService(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                // 流式导出产品数据
                public Flux<String> exportProducts() {
                    return productRepository.findAll()
                        .map(product -> String.format("%d,%s,%.2f,%d",
                            product.getId(),
                            product.getName(),
                            product.getPrice(),
                            product.getStock()
                        ))
                        .delayElements(Duration.ofMillis(10)); // 控制速率
                }

                // 批量处理
                public Mono<Long> updatePrices(Double multiplier) {
                    return productRepository.findAll()
                        .buffer(100) // 每批100条
                        .flatMap(batch ->
                            Flux.fromIterable(batch)
                                .flatMap(product -> {
                                    product.setPrice(product.getPrice() * multiplier);
                                    return productRepository.update(product);
                                })
                                .collectList()
                        )
                        .count();
                }
            }
            ---
    b.背压控制
        a.功能说明
            使用背压操作符控制数据流速率。
        b.代码示例
            ---
            import reactor.core.publisher.Flux;
            import reactor.core.scheduler.Schedulers;

            @Controller("/stream")
            public class StreamController {

                private final ProductRepository productRepository;

                public StreamController(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                @Get(value = "/products", produces = "text/event-stream")
                public Flux<Product> streamProducts() {
                    return productRepository.findAll()
                        .onBackpressureBuffer(1000) // 缓冲区大小
                        .publishOn(Schedulers.boundedElastic())
                        .delayElements(Duration.ofMillis(100)); // 限流
                }

                @Get(value = "/products/drop", produces = "text/event-stream")
                public Flux<Product> streamWithDrop() {
                    return productRepository.findAll()
                        .onBackpressureDrop() // 丢弃超出处理能力的数据
                        .publishOn(Schedulers.boundedElastic());
                }

                @Get(value = "/products/latest", produces = "text/event-stream")
                public Flux<Product> streamLatest() {
                    return productRepository.findAll()
                        .onBackpressureLatest() // 只保留最新数据
                        .publishOn(Schedulers.boundedElastic());
                }
            }
            ---

07.性能优化
    a.连接池配置
        a.功能说明
            优化R2DBC连接池参数,提升并发性能。
        b.配置示例
            ---
            // application.yml
            r2dbc:
              datasources:
                default:
                  url: r2dbc:mysql://localhost:3306/testdb
                  username: root
                  password: secret
                  options:
                    # 初始连接数
                    initial-size: 10
                    # 最大连接数
                    max-size: 50
                    # 最大空闲时间
                    max-idle-time: 30m
                    # 获取连接超时
                    max-acquire-time: 3s
                    # 创建连接超时
                    max-create-connection-time: 3s
                    # 连接验证查询
                    validation-query: SELECT 1
                    # 连接验证深度
                    validation-depth: LOCAL
            ---
    b.批量操作
        a.功能说明
            使用批量操作减少数据库往返次数。
        b.代码示例
            ---
            import reactor.core.publisher.Flux;
            import reactor.core.publisher.Mono;

            @Singleton
            public class BatchService {

                private final ProductRepository productRepository;

                public BatchService(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                // 批量插入
                public Mono<Long> batchInsert(List<Product> products) {
                    return Flux.fromIterable(products)
                        .buffer(100) // 每批100条
                        .flatMap(batch ->
                            productRepository.saveAll(batch).collectList()
                        )
                        .count();
                }

                // 批量更新
                public Mono<Long> batchUpdate(List<Product> products) {
                    return Flux.fromIterable(products)
                        .buffer(100)
                        .flatMap(batch ->
                            productRepository.updateAll(batch).collectList()
                        )
                        .count();
                }

                // 批量删除
                public Mono<Void> batchDelete(List<Long> ids) {
                    return Flux.fromIterable(ids)
                        .buffer(100)
                        .flatMap(batch ->
                            productRepository.deleteAll(
                                productRepository.findAllById(batch)
                            )
                        )
                        .then();
                }
            }
            ---
    c.查询优化
        a.功能说明
            使用索引、避免N+1查询等优化技巧。
        b.代码示例
            ---
            import io.micronaut.data.annotation.Join;

            @R2dbcRepository(dialect = Dialect.MYSQL)
            public interface OrderRepository extends ReactiveStreamsCrudRepository<Order, Long> {

                // 使用JOIN避免N+1查询
                @Join(value = "product", type = Join.Type.FETCH)
                Flux<Order> findAll();

                @Join(value = "product", type = Join.Type.FETCH)
                Mono<Order> findById(Long id);

                // 使用索引字段查询
                @Query("SELECT * FROM orders WHERE user_id = :userId AND status = :status")
                Flux<Order> findByUserIdAndStatus(Long userId, String status);

                // 只查询需要的字段
                @Query("SELECT id, total_amount, status FROM orders WHERE user_id = :userId")
                Flux<OrderSummary> findSummaryByUserId(Long userId);
            }

            // DTO投影
            @Introspected
            public class OrderSummary {
                private Long id;
                private Double totalAmount;
                private String status;

                // Getters and Setters
            }
            ---

6 高级特性

6.1 反应式编程

01.反应式编程概述
    a.定义与特点
        Micronaut原生支持反应式编程模型,基于Reactive Streams规范,提供非阻塞异步处理能力。通过响应式流处理,应用可以高效处理大量并发请求,充分利用系统资源,避免线程阻塞导致的性能瓶颈。
    b.核心优势
        a.资源利用率
            采用事件驱动模型,少量线程即可处理大量并发连接,显著降低内存占用和上下文切换开销。
        b.背压支持
            实现Reactive Streams背压机制,生产者根据消费者处理能力动态调整数据发送速率,防止系统过载。
        c.组合能力
            提供丰富的操作符,支持流的转换、过滤、合并等操作,简化复杂异步逻辑的实现。

02.Reactor集成
    a.依赖配置
        a.功能说明
            Micronaut默认集成Project Reactor,提供Mono和Flux两种核心响应式类型,分别表示0-1个元素和0-N个元素的异步序列。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.reactor:micronaut-reactor")
                implementation("io.projectreactor:reactor-core")
            }
            ---
    b.基础使用
        a.Mono示例
            a.功能说明
                Mono表示包含0或1个元素的异步序列,适用于单个结果的异步操作,如数据库查询单条记录、HTTP请求等场景。
            b.代码示例
                ---
                import io.micronaut.http.annotation.Controller;
                import io.micronaut.http.annotation.Get;
                import reactor.core.publisher.Mono;
                import java.time.Duration;

                @Controller("/reactive")
                public class ReactiveController {

                    // 返回单个用户信息
                    @Get("/user/{id}")
                    public Mono<User> getUser(Long id) {
                        return Mono.fromCallable(() -> {
                            // 模拟数据库查询
                            Thread.sleep(100);
                            return new User(id, "User" + id, "user" + id + "@example.com");
                        })
                        .subscribeOn(Schedulers.boundedElastic())
                        .timeout(Duration.ofSeconds(5));
                    }

                    // 延迟响应示例
                    @Get("/delayed")
                    public Mono<String> delayedResponse() {
                        return Mono.just("Response")
                            .delayElement(Duration.ofSeconds(2))
                            .map(s -> s + " after 2 seconds");
                    }
                }
                ---
        b.Flux示例
            a.功能说明
                Flux表示包含0到N个元素的异步序列,适用于流式数据处理,如分页查询、实时数据推送、文件流处理等场景。
            b.代码示例
                ---
                import reactor.core.publisher.Flux;
                import java.time.Duration;

                @Controller("/stream")
                public class StreamController {

                    // 流式返回用户列表
                    @Get("/users")
                    public Flux<User> streamUsers() {
                        return Flux.range(1, 10)
                            .delayElements(Duration.ofMillis(100))
                            .map(i -> new User(
                                Long.valueOf(i),
                                "User" + i,
                                "user" + i + "@example.com"
                            ));
                    }

                    // 服务器推送事件(SSE)
                    @Get(value = "/events", produces = MediaType.TEXT_EVENT_STREAM)
                    public Flux<ServerSentEvent<String>> streamEvents() {
                        return Flux.interval(Duration.ofSeconds(1))
                            .map(seq -> ServerSentEvent.<String>builder()
                                .id(String.valueOf(seq))
                                .data("Event " + seq)
                                .build());
                    }

                    // 无限流示例
                    @Get(value = "/infinite", produces = MediaType.TEXT_EVENT_STREAM)
                    public Flux<Long> infiniteStream() {
                        return Flux.interval(Duration.ofMillis(500))
                            .take(Duration.ofSeconds(10));
                    }
                }
                ---

03.RxJava集成
    a.依赖配置
        a.功能说明
            Micronaut同时支持RxJava 2和RxJava 3,提供Single、Maybe、Observable、Flowable等响应式类型,与Reactor互补。
        b.配置示例
            ---
            // build.gradle - RxJava 3
            dependencies {
                implementation("io.micronaut.rxjava3:micronaut-rxjava3")
                implementation("io.reactivex.rxjava3:rxjava:3.1.5")
            }
            ---
    b.RxJava使用
        a.Single和Maybe
            a.功能说明
                Single表示恰好一个元素的异步序列,Maybe表示0或1个元素,适用于可能为空的查询结果。
            b.代码示例
                ---
                import io.micronaut.http.annotation.Controller;
                import io.micronaut.http.annotation.Get;
                import io.reactivex.rxjava3.core.Single;
                import io.reactivex.rxjava3.core.Maybe;
                import io.reactivex.rxjava3.schedulers.Schedulers;

                @Controller("/rx")
                public class RxController {

                    // Single示例:必定返回结果
                    @Get("/count")
                    public Single<Long> getCount() {
                        return Single.fromCallable(() -> {
                            // 模拟计数查询
                            Thread.sleep(50);
                            return 100L;
                        }).subscribeOn(Schedulers.io());
                    }

                    // Maybe示例:可能为空
                    @Get("/find/{id}")
                    public Maybe<User> findUser(Long id) {
                        return Maybe.fromCallable(() -> {
                            if (id > 100) {
                                return null; // 未找到
                            }
                            return new User(id, "User" + id, "user" + id + "@example.com");
                        }).subscribeOn(Schedulers.io());
                    }
                }
                ---
        b.Observable和Flowable
            a.功能说明
                Observable用于简单的多元素流,Flowable支持背压控制,适用于高吞吐量场景。
            b.代码示例
                ---
                import io.reactivex.rxjava3.core.Observable;
                import io.reactivex.rxjava3.core.Flowable;
                import io.reactivex.rxjava3.core.BackpressureStrategy;

                @Controller("/rx-stream")
                public class RxStreamController {

                    // Observable示例
                    @Get("/items")
                    public Observable<Item> streamItems() {
                        return Observable.range(1, 20)
                            .map(i -> new Item(i, "Item " + i))
                            .delay(100, TimeUnit.MILLISECONDS);
                    }

                    // Flowable示例:支持背压
                    @Get(value = "/data", produces = MediaType.TEXT_EVENT_STREAM)
                    public Flowable<String> streamData() {
                        return Flowable.create(emitter -> {
                            for (int i = 0; i < 1000; i++) {
                                if (emitter.isCancelled()) {
                                    break;
                                }
                                emitter.onNext("Data " + i);
                                Thread.sleep(10);
                            }
                            emitter.onComplete();
                        }, BackpressureStrategy.BUFFER)
                        .subscribeOn(Schedulers.io());
                    }
                }
                ---

04.响应式HTTP客户端
    a.声明式客户端
        a.功能说明
            Micronaut的HTTP客户端原生支持响应式类型,可直接返回Mono、Flux、Single等,实现非阻塞的远程调用。
        b.代码示例
            ---
            import io.micronaut.http.annotation.Get;
            import io.micronaut.http.client.annotation.Client;
            import reactor.core.publisher.Mono;
            import reactor.core.publisher.Flux;

            @Client("https://api.example.com")
            public interface ApiClient {

                // 响应式单个结果
                @Get("/user/{id}")
                Mono<User> getUser(Long id);

                // 响应式列表
                @Get("/users")
                Flux<User> listUsers();

                // RxJava类型
                @Get("/count")
                Single<Long> getCount();
            }

            // 使用示例
            @Controller("/api")
            public class ApiController {

                private final ApiClient apiClient;

                public ApiController(ApiClient apiClient) {
                    this.apiClient = apiClient;
                }

                @Get("/proxy/user/{id}")
                public Mono<User> proxyGetUser(Long id) {
                    return apiClient.getUser(id)
                        .timeout(Duration.ofSeconds(3))
                        .onErrorResume(e -> Mono.just(
                            new User(id, "Fallback", "fallback@example.com")
                        ));
                }

                @Get("/proxy/users")
                public Flux<User> proxyListUsers() {
                    return apiClient.listUsers()
                        .take(10)
                        .filter(user -> user.getId() > 5);
                }
            }
            ---
    b.组合多个请求
        a.功能说明
            响应式编程的核心优势在于轻松组合多个异步操作,实现并行请求、依赖请求等复杂场景。
        b.代码示例
            ---
            @Controller("/combined")
            public class CombinedController {

                private final ApiClient apiClient;
                private final OrderClient orderClient;

                public CombinedController(ApiClient apiClient, OrderClient orderClient) {
                    this.apiClient = apiClient;
                    this.orderClient = orderClient;
                }

                // 并行请求多个服务
                @Get("/dashboard/{userId}")
                public Mono<Dashboard> getDashboard(Long userId) {
                    Mono<User> userMono = apiClient.getUser(userId);
                    Mono<List<Order>> ordersMono = orderClient.getUserOrders(userId)
                        .collectList();
                    Mono<Long> countMono = orderClient.getOrderCount(userId);

                    return Mono.zip(userMono, ordersMono, countMono)
                        .map(tuple -> new Dashboard(
                            tuple.getT1(),
                            tuple.getT2(),
                            tuple.getT3()
                        ));
                }

                // 依赖请求:先获取用户,再获取订单
                @Get("/user-orders/{userId}")
                public Flux<Order> getUserOrders(Long userId) {
                    return apiClient.getUser(userId)
                        .flatMapMany(user -> orderClient.getUserOrders(user.getId()));
                }

                // 错误处理和重试
                @Get("/resilient/{userId}")
                public Mono<User> getResilientUser(Long userId) {
                    return apiClient.getUser(userId)
                        .retry(3)
                        .timeout(Duration.ofSeconds(5))
                        .onErrorResume(TimeoutException.class, e ->
                            Mono.just(new User(userId, "Timeout", "timeout@example.com"))
                        )
                        .onErrorResume(e ->
                            Mono.just(new User(userId, "Error", "error@example.com"))
                        );
                }
            }
            ---

05.响应式数据访问
    a.R2DBC集成
        a.功能说明
            R2DBC(Reactive Relational Database Connectivity)是响应式关系数据库驱动规范,Micronaut Data支持R2DBC实现完全非阻塞的数据库访问。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.data:micronaut-data-r2dbc")
                implementation("io.r2dbc:r2dbc-postgresql:0.8.13.RELEASE")
                runtimeOnly("org.postgresql:postgresql")
            }

            // application.yml
            r2dbc:
              datasources:
                default:
                  url: r2dbc:postgresql://localhost:5432/mydb
                  username: user
                  password: pass
                  max-size: 10
            ---
        c.Repository定义
            ---
            import io.micronaut.data.annotation.Repository;
            import io.micronaut.data.repository.reactive.ReactorCrudRepository;
            import reactor.core.publisher.Mono;
            import reactor.core.publisher.Flux;

            @Repository
            public interface UserRepository extends ReactorCrudRepository<User, Long> {

                // 响应式查询方法
                Mono<User> findByEmail(String email);

                Flux<User> findByNameContaining(String name);

                Mono<Long> countByAgeGreaterThan(Integer age);

                // 自定义查询
                @Query("SELECT * FROM users WHERE created_at > :date")
                Flux<User> findRecentUsers(LocalDateTime date);
            }

            // 使用示例
            @Controller("/db-users")
            public class DbUserController {

                private final UserRepository userRepository;

                public DbUserController(UserRepository userRepository) {
                    this.userRepository = userRepository;
                }

                @Get("/{id}")
                public Mono<User> getUser(Long id) {
                    return userRepository.findById(id);
                }

                @Get("/search")
                public Flux<User> searchUsers(String name) {
                    return userRepository.findByNameContaining(name);
                }

                @Post
                public Mono<User> createUser(@Body User user) {
                    return userRepository.save(user);
                }

                @Delete("/{id}")
                public Mono<Void> deleteUser(Long id) {
                    return userRepository.deleteById(id);
                }
            }
            ---
    b.MongoDB响应式驱动
        a.功能说明
            Micronaut支持MongoDB响应式驱动,提供完全异步的文档数据库访问能力。
        b.代码示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.mongodb:micronaut-mongo-reactive")
            }

            // application.yml
            mongodb:
              uri: mongodb://localhost:27017/mydb

            // Repository定义
            import io.micronaut.data.mongodb.annotation.MongoRepository;
            import io.micronaut.data.repository.reactive.ReactorCrudRepository;

            @MongoRepository
            public interface ProductRepository extends ReactorCrudRepository<Product, String> {

                Flux<Product> findByCategory(String category);

                Mono<Product> findByName(String name);

                Flux<Product> findByPriceBetween(Double min, Double max);
            }

            // 使用示例
            @Controller("/products")
            public class ProductController {

                private final ProductRepository productRepository;

                public ProductController(ProductRepository productRepository) {
                    this.productRepository = productRepository;
                }

                @Get
                public Flux<Product> listProducts() {
                    return productRepository.findAll();
                }

                @Get("/category/{category}")
                public Flux<Product> getByCategory(String category) {
                    return productRepository.findByCategory(category);
                }

                @Post
                public Mono<Product> createProduct(@Body Product product) {
                    return productRepository.save(product);
                }
            }
            ---

6.2 消息驱动

01.消息驱动架构
    a.核心概念
        消息驱动架构通过异步消息传递实现服务间解耦,提升系统的可扩展性和容错能力。Micronaut提供统一的消息抽象层,支持多种消息中间件,包括Kafka、RabbitMQ、NATS等,简化消息驱动应用的开发。
    b.主要优势
        a.异步解耦
            生产者和消费者通过消息队列解耦,无需直接依赖,提升系统灵活性和可维护性。
        b.削峰填谷
            消息队列缓冲突发流量,消费者按自身处理能力消费消息,避免系统过载。
        c.可靠传递
            消息持久化和确认机制保证消息不丢失,支持事务和重试策略。

02.Kafka集成
    a.依赖配置
        a.功能说明
            Micronaut Kafka模块提供声明式的生产者和消费者注解,简化Kafka客户端的使用,支持响应式流处理。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.kafka:micronaut-kafka")
            }

            // application.yml
            kafka:
              bootstrap:
                servers: localhost:9092
              producers:
                default:
                  key-serializer: org.apache.kafka.common.serialization.StringSerializer
                  value-serializer: org.apache.kafka.common.serialization.StringSerializer
              consumers:
                default:
                  key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
                  value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
                  group-id: micronaut-group
                  auto-offset-reset: earliest
            ---
    b.消息生产者
        a.同步生产者
            a.功能说明
                使用@KafkaClient注解定义生产者接口,Micronaut自动生成实现类,支持同步和异步发送消息。
            b.代码示例
                ---
                import io.micronaut.configuration.kafka.annotation.KafkaClient;
                import io.micronaut.configuration.kafka.annotation.KafkaKey;
                import io.micronaut.configuration.kafka.annotation.Topic;

                @KafkaClient
                public interface OrderProducer {

                    // 发送消息到指定主题
                    @Topic("orders")
                    void sendOrder(@KafkaKey String orderId, Order order);

                    // 发送带分区键的消息
                    @Topic("orders")
                    void sendOrderWithKey(@KafkaKey String key, Order order);
                }

                // 使用示例
                @Controller("/orders")
                public class OrderController {

                    private final OrderProducer orderProducer;

                    public OrderController(OrderProducer orderProducer) {
                        this.orderProducer = orderProducer;
                    }

                    @Post
                    public HttpResponse<String> createOrder(@Body Order order) {
                        String orderId = UUID.randomUUID().toString();
                        order.setId(orderId);
                        orderProducer.sendOrder(orderId, order);
                        return HttpResponse.ok("Order created: " + orderId);
                    }
                }
                ---
        b.响应式生产者
            a.功能说明
                生产者方法可以返回响应式类型,实现完全非阻塞的消息发送,适用于高吞吐量场景。
            b.代码示例
                ---
                import reactor.core.publisher.Mono;
                import org.apache.kafka.clients.producer.RecordMetadata;

                @KafkaClient
                public interface ReactiveOrderProducer {

                    // 返回Mono,异步发送
                    @Topic("orders")
                    Mono<RecordMetadata> sendOrder(@KafkaKey String orderId, Order order);

                    // 批量发送
                    @Topic("orders")
                    Flux<RecordMetadata> sendOrders(Flux<Order> orders);
                }

                // 使用示例
                @Controller("/reactive-orders")
                public class ReactiveOrderController {

                    private final ReactiveOrderProducer orderProducer;

                    public ReactiveOrderController(ReactiveOrderProducer orderProducer) {
                        this.orderProducer = orderProducer;
                    }

                    @Post
                    public Mono<HttpResponse<String>> createOrder(@Body Order order) {
                        String orderId = UUID.randomUUID().toString();
                        order.setId(orderId);

                        return orderProducer.sendOrder(orderId, order)
                            .map(metadata -> HttpResponse.ok(
                                "Order sent to partition " + metadata.partition() +
                                " at offset " + metadata.offset()
                            ))
                            .onErrorResume(e -> Mono.just(
                                HttpResponse.serverError("Failed to send order: " + e.getMessage())
                            ));
                    }

                    @Post("/batch")
                    public Mono<HttpResponse<String>> createOrders(@Body List<Order> orders) {
                        return orderProducer.sendOrders(Flux.fromIterable(orders))
                            .collectList()
                            .map(results -> HttpResponse.ok(
                                "Sent " + results.size() + " orders"
                            ));
                    }
                }
                ---
    c.消息消费者
        a.基础消费者
            a.功能说明
                使用@KafkaListener注解定义消费者,自动订阅主题并处理消息,支持多种消息确认模式。
            b.代码示例
                ---
                import io.micronaut.configuration.kafka.annotation.KafkaListener;
                import io.micronaut.configuration.kafka.annotation.OffsetReset;
                import io.micronaut.configuration.kafka.annotation.Topic;
                import io.micronaut.messaging.annotation.MessageBody;
                import io.micronaut.messaging.annotation.MessageHeader;
                import org.slf4j.Logger;
                import org.slf4j.LoggerFactory;

                @KafkaListener(
                    groupId = "order-processor",
                    offsetReset = OffsetReset.EARLIEST
                )
                public class OrderConsumer {

                    private static final Logger LOG = LoggerFactory.getLogger(OrderConsumer.class);

                    // 消费单条消息
                    @Topic("orders")
                    public void processOrder(@MessageBody Order order,
                                            @MessageHeader("kafka_key") String key,
                                            @MessageHeader("kafka_offset") long offset) {
                        LOG.info("Processing order {} at offset {}", order.getId(), offset);
                        // 处理订单逻辑
                        processOrderLogic(order);
                    }

                    private void processOrderLogic(Order order) {
                        // 业务处理
                        LOG.info("Order processed: {}", order);
                    }
                }
                ---
        b.批量消费者
            a.功能说明
                消费者可以批量接收消息,提高处理效率,适用于批处理场景。
            b.代码示例
                ---
                import io.micronaut.configuration.kafka.annotation.KafkaListener;
                import io.micronaut.configuration.kafka.annotation.Topic;
                import java.util.List;

                @KafkaListener(
                    groupId = "batch-processor",
                    batch = true
                )
                public class BatchOrderConsumer {

                    private static final Logger LOG = LoggerFactory.getLogger(BatchOrderConsumer.class);

                    // 批量消费消息
                    @Topic("orders")
                    public void processBatch(List<Order> orders) {
                        LOG.info("Processing batch of {} orders", orders.size());

                        orders.forEach(order -> {
                            // 批量处理逻辑
                            LOG.info("Processing order: {}", order.getId());
                        });

                        LOG.info("Batch processing completed");
                    }
                }
                ---
        c.响应式消费者
            a.功能说明
                消费者方法可以返回响应式类型,实现背压控制和流式处理。
            b.代码示例
                ---
                import reactor.core.publisher.Mono;

                @KafkaListener(groupId = "reactive-processor")
                public class ReactiveOrderConsumer {

                    private static final Logger LOG = LoggerFactory.getLogger(ReactiveOrderConsumer.class);

                    @Topic("orders")
                    public Mono<Void> processOrder(@MessageBody Order order) {
                        return Mono.fromRunnable(() -> {
                            LOG.info("Reactive processing order: {}", order.getId());
                        })
                        .then(saveToDatabase(order))
                        .then(sendNotification(order))
                        .doOnError(e -> LOG.error("Error processing order", e))
                        .onErrorResume(e -> Mono.empty());
                    }

                    private Mono<Void> saveToDatabase(Order order) {
                        return Mono.fromRunnable(() -> {
                            // 保存到数据库
                            LOG.info("Saved order to database: {}", order.getId());
                        });
                    }

                    private Mono<Void> sendNotification(Order order) {
                        return Mono.fromRunnable(() -> {
                            // 发送通知
                            LOG.info("Notification sent for order: {}", order.getId());
                        });
                    }
                }
                ---

03.RabbitMQ集成
    a.依赖配置
        a.功能说明
            Micronaut RabbitMQ模块提供AMQP协议支持,实现可靠的消息传递和灵活的路由机制。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.rabbitmq:micronaut-rabbitmq")
            }

            // application.yml
            rabbitmq:
              uri: amqp://guest:guest@localhost:5672
              exchanges:
                - name: orders-exchange
                  type: topic
              queues:
                - name: orders-queue
                  durable: true
              bindings:
                - exchange: orders-exchange
                  queue: orders-queue
                  routing-key: order.*
            ---
    b.消息生产者
        a.功能说明
            使用@RabbitClient注解定义生产者,支持交换机、路由键等AMQP特性。
        b.代码示例
            ---
            import io.micronaut.rabbitmq.annotation.RabbitClient;
            import io.micronaut.rabbitmq.annotation.RabbitProperty;

            @RabbitClient("orders-exchange")
            public interface RabbitOrderProducer {

                // 发送到指定路由键
                void send(@RabbitProperty("routingKey") String routingKey, Order order);

                // 发送带优先级的消息
                void sendWithPriority(
                    @RabbitProperty("routingKey") String routingKey,
                    @RabbitProperty("priority") int priority,
                    Order order
                );
            }

            // 使用示例
            @Controller("/rabbit-orders")
            public class RabbitOrderController {

                private final RabbitOrderProducer producer;

                public RabbitOrderController(RabbitOrderProducer producer) {
                    this.producer = producer;
                }

                @Post
                public HttpResponse<String> createOrder(@Body Order order) {
                    producer.send("order.created", order);
                    return HttpResponse.ok("Order sent to RabbitMQ");
                }

                @Post("/urgent")
                public HttpResponse<String> createUrgentOrder(@Body Order order) {
                    producer.sendWithPriority("order.urgent", 10, order);
                    return HttpResponse.ok("Urgent order sent");
                }
            }
            ---
    c.消息消费者
        a.功能说明
            使用@RabbitListener注解定义消费者,支持消息确认、拒绝、重新入队等操作。
        b.代码示例
            ---
            import io.micronaut.rabbitmq.annotation.Queue;
            import io.micronaut.rabbitmq.annotation.RabbitListener;
            import com.rabbitmq.client.Channel;
            import io.micronaut.messaging.Acknowledgement;

            @RabbitListener
            public class RabbitOrderConsumer {

                private static final Logger LOG = LoggerFactory.getLogger(RabbitOrderConsumer.class);

                // 自动确认模式
                @Queue("orders-queue")
                public void receive(Order order) {
                    LOG.info("Received order: {}", order.getId());
                    processOrder(order);
                }

                // 手动确认模式
                @Queue(value = "orders-queue", acknowledge = "MANUAL")
                public void receiveManual(Order order, Acknowledgement acknowledgement) {
                    try {
                        LOG.info("Processing order: {}", order.getId());
                        processOrder(order);
                        acknowledgement.ack();
                    } catch (Exception e) {
                        LOG.error("Error processing order", e);
                        acknowledgement.nack(true); // 重新入队
                    }
                }

                private void processOrder(Order order) {
                    // 业务处理逻辑
                    LOG.info("Order processed successfully: {}", order.getId());
                }
            }
            ---

04.NATS集成
    a.依赖配置
        a.功能说明
            NATS是轻量级高性能消息系统,Micronaut提供NATS集成,适用于微服务间的快速通信。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.nats:micronaut-nats")
            }

            // application.yml
            nats:
              addresses:
                - nats://localhost:4222
              max-reconnect: 5
            ---
    b.发布订阅模式
        a.功能说明
            NATS支持发布订阅模式,实现一对多的消息分发。
        b.代码示例
            ---
            import io.micronaut.nats.annotation.NatsClient;
            import io.micronaut.nats.annotation.Subject;

            // 生产者
            @NatsClient
            public interface EventPublisher {

                @Subject("events.user")
                void publishUserEvent(UserEvent event);

                @Subject("events.order")
                void publishOrderEvent(OrderEvent event);
            }

            // 消费者
            import io.micronaut.nats.annotation.NatsListener;

            @NatsListener
            public class EventSubscriber {

                private static final Logger LOG = LoggerFactory.getLogger(EventSubscriber.class);

                @Subject("events.user")
                public void onUserEvent(UserEvent event) {
                    LOG.info("Received user event: {}", event);
                }

                @Subject("events.order")
                public void onOrderEvent(OrderEvent event) {
                    LOG.info("Received order event: {}", event);
                }

                // 通配符订阅
                @Subject("events.*")
                public void onAnyEvent(String subject, byte[] data) {
                    LOG.info("Received event on subject: {}", subject);
                }
            }
            ---
    c.请求响应模式
        a.功能说明
            NATS支持请求响应模式,实现同步RPC调用。
        b.代码示例
            ---
            // 客户端
            @NatsClient
            public interface UserService {

                @Subject("user.get")
                User getUser(Long userId);

                @Subject("user.create")
                User createUser(User user);
            }

            // 服务端
            @NatsListener
            public class UserServiceImpl {

                private static final Logger LOG = LoggerFactory.getLogger(UserServiceImpl.class);

                @Subject("user.get")
                public User getUser(Long userId) {
                    LOG.info("Getting user: {}", userId);
                    return new User(userId, "User" + userId, "user@example.com");
                }

                @Subject("user.create")
                public User createUser(User user) {
                    LOG.info("Creating user: {}", user.getName());
                    user.setId(System.currentTimeMillis());
                    return user;
                }
            }

            // 使用示例
            @Controller("/nats-users")
            public class NatsUserController {

                private final UserService userService;

                public NatsUserController(UserService userService) {
                    this.userService = userService;
                }

                @Get("/{id}")
                public User getUser(Long id) {
                    return userService.getUser(id);
                }

                @Post
                public User createUser(@Body User user) {
                    return userService.createUser(user);
                }
            }
            ---

05.消息序列化
    a.JSON序列化
        a.功能说明
            Micronaut默认使用Jackson进行JSON序列化,支持自定义序列化配置。
        b.配置示例
            ---
            // application.yml
            jackson:
              serialization:
                indent-output: true
              deserialization:
                fail-on-unknown-properties: false

            // 自定义序列化器
            import com.fasterxml.jackson.databind.ObjectMapper;
            import com.fasterxml.jackson.databind.SerializationFeature;
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.context.annotation.Replaces;
            import jakarta.inject.Singleton;

            @Factory
            public class JacksonConfiguration {

                @Singleton
                @Replaces(ObjectMapper.class)
                public ObjectMapper objectMapper() {
                    ObjectMapper mapper = new ObjectMapper();
                    mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
                    mapper.findAndRegisterModules();
                    return mapper;
                }
            }
            ---
    b.自定义序列化器
        a.功能说明
            可以为Kafka、RabbitMQ等消息系统配置自定义序列化器,支持Avro、Protobuf等格式。
        b.代码示例
            ---
            // Kafka自定义序列化器
            import org.apache.kafka.common.serialization.Serializer;
            import org.apache.kafka.common.serialization.Deserializer;

            public class OrderSerializer implements Serializer<Order> {

                private final ObjectMapper objectMapper = new ObjectMapper();

                @Override
                public byte[] serialize(String topic, Order order) {
                    try {
                        return objectMapper.writeValueAsBytes(order);
                    } catch (Exception e) {
                        throw new RuntimeException("Failed to serialize order", e);
                    }
                }
            }

            public class OrderDeserializer implements Deserializer<Order> {

                private final ObjectMapper objectMapper = new ObjectMapper();

                @Override
                public Order deserialize(String topic, byte[] data) {
                    try {
                        return objectMapper.readValue(data, Order.class);
                    } catch (Exception e) {
                        throw new RuntimeException("Failed to deserialize order", e);
                    }
                }
            }

            // 配置使用
            // application.yml
            kafka:
              producers:
                default:
                  value-serializer: com.example.OrderSerializer
              consumers:
                default:
                  value-deserializer: com.example.OrderDeserializer
            ---

6.3 分布式追踪

01.分布式追踪概述
    a.核心概念
        分布式追踪通过记录请求在微服务系统中的完整调用链路,帮助开发者理解系统行为、定位性能瓶颈和排查故障。Micronaut集成OpenTelemetry和Zipkin等主流追踪系统,提供自动化的链路追踪能力,无需侵入业务代码。
    b.主要优势
        a.全链路可视化
            追踪系统记录请求从入口到出口的完整路径,包括服务调用关系、耗时分布和错误信息,提供直观的调用链视图。
        b.性能分析
            通过分析每个服务节点的响应时间,快速识别性能瓶颈,优化关键路径,提升系统整体性能。
        c.故障定位
            当系统出现异常时,追踪数据帮助快速定位问题发生的具体服务和调用环节,缩短故障排查时间。

02.OpenTelemetry集成
    a.依赖配置
        a.功能说明
            OpenTelemetry是云原生计算基金会的可观测性标准,Micronaut提供原生支持,自动采集追踪、指标和日志数据。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.tracing:micronaut-tracing-opentelemetry")
                implementation("io.opentelemetry:opentelemetry-exporter-zipkin")
            }

            // application.yml
            tracing:
              enabled: true
              zipkin:
                enabled: true
                url: http://localhost:9411
                sampler:
                  probability: 0.1
            otel:
              service:
                name: order-service
              traces:
                exporter: zipkin
            ---
    b.自动追踪
        a.HTTP请求追踪
            a.功能说明
                Micronaut自动为所有HTTP请求创建追踪Span,记录请求方法、路径、状态码和响应时间,无需手动埋点。
            b.代码示例
                ---
                import io.micronaut.http.annotation.Controller;
                import io.micronaut.http.annotation.Get;
                import io.micronaut.http.client.HttpClient;
                import io.micronaut.http.client.annotation.Client;
                import jakarta.inject.Inject;

                @Controller("/orders")
                public class OrderController {

                    @Inject
                    @Client("http://inventory-service")
                    private HttpClient inventoryClient;

                    // 自动追踪HTTP请求
                    @Get("/{id}")
                    public Order getOrder(Long id) {
                        // 调用下游服务,自动传播追踪上下文
                        String inventory = inventoryClient.toBlocking()
                            .retrieve("/inventory/" + id);

                        return new Order(id, "Order-" + id, inventory);
                    }
                }
                ---
        b.数据库操作追踪
            a.功能说明
                集成JDBC和R2DBC驱动,自动追踪数据库查询操作,记录SQL语句、执行时间和影响行数。
            b.代码示例
                ---
                import io.micronaut.data.annotation.Repository;
                import io.micronaut.data.jdbc.annotation.JdbcRepository;
                import io.micronaut.data.model.query.builder.sql.Dialect;
                import io.micronaut.data.repository.CrudRepository;

                @JdbcRepository(dialect = Dialect.MYSQL)
                public interface OrderRepository extends CrudRepository<Order, Long> {

                    // 数据库查询自动追踪
                    List<Order> findByStatus(String status);

                    // 复杂查询也会自动追踪
                    @Query("SELECT * FROM orders WHERE user_id = :userId AND status = :status")
                    List<Order> findUserOrders(Long userId, String status);
                }

                // 使用示例
                @Controller("/orders")
                public class OrderController {

                    private final OrderRepository orderRepository;

                    public OrderController(OrderRepository orderRepository) {
                        this.orderRepository = orderRepository;
                    }

                    @Get("/pending")
                    public List<Order> getPendingOrders() {
                        // 数据库操作自动记录到追踪链路
                        return orderRepository.findByStatus("PENDING");
                    }
                }
                ---
    c.自定义追踪
        a.手动创建Span
            a.功能说明
                在关键业务逻辑中手动创建Span,记录自定义操作的执行时间和上下文信息。
            b.代码示例
                ---
                import io.opentelemetry.api.trace.Span;
                import io.opentelemetry.api.trace.Tracer;
                import io.opentelemetry.context.Scope;
                import jakarta.inject.Inject;
                import jakarta.inject.Singleton;

                @Singleton
                public class OrderService {

                    @Inject
                    private Tracer tracer;

                    public Order processOrder(Order order) {
                        // 创建自定义Span
                        Span span = tracer.spanBuilder("processOrder")
                            .setAttribute("order.id", order.getId())
                            .setAttribute("order.amount", order.getAmount())
                            .startSpan();

                        try (Scope scope = span.makeCurrent()) {
                            // 业务逻辑
                            validateOrder(order);
                            calculateTotal(order);
                            saveOrder(order);

                            span.addEvent("Order processed successfully");
                            return order;
                        } catch (Exception e) {
                            span.recordException(e);
                            span.setAttribute("error", true);
                            throw e;
                        } finally {
                            span.end();
                        }
                    }

                    private void validateOrder(Order order) {
                        Span span = tracer.spanBuilder("validateOrder").startSpan();
                        try (Scope scope = span.makeCurrent()) {
                            // 验证逻辑
                            if (order.getAmount() <= 0) {
                                throw new IllegalArgumentException("Invalid amount");
                            }
                        } finally {
                            span.end();
                        }
                    }

                    private void calculateTotal(Order order) {
                        // 计算逻辑
                    }

                    private void saveOrder(Order order) {
                        // 保存逻辑
                    }
                }
                ---
        b.添加标签和事件
            a.功能说明
                为Span添加自定义标签和事件,记录业务相关的元数据和关键操作节点。
            b.代码示例
                ---
                import io.opentelemetry.api.trace.Span;
                import io.opentelemetry.api.common.Attributes;
                import io.opentelemetry.api.common.AttributeKey;

                @Singleton
                public class PaymentService {

                    @Inject
                    private Tracer tracer;

                    public PaymentResult processPayment(Payment payment) {
                        Span span = Span.current();

                        // 添加业务标签
                        span.setAttribute("payment.method", payment.getMethod());
                        span.setAttribute("payment.amount", payment.getAmount());
                        span.setAttribute("user.id", payment.getUserId());

                        // 记录关键事件
                        span.addEvent("Payment validation started");

                        if (validatePayment(payment)) {
                            span.addEvent("Payment validated",
                                Attributes.of(
                                    AttributeKey.stringKey("validation.result"), "success"
                                ));

                            // 调用支付网关
                            span.addEvent("Calling payment gateway");
                            PaymentResult result = callPaymentGateway(payment);

                            span.setAttribute("payment.status", result.getStatus());
                            span.addEvent("Payment completed");

                            return result;
                        } else {
                            span.addEvent("Payment validation failed");
                            span.setAttribute("error", true);
                            throw new PaymentException("Validation failed");
                        }
                    }

                    private boolean validatePayment(Payment payment) {
                        return payment.getAmount() > 0 && payment.getMethod() != null;
                    }

                    private PaymentResult callPaymentGateway(Payment payment) {
                        return new PaymentResult("SUCCESS", payment.getAmount());
                    }
                }
                ---

03.Zipkin集成
    a.依赖配置
        a.功能说明
            Zipkin是广泛使用的分布式追踪系统,Micronaut提供开箱即用的集成支持。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.tracing:micronaut-tracing-zipkin")
            }

            // application.yml
            tracing:
              zipkin:
                enabled: true
                url: http://localhost:9411
                sampler:
                  probability: 1.0
                http:
                  path: /api/v2/spans
            ---
    b.追踪上报
        a.HTTP上报
            a.功能说明
                配置Zipkin服务端地址后,Micronaut自动通过HTTP POST请求上报追踪数据。
            b.配置示例
                ---
                // application.yml
                tracing:
                  zipkin:
                    enabled: true
                    url: http://zipkin-server:9411
                    http:
                      path: /api/v2/spans
                      connect-timeout: 1s
                      read-timeout: 10s
                    sampler:
                      probability: 0.1
                micronaut:
                  application:
                    name: order-service
                ---
        b.消息队列上报
            a.功能说明
                支持通过Kafka上报追踪数据,避免直接依赖Zipkin服务。
            b.配置示例
                ---
                // build.gradle
                dependencies {
                    implementation("io.micronaut.tracing:micronaut-tracing-zipkin")
                    implementation("io.micronaut.kafka:micronaut-kafka")
                }

                // application.yml
                tracing:
                  zipkin:
                    enabled: true
                    kafka:
                      enabled: true
                      topic: zipkin
                kafka:
                  bootstrap:
                    servers: localhost:9092
                ---

04.追踪最佳实践
    a.采样策略
        a.功能说明
            合理配置采样率,平衡追踪覆盖率和系统性能开销。
        b.配置示例
            ---
            // application.yml
            tracing:
              zipkin:
                sampler:
                  # 固定概率采样:10%的请求
                  probability: 0.1

            # 自定义采样器
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.tracing.brave.sampler.TraceSampler;
            import brave.sampler.Sampler;
            import jakarta.inject.Singleton;

            @Factory
            public class SamplerConfiguration {

                @Singleton
                public Sampler customSampler() {
                    // 速率限制采样:每秒最多100个追踪
                    return Sampler.create(0.1f);
                }
            }
            ---
    b.敏感信息处理
        a.功能说明
            追踪数据中避免记录敏感信息,或在上报前进行脱敏处理。
        b.代码示例
            ---
            import io.micronaut.tracing.annotation.NewSpan;
            import io.micronaut.tracing.annotation.SpanTag;

            @Singleton
            public class UserService {

                // 使用@NewSpan创建追踪
                @NewSpan("getUserInfo")
                public User getUserInfo(
                    @SpanTag("user.id") Long userId,
                    String password  // 不添加@SpanTag,避免记录密码
                ) {
                    // 业务逻辑
                    return userRepository.findById(userId);
                }

                // 脱敏处理
                @NewSpan("processPayment")
                public void processPayment(
                    @SpanTag("card.last4") String cardLast4,  // 只记录后4位
                    String fullCardNumber  // 完整卡号不记录
                ) {
                    // 支付处理
                }
            }
            ---
    c.性能优化
        a.异步上报
            a.功能说明
                追踪数据采用异步方式上报,避免阻塞业务请求。
            b.配置示例
                ---
                // application.yml
                tracing:
                  zipkin:
                    enabled: true
                    url: http://localhost:9411
                    http:
                      # 异步发送配置
                      message-timeout: 1s
                      close-timeout: 1s
                      # 批量发送
                      max-requests: 64
                      queue-size: 1000
                ---
        b.本地缓存
            a.功能说明
                当追踪系统不可用时,追踪数据暂存本地,避免数据丢失。
            b.配置示例
                ---
                // application.yml
                tracing:
                  zipkin:
                    enabled: true
                    url: http://localhost:9411
                    http:
                      # 连接失败时的重试策略
                      connect-timeout: 1s
                      read-timeout: 10s
                    # 本地队列配置
                    sender:
                      type: http
                      queue-size: 10000
                ---

6.4 服务发现

01.服务发现概述
    a.核心概念
        服务发现是微服务架构的关键组件,负责动态管理服务实例的注册和查询。Micronaut支持多种服务发现机制,包括Consul、Eureka、Kubernetes等,提供自动注册、健康检查和负载均衡能力,简化微服务间的通信。
    b.主要优势
        a.动态服务管理
            服务实例启动时自动注册到注册中心,停止时自动注销,客户端无需维护静态服务列表,支持服务的弹性伸缩。
        b.健康检查
            注册中心定期检查服务实例的健康状态,自动剔除不健康的实例,确保客户端只调用可用的服务。
        c.负载均衡
            客户端从注册中心获取多个服务实例,通过负载均衡算法分发请求,提升系统的可用性和性能。

02.Consul集成
    a.依赖配置
        a.功能说明
            Consul是HashiCorp开发的服务网格解决方案,提供服务发现、健康检查、KV存储等功能,Micronaut提供原生支持。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.discovery:micronaut-discovery-client")
            }

            // application.yml
            consul:
              client:
                registration:
                  enabled: true
                defaultZone: "${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}"
            micronaut:
              application:
                name: order-service
            ---
    b.服务注册
        a.自动注册
            a.功能说明
                Micronaut应用启动时自动向Consul注册服务实例,包括服务名称、IP地址、端口和元数据。
            b.配置示例
                ---
                // application.yml
                consul:
                  client:
                    registration:
                      enabled: true
                      # 服务注册配置
                      prefer-ip-address: true
                      ip-address: ${HOSTNAME:localhost}
                      port: ${SERVER_PORT:8080}
                      # 健康检查配置
                      check:
                        enabled: true
                        interval: 10s
                        http: true
                        path: /health
                      # 服务标签
                      tags:
                        - version=1.0
                        - environment=production
                    defaultZone: localhost:8500
                micronaut:
                  application:
                    name: order-service
                ---
        b.手动注册
            a.功能说明
                通过编程方式手动控制服务注册和注销,适用于特殊场景。
            b.代码示例
                ---
                import io.micronaut.discovery.ServiceInstance;
                import io.micronaut.discovery.consul.ConsulClient;
                import io.micronaut.discovery.consul.client.v1.CatalogEntry;
                import io.micronaut.discovery.consul.client.v1.NewServiceEntry;
                import jakarta.inject.Inject;
                import jakarta.inject.Singleton;

                @Singleton
                public class ServiceRegistration {

                    @Inject
                    private ConsulClient consulClient;

                    public void registerService() {
                        NewServiceEntry entry = new NewServiceEntry(
                            "order-service",
                            "order-service-1",
                            "localhost",
                            8080
                        );
                        entry.setTags(Arrays.asList("version=1.0", "region=us-east"));

                        // 配置健康检查
                        NewServiceEntry.Check check = new NewServiceEntry.Check();
                        check.setHttp("http://localhost:8080/health");
                        check.setInterval("10s");
                        entry.setCheck(check);

                        consulClient.register(entry);
                    }

                    public void deregisterService(String serviceId) {
                        consulClient.deregister(serviceId);
                    }
                }
                ---
    c.服务发现
        a.声明式客户端
            a.功能说明
                使用@Client注解声明式调用远程服务,Micronaut自动从Consul查询服务实例并进行负载均衡。
            b.代码示例
                ---
                import io.micronaut.http.annotation.Get;
                import io.micronaut.http.client.annotation.Client;

                // 通过服务名称调用
                @Client("inventory-service")
                public interface InventoryClient {

                    @Get("/inventory/{productId}")
                    Inventory getInventory(Long productId);

                    @Get("/inventory/check/{productId}")
                    boolean checkStock(Long productId);
                }

                // 使用示例
                @Controller("/orders")
                public class OrderController {

                    private final InventoryClient inventoryClient;

                    public OrderController(InventoryClient inventoryClient) {
                        this.inventoryClient = inventoryClient;
                    }

                    @Post
                    public HttpResponse<Order> createOrder(@Body Order order) {
                        // 自动服务发现和负载均衡
                        boolean inStock = inventoryClient.checkStock(order.getProductId());

                        if (inStock) {
                            Inventory inventory = inventoryClient.getInventory(order.getProductId());
                            order.setInventoryInfo(inventory);
                            return HttpResponse.ok(order);
                        } else {
                            return HttpResponse.badRequest();
                        }
                    }
                }
                ---
        b.编程式发现
            a.功能说明
                通过DiscoveryClient API编程式查询服务实例,获取更多控制权。
            b.代码示例
                ---
                import io.micronaut.discovery.DiscoveryClient;
                import io.micronaut.discovery.ServiceInstance;
                import io.micronaut.http.client.HttpClient;
                import jakarta.inject.Inject;
                import jakarta.inject.Singleton;
                import reactor.core.publisher.Flux;

                @Singleton
                public class ServiceDiscoveryExample {

                    @Inject
                    private DiscoveryClient discoveryClient;

                    public void discoverServices() {
                        // 获取所有服务名称
                        Flux<String> serviceIds = Flux.from(discoveryClient.getServiceIds());
                        serviceIds.subscribe(serviceId -> {
                            System.out.println("Found service: " + serviceId);
                        });

                        // 获取特定服务的所有实例
                        Flux<ServiceInstance> instances = Flux.from(
                            discoveryClient.getInstances("order-service")
                        );

                        instances.subscribe(instance -> {
                            System.out.println("Service instance: " +
                                instance.getId() + " at " +
                                instance.getHost() + ":" +
                                instance.getPort());
                        });
                    }

                    public String callService(String serviceName, String path) {
                        // 获取服务实例
                        ServiceInstance instance = Flux.from(
                            discoveryClient.getInstances(serviceName)
                        ).blockFirst();

                        if (instance != null) {
                            String url = "http://" + instance.getHost() + ":" +
                                instance.getPort() + path;

                            HttpClient client = HttpClient.create(instance.getURI().toURL());
                            return client.toBlocking().retrieve(path);
                        }

                        throw new RuntimeException("Service not found: " + serviceName);
                    }
                }
                ---

03.Eureka集成
    a.依赖配置
        a.功能说明
            Eureka是Netflix开源的服务注册中心,广泛应用于Spring Cloud生态,Micronaut提供兼容支持。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.discovery:micronaut-discovery-client")
            }

            // application.yml
            eureka:
              client:
                registration:
                  enabled: true
                defaultZone: "${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka"
            micronaut:
              application:
                name: payment-service
            ---
    b.服务注册配置
        a.功能说明
            配置Eureka客户端的注册参数,包括实例ID、租约续期时间等。
        b.配置示例
            ---
            // application.yml
            eureka:
              client:
                registration:
                  enabled: true
                  prefer-ip-address: true
                  # 实例配置
                  instance-id: ${micronaut.application.name}:${random.value}
                  lease-renewal-interval: 30s
                  lease-expiration-duration: 90s
                  # 元数据
                  metadata:
                    version: 1.0.0
                    region: us-west
                defaultZone: http://localhost:8761/eureka
              instance:
                hostname: ${HOSTNAME:localhost}
                port: ${SERVER_PORT:8080}
            ---
    c.服务调用
        a.功能说明
            通过服务名称调用Eureka注册的服务,支持客户端负载均衡。
        b.代码示例
            ---
            import io.micronaut.http.annotation.Get;
            import io.micronaut.http.annotation.Post;
            import io.micronaut.http.client.annotation.Client;

            @Client("payment-service")
            public interface PaymentClient {

                @Post("/payments")
                PaymentResult processPayment(@Body Payment payment);

                @Get("/payments/{id}")
                Payment getPayment(Long id);
            }

            // 使用示例
            @Controller("/checkout")
            public class CheckoutController {

                private final PaymentClient paymentClient;

                public CheckoutController(PaymentClient paymentClient) {
                    this.paymentClient = paymentClient;
                }

                @Post
                public HttpResponse<CheckoutResult> checkout(@Body CheckoutRequest request) {
                    Payment payment = new Payment(
                        request.getAmount(),
                        request.getPaymentMethod()
                    );

                    // 调用支付服务
                    PaymentResult result = paymentClient.processPayment(payment);

                    if ("SUCCESS".equals(result.getStatus())) {
                        return HttpResponse.ok(new CheckoutResult(true, result.getTransactionId()));
                    } else {
                        return HttpResponse.badRequest(new CheckoutResult(false, null));
                    }
                }
            }
            ---

04.Kubernetes服务发现
    a.依赖配置
        a.功能说明
            在Kubernetes环境中,Micronaut可以直接使用Kubernetes API进行服务发现,无需额外的注册中心。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.kubernetes:micronaut-kubernetes-discovery-client")
            }

            // application.yml
            kubernetes:
              client:
                discovery:
                  enabled: true
                  mode: service
                  namespace: default
            micronaut:
              application:
                name: user-service
            ---
    b.服务发现配置
        a.���能说明
            配置Kubernetes服务发现的命名空间、标签选择器等参数。
        b.配置示例
            ---
            // application.yml
            kubernetes:
              client:
                discovery:
                  enabled: true
                  mode: service
                  namespace: production
                  # 标签选择器
                  labels:
                    app: microservices
                    tier: backend
                  # 包含的服务
                  includes:
                    - order-service
                    - inventory-service
                  # 排除的服务
                  excludes:
                    - legacy-service
            ---
    c.服务调用
        a.功能说明
            通过Kubernetes Service名称调用服务,Micronaut自动解析为Pod IP地址。
        b.代码示例
            ---
            import io.micronaut.http.annotation.Get;
            import io.micronaut.http.client.annotation.Client;

            // 使用Kubernetes Service名称
            @Client("http://user-service")
            public interface UserClient {

                @Get("/users/{id}")
                User getUser(Long id);

                @Get("/users/search")
                List<User> searchUsers(String query);
            }

            // 使用示例
            @Controller("/profile")
            public class ProfileController {

                private final UserClient userClient;

                public ProfileController(UserClient userClient) {
                    this.userClient = userClient;
                }

                @Get("/{userId}")
                public User getUserProfile(Long userId) {
                    // Kubernetes自动解析服务名称
                    return userClient.getUser(userId);
                }
            }
            ---

05.负载均衡策略
    a.内置策略
        a.轮询策略
            a.功能说明
                默认的负载均衡策略,按顺序轮流调用服务实例。
            b.配置示例
                ---
                // application.yml
                micronaut:
                  http:
                    client:
                      load-balancer:
                        # 轮询策略(默认)
                        strategy: round-robin
                ---
        b.随机策略
            a.功能说明
                随机选择服务实例,适用于实例性能相近的场景。
            b.配置示例
                ---
                // application.yml
                micronaut:
                  http:
                    client:
                      load-balancer:
                        strategy: random
                ---
    b.自定义策略
        a.功能说明
            实现LoadBalancer接口,自定义负载均衡算法,如加权轮询、最少连接等。
        b.代码示例
            ---
            import io.micronaut.context.annotation.Requires;
            import io.micronaut.discovery.ServiceInstance;
            import io.micronaut.http.client.loadbalance.DiscoveryClientLoadBalancer;
            import io.micronaut.http.client.loadbalance.ServiceInstanceList;
            import jakarta.inject.Singleton;
            import reactor.core.publisher.Flux;

            @Singleton
            @Requires(property = "micronaut.http.client.load-balancer.strategy", value = "weighted")
            public class WeightedLoadBalancer extends DiscoveryClientLoadBalancer {

                public WeightedLoadBalancer(ServiceInstanceList serviceInstanceList) {
                    super(serviceInstanceList);
                }

                @Override
                public Flux<ServiceInstance> select(Object discriminator) {
                    return Flux.from(serviceInstanceList.getInstances())
                        .collectList()
                        .flatMapMany(instances -> {
                            if (instances.isEmpty()) {
                                return Flux.empty();
                            }

                            // 根据权重选择实例
                            ServiceInstance selected = selectByWeight(instances);
                            return Flux.just(selected);
                        });
                }

                private ServiceInstance selectByWeight(List<ServiceInstance> instances) {
                    int totalWeight = instances.stream()
                        .mapToInt(i -> getWeight(i))
                        .sum();

                    int random = new Random().nextInt(totalWeight);
                    int currentWeight = 0;

                    for (ServiceInstance instance : instances) {
                        currentWeight += getWeight(instance);
                        if (random < currentWeight) {
                            return instance;
                        }
                    }

                    return instances.get(0);
                }

                private int getWeight(ServiceInstance instance) {
                    return instance.getMetadata()
                        .get("weight")
                        .map(Integer::parseInt)
                        .orElse(1);
                }
            }
            ---

6.5 配置中心集成

01.配置中心概述
    a.核心概念
        配置中心提供集中化的配置管理,支持配置的动态更新、版本控制和环境隔离。Micronaut支持多种配置中心,包括Consul、Spring Cloud Config、AWS Parameter Store等,实现配置与代码的分离,简化多环境部署和配置管理。
    b.主要优势
        a.集中管理
            所有服务的配置集中存储在配置中心,统一管理和维护,避免配置分散在各个服务中,降低管理复杂度。
        b.动态更新
            配置变更后无需重启服务即可生效,支持热更新,提升系统的灵活性和可维护性。
        c.环境隔离
            不同环境使用不同的配置,如开发、测试、生产环境,通过命名空间或标签实现配置隔离。

02.Consul配置中心
    a.依赖配置
        a.功能说明
            Consul的KV存储可以作为配置中心,Micronaut自动从Consul加载配置,支持配置的动态刷新。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.discovery:micronaut-discovery-client")
            }

            // bootstrap.yml
            micronaut:
              application:
                name: order-service
              config-client:
                enabled: true
            consul:
              client:
                config:
                  enabled: true
                  format: YAML
                  path: /config
                defaultZone: localhost:8500
            ---
    b.配置存储
        a.功能说明
            在Consul KV存储中按照约定的路径存储配置,Micronaut自动加载对应的配置。
        b.配置示例
            ---
            # Consul KV路径结构
            /config/application/data          # 所有应用共享配置
            /config/order-service/data        # order-service专属配置
            /config/order-service,prod/data   # order-service生产环境配置

            # 配置内容示例(YAML格式)
            # /config/order-service/data
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/orders
                username: root
                password: secret
                driver-class-name: com.mysql.cj.jdbc.Driver

            kafka:
              bootstrap:
                servers: localhost:9092

            # 使用配置
            import io.micronaut.context.annotation.Value;
            import jakarta.inject.Singleton;

            @Singleton
            public class DatabaseConfig {

                @Value("${datasources.default.url}")
                private String dbUrl;

                @Value("${datasources.default.username}")
                private String dbUsername;

                public void printConfig() {
                    System.out.println("Database URL: " + dbUrl);
                    System.out.println("Database User: " + dbUsername);
                }
            }
            ---
    c.动态刷新
        a.功能说明
            配置变更后,Micronaut自动检测并刷新配置,使用@Refreshable注解的Bean会重新创建。
        b.代码示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import io.micronaut.runtime.context.scope.Refreshable;

            @Refreshable
            @ConfigurationProperties("app")
            public class AppConfig {

                private String name;
                private int maxConnections;
                private boolean debugMode;

                // Getters and Setters
                public String getName() {
                    return name;
                }

                public void setName(String name) {
                    this.name = name;
                }

                public int getMaxConnections() {
                    return maxConnections;
                }

                public void setMaxConnections(int maxConnections) {
                    this.maxConnections = maxConnections;
                }

                public boolean isDebugMode() {
                    return debugMode;
                }

                public void setDebugMode(boolean debugMode) {
                    this.debugMode = debugMode;
                }
            }

            // 使用配置
            @Controller("/config")
            public class ConfigController {

                private final AppConfig appConfig;

                public ConfigController(AppConfig appConfig) {
                    this.appConfig = appConfig;
                }

                @Get("/current")
                public Map<String, Object> getCurrentConfig() {
                    return Map.of(
                        "name", appConfig.getName(),
                        "maxConnections", appConfig.getMaxConnections(),
                        "debugMode", appConfig.isDebugMode()
                    );
                }
            }
            ---

03.Spring Cloud Config集成
    a.依赖配置
        a.功能说明
            Spring Cloud Config是广泛使用的配置中心,Micronaut提供兼容支持,可以复用现有的Config Server。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.spring:micronaut-spring-cloud-config-client")
            }

            // bootstrap.yml
            micronaut:
              application:
                name: payment-service
              config-client:
                enabled: true
            spring:
              cloud:
                config:
                  enabled: true
                  uri: http://localhost:8888
                  # 配置文件名称
                  name: ${micronaut.application.name}
                  # 环境
                  profile: production
                  # 分支
                  label: master
                  # 失败快速启动
                  fail-fast: true
                  # 重试配置
                  retry:
                    max-attempts: 6
                    initial-interval: 1000
            ---
    b.配置文件
        a.功能说明
            在Config Server的Git仓库中存储配置文件,按照应用名称和环境组织。
        b.配置示例
            ---
            # Git仓库结构
            config-repo/
              ├── application.yml              # 所有应用共享
              ├── payment-service.yml          # payment-service默认配置
              ├── payment-service-dev.yml      # 开发环境
              ├── payment-service-prod.yml     # 生产环境

            # payment-service-prod.yml
            server:
              port: 8080

            datasources:
              default:
                url: jdbc:postgresql://prod-db:5432/payments
                username: ${DB_USER}
                password: ${DB_PASSWORD}

            security:
              jwt:
                secret: ${JWT_SECRET}
                expiration: 3600

            # 使用配置
            import io.micronaut.context.annotation.ConfigurationProperties;

            @ConfigurationProperties("security.jwt")
            public class JwtConfig {

                private String secret;
                private int expiration;

                public String getSecret() {
                    return secret;
                }

                public void setSecret(String secret) {
                    this.secret = secret;
                }

                public int getExpiration() {
                    return expiration;
                }

                public void setExpiration(int expiration) {
                    this.expiration = expiration;
                }
            }
            ---
    c.配置刷新
        a.功能说明
            通过RefreshEvent触发配置刷新,或使用/refresh端点手动刷新。
        b.代码示例
            ---
            import io.micronaut.context.event.ApplicationEventPublisher;
            import io.micronaut.runtime.context.scope.refresh.RefreshEvent;
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.annotation.Post;
            import jakarta.inject.Inject;

            @Controller("/admin")
            public class AdminController {

                @Inject
                private ApplicationEventPublisher<RefreshEvent> eventPublisher;

                // 手动触发配置刷新
                @Post("/refresh")
                public String refreshConfig() {
                    eventPublisher.publishEvent(new RefreshEvent());
                    return "Configuration refreshed";
                }
            }

            // 监听配置刷新事件
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.runtime.context.scope.refresh.RefreshEvent;
            import jakarta.inject.Singleton;

            @Singleton
            public class ConfigRefreshListener implements ApplicationEventListener<RefreshEvent> {

                @Override
                public void onApplicationEvent(RefreshEvent event) {
                    System.out.println("Configuration refreshed at: " + System.currentTimeMillis());
                    // 执行刷新后的逻辑
                }
            }
            ---

04.AWS Parameter Store集成
    a.依赖配置
        a.功能说明
            AWS Systems Manager Parameter Store提供安全的配置和密钥管理,Micronaut支持从Parameter Store加载配置。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.aws:micronaut-aws-parameter-store")
            }

            // bootstrap.yml
            micronaut:
              application:
                name: user-service
              config-client:
                enabled: true
            aws:
              client:
                system-manager:
                  parameterstore:
                    enabled: true
                    # 参数路径前缀
                    path: /config/user-service
                    # 是否使用安全字符串
                    use-secure-strings: true
              region: us-east-1
            ---
    b.参数存储
        a.功能说明
            在AWS Parameter Store中按照层级路径存储参数,支持普通字符串和加密字符串。
        b.配置示例
            ---
            # AWS Parameter Store参数结构
            /config/user-service/database/url
            /config/user-service/database/username
            /config/user-service/database/password  # SecureString类型

            # 使用AWS CLI创建参数
            aws ssm put-parameter \
              --name "/config/user-service/database/url" \
              --value "jdbc:mysql://prod-db:3306/users" \
              --type "String"

            aws ssm put-parameter \
              --name "/config/user-service/database/password" \
              --value "secret-password" \
              --type "SecureString"

            # 在代码中使用
            import io.micronaut.context.annotation.Value;
            import jakarta.inject.Singleton;

            @Singleton
            public class DatabaseService {

                @Value("${database.url}")
                private String dbUrl;

                @Value("${database.username}")
                private String dbUsername;

                @Value("${database.password}")
                private String dbPassword;

                public void connect() {
                    System.out.println("Connecting to: " + dbUrl);
                    // 使用加密的密码连接数据库
                }
            }
            ---
    c.动态配置
        a.功能说明
            Parameter Store支持配置的版本管理和动态更新,Micronaut可以定期轮询获取最新配置。
        b.配置示例
            ---
            // bootstrap.yml
            aws:
              client:
                system-manager:
                  parameterstore:
                    enabled: true
                    path: /config/user-service
                    # 启用自动刷新
                    watch: true
                    # 刷新间隔
                    watch-delay: 60s

            # 使用@Refreshable注解
            import io.micronaut.runtime.context.scope.Refreshable;
            import io.micronaut.context.annotation.ConfigurationProperties;

            @Refreshable
            @ConfigurationProperties("feature")
            public class FeatureConfig {

                private boolean newFeatureEnabled;
                private int maxRetries;

                public boolean isNewFeatureEnabled() {
                    return newFeatureEnabled;
                }

                public void setNewFeatureEnabled(boolean newFeatureEnabled) {
                    this.newFeatureEnabled = newFeatureEnabled;
                }

                public int getMaxRetries() {
                    return maxRetries;
                }

                public void setMaxRetries(int maxRetries) {
                    this.maxRetries = maxRetries;
                }
            }
            ---

05.配置最佳实践
    a.敏感信息管理
        a.功能说明
            敏感信息如密码、密钥应使用加密存储,避免明文配置。
        b.代码示例
            ---
            # 使用环境变量
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/db
                username: ${DB_USER}
                password: ${DB_PASSWORD}

            # 使用Consul加密
            # 在Consul中存储加密后的值
            consul kv put /config/order-service/db-password "encrypted:AES:base64value"

            # 使用AWS Secrets Manager
            // build.gradle
            dependencies {
                implementation("io.micronaut.aws:micronaut-aws-secretsmanager")
            }

            // bootstrap.yml
            aws:
              client:
                secrets-manager:
                  enabled: true
              region: us-east-1

            # 在代码中使用
            import io.micronaut.context.annotation.Value;

            @Singleton
            public class SecretService {

                @Value("${/secret/database/password}")
                private String dbPassword;

                public void useSecret() {
                    // 自动从Secrets Manager获取密钥
                    System.out.println("Using secret: " + dbPassword);
                }
            }
            ---
    b.配置优先级
        a.功能说明
            Micronaut支持多种配置源,按照优先级合并配置,高优先级覆盖低优先级。
        b.配置示例
            ---
            # 配置优先级(从高到低)
            # 1. 命令行参数
            java -jar app.jar --server.port=9090

            # 2. 系统属性
            java -Dserver.port=9090 -jar app.jar

            # 3. 环境变量
            export SERVER_PORT=9090

            # 4. 配置中心(Consul/Config Server)
            # 5. application.yml
            # 6. application-{env}.yml

            # 配置合并示例
            import io.micronaut.context.env.Environment;
            import jakarta.inject.Inject;
            import jakarta.inject.Singleton;

            @Singleton
            public class ConfigService {

                @Inject
                private Environment environment;

                public void printConfigSources() {
                    environment.getPropertySources().forEach(source -> {
                        System.out.println("Config source: " + source.getName());
                    });
                }

                public String getProperty(String key) {
                    return environment.getProperty(key, String.class).orElse("default");
                }
            }
            ---
    c.配置验证
        a.功能说明
            使用Bean Validation验证配置的有效性,启动时检查配置错误。
        b.代码示例
            ---
            import io.micronaut.context.annotation.ConfigurationProperties;
            import jakarta.validation.constraints.Min;
            import jakarta.validation.constraints.NotBlank;
            import jakarta.validation.constraints.Pattern;

            @ConfigurationProperties("app")
            public class ValidatedConfig {

                @NotBlank(message = "Application name is required")
                private String name;

                @Min(value = 1, message = "Max connections must be at least 1")
                private int maxConnections;

                @Pattern(regexp = "^(dev|test|prod)$", message = "Invalid environment")
                private String environment;

                // Getters and Setters
                public String getName() {
                    return name;
                }

                public void setName(String name) {
                    this.name = name;
                }

                public int getMaxConnections() {
                    return maxConnections;
                }

                public void setMaxConnections(int maxConnections) {
                    this.maxConnections = maxConnections;
                }

                public String getEnvironment() {
                    return environment;
                }

                public void setEnvironment(String environment) {
                    this.environment = environment;
                }
            }

            // 配置验证失败时,应用启动会抛出异常
            // application.yml
            app:
              name: ""  # 验证失败:name不能为空
              max-connections: 0  # 验证失败:必须至少为1
              environment: "invalid"  # 验证失败:必须是dev/test/prod
            ---

6.6 安全认证

01.安全认证概述
    a.核心概念
        Micronaut Security提供全面的安全认证和授权功能,支持JWT、OAuth 2.0、LDAP等多种认证方式,内置CSRF防护、会话管理等安全特性,简化应用的安全实现。
    b.主要优势
        a.多种认证方式
            支持基于Token的认证、基于Session的认证、OAuth 2.0社交登录等多种认证机制,满足不同场景需求。
        b.声明式安全
            使用注解声明式配置安全规则,如@Secured、@RolesAllowed等,代码简洁清晰,易于维护。
        c.细粒度授权
            支持基于角色和权限的访问控制,可以精确控制到方法级别的访问权限。

02.JWT认证
    a.依赖配置
        a.功能说明
            JWT是无状态的Token认证方式,适用于微服务和移动应用,Micronaut提供完整的JWT支持。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.security:micronaut-security-jwt")
            }

            // application.yml
            micronaut:
              security:
                enabled: true
                token:
                  jwt:
                    enabled: true
                    signatures:
                      secret:
                        generator:
                          secret: "${JWT_SECRET:pleaseChangeThisSecretKey}"
                          jws-algorithm: HS256
                    generator:
                      access-token:
                        expiration: 3600
            ---
    b.用户认证
        a.功能说明
            实现AuthenticationProvider接口,自定义用户认证逻辑,验证用户名和密码。
        b.代码示例
            ---
            import io.micronaut.http.HttpRequest;
            import io.micronaut.security.authentication.*;
            import io.reactivex.rxjava3.core.Flowable;
            import jakarta.inject.Singleton;
            import org.reactivestreams.Publisher;

            @Singleton
            public class CustomAuthenticationProvider implements AuthenticationProvider<HttpRequest<?>> {

                @Override
                public Publisher<AuthenticationResponse> authenticate(
                    HttpRequest<?> httpRequest,
                    AuthenticationRequest<?, ?> authenticationRequest
                ) {
                    String username = authenticationRequest.getIdentity().toString();
                    String password = authenticationRequest.getSecret().toString();

                    // 验证用户名和密码
                    if ("admin".equals(username) && "password".equals(password)) {
                        return Flowable.just(
                            AuthenticationResponse.success(
                                username,
                                List.of("ROLE_ADMIN", "ROLE_USER")
                            )
                        );
                    } else if ("user".equals(username) && "password".equals(password)) {
                        return Flowable.just(
                            AuthenticationResponse.success(
                                username,
                                List.of("ROLE_USER")
                            )
                        );
                    }

                    return Flowable.just(
                        AuthenticationResponse.failure(
                            AuthenticationFailureReason.CREDENTIALS_DO_NOT_MATCH
                        )
                    );
                }
            }
            ---
    c.登录端点
        a.功能说明
            创建登录端点,接收用户凭证并返回JWT Token。
        b.代码示例
            ---
            import io.micronaut.http.annotation.Body;
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.annotation.Post;
            import io.micronaut.security.annotation.Secured;
            import io.micronaut.security.rules.SecurityRule;

            @Controller("/auth")
            @Secured(SecurityRule.IS_ANONYMOUS)
            public class AuthController {

                // 登录端点由Micronaut Security自动提供
                // POST /login
                // {
                //   "username": "admin",
                //   "password": "password"
                // }
                // 返回:
                // {
                //   "username": "admin",
                //   "roles": ["ROLE_ADMIN", "ROLE_USER"],
                //   "access_token": "eyJhbGciOiJIUzI1NiJ9...",
                //   "token_type": "Bearer",
                //   "expires_in": 3600
                // }
            }

            // 受保护的端点
            import io.micronaut.security.authentication.Authentication;

            @Controller("/api")
            public class SecureController {

                @Get("/profile")
                @Secured(SecurityRule.IS_AUTHENTICATED)
                public Map<String, Object> getProfile(Authentication authentication) {
                    return Map.of(
                        "username", authentication.getName(),
                        "roles", authentication.getRoles()
                    );
                }

                @Get("/admin")
                @Secured("ROLE_ADMIN")
                public String adminOnly() {
                    return "Admin access granted";
                }

                @Get("/user")
                @Secured({"ROLE_USER", "ROLE_ADMIN"})
                public String userAccess() {
                    return "User access granted";
                }
            }
            ---
    d.Token刷新
        a.功能说明
            实现Token刷新机制,延长用户会话时间,无需重新登录。
        b.代码示例
            ---
            // application.yml
            micronaut:
              security:
                token:
                  jwt:
                    generator:
                      refresh-token:
                        enabled: true
                        secret: "${JWT_REFRESH_SECRET:anotherSecretKey}"

            // 刷新Token端点
            import io.micronaut.http.annotation.Post;
            import io.micronaut.http.annotation.Body;
            import io.micronaut.security.annotation.Secured;
            import io.micronaut.security.rules.SecurityRule;
            import io.micronaut.security.token.jwt.generator.JwtTokenGenerator;
            import io.micronaut.security.token.jwt.validator.JwtTokenValidator;

            @Controller("/auth")
            public class TokenController {

                private final JwtTokenGenerator tokenGenerator;

                public TokenController(JwtTokenGenerator tokenGenerator) {
                    this.tokenGenerator = tokenGenerator;
                }

                @Post("/refresh")
                @Secured(SecurityRule.IS_ANONYMOUS)
                public Map<String, Object> refresh(@Body Map<String, String> request) {
                    String refreshToken = request.get("refresh_token");

                    // 验证refresh token并生成新的access token
                    // 实际实现需要验证refresh token的有效性
                    Optional<String> newToken = tokenGenerator.generateToken(
                        Map.of("username", "user", "roles", List.of("ROLE_USER"))
                    );

                    if (newToken.isPresent()) {
                        return Map.of(
                            "access_token", newToken.get(),
                            "token_type", "Bearer",
                            "expires_in", 3600
                        );
                    }

                    throw new RuntimeException("Invalid refresh token");
                }
            }
            ---

03.OAuth 2.0集成
    a.依赖配置
        a.功能说明
            Micronaut支持OAuth 2.0授权码流程,可以集成Google、GitHub、Facebook等第三方登录。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.security:micronaut-security-oauth2")
            }

            // application.yml
            micronaut:
              security:
                oauth2:
                  enabled: true
                  clients:
                    google:
                      client-id: ${GOOGLE_CLIENT_ID}
                      client-secret: ${GOOGLE_CLIENT_SECRET}
                      scopes:
                        - email
                        - profile
                    github:
                      client-id: ${GITHUB_CLIENT_ID}
                      client-secret: ${GITHUB_CLIENT_SECRET}
                      scopes:
                        - user:email
                        - read:user
            ---
    b.OAuth登录
        a.功能说明
            配置OAuth 2.0登录端点,用户通过第三方平台完成认证。
        b.代码示例
            ---
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.annotation.Get;
            import io.micronaut.security.annotation.Secured;
            import io.micronaut.security.rules.SecurityRule;
            import io.micronaut.security.authentication.Authentication;

            @Controller
            public class OAuthController {

                // OAuth登录端点由Micronaut自动提供
                // GET /oauth/login/google  - 跳转到Google登录
                // GET /oauth/login/github  - 跳转到GitHub登录

                // OAuth回调端点
                // GET /oauth/callback/google
                // GET /oauth/callback/github

                @Get("/")
                @Secured(SecurityRule.IS_ANONYMOUS)
                public String home() {
                    return """
                        <html>
                        <body>
                            <h1>Login</h1>
                            <a href="/oauth/login/google">Login with Google</a><br>
                            <a href="/oauth/login/github">Login with GitHub</a>
                        </body>
                        </html>
                        """;
                }

                @Get("/dashboard")
                @Secured(SecurityRule.IS_AUTHENTICATED)
                public Map<String, Object> dashboard(Authentication authentication) {
                    return Map.of(
                        "message", "Welcome to dashboard",
                        "user", authentication.getName(),
                        "attributes", authentication.getAttributes()
                    );
                }
            }
            ---
    c.自定义用户映射
        a.功能说明
            OAuth认证成功后,将第三方用户信息映射到应用的用户模型。
        b.代码示例
            ---
            import io.micronaut.context.annotation.Replaces;
            import io.micronaut.security.oauth2.endpoint.authorization.state.State;
            import io.micronaut.security.oauth2.endpoint.token.response.OauthAuthenticationMapper;
            import io.micronaut.security.oauth2.endpoint.token.response.TokenResponse;
            import io.micronaut.security.authentication.AuthenticationResponse;
            import jakarta.inject.Named;
            import jakarta.inject.Singleton;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Mono;

            @Singleton
            @Named("google")
            public class GoogleUserMapper implements OauthAuthenticationMapper {

                @Override
                public Publisher<AuthenticationResponse> createAuthenticationResponse(
                    TokenResponse tokenResponse,
                    State state
                ) {
                    // 从tokenResponse获取用户信息
                    Map<String, Object> claims = tokenResponse.getClaims();
                    String email = (String) claims.get("email");
                    String name = (String) claims.get("name");

                    // 创建应用用户
                    return Mono.just(
                        AuthenticationResponse.success(
                            email,
                            List.of("ROLE_USER"),
                            Map.of(
                                "name", name,
                                "email", email,
                                "provider", "google"
                            )
                        )
                    );
                }
            }
            ---

04.基于角色的访问控制
    a.方法级安全
        a.功能说明
            使用@Secured注解保护方法,限制只有特定角色的用户才能访问。
        b.代码示例
            ---
            import io.micronaut.http.annotation.*;
            import io.micronaut.security.annotation.Secured;
            import io.micronaut.security.rules.SecurityRule;
            import jakarta.annotation.security.RolesAllowed;

            @Controller("/orders")
            public class OrderController {

                // 允许所有认证用户访问
                @Get
                @Secured(SecurityRule.IS_AUTHENTICATED)
                public List<Order> listOrders() {
                    return orderService.findAll();
                }

                // 只允许ADMIN角色访问
                @Delete("/{id}")
                @Secured("ROLE_ADMIN")
                public HttpResponse<?> deleteOrder(Long id) {
                    orderService.delete(id);
                    return HttpResponse.noContent();
                }

                // 允许多个角色访问
                @Put("/{id}")
                @Secured({"ROLE_ADMIN", "ROLE_MANAGER"})
                public Order updateOrder(Long id, @Body Order order) {
                    return orderService.update(id, order);
                }

                // 使用JSR-250注解
                @Post
                @RolesAllowed({"ADMIN", "USER"})
                public Order createOrder(@Body Order order) {
                    return orderService.create(order);
                }

                // 允许匿名访问
                @Get("/public")
                @Secured(SecurityRule.IS_ANONYMOUS)
                public String publicEndpoint() {
                    return "Public access";
                }
            }
            ---
    b.表达式安全
        a.功能说明
            使用SpEL表��式实现复杂的访问控制逻辑。
        b.代码示例
            ---
            import io.micronaut.security.annotation.Secured;
            import io.micronaut.security.authentication.Authentication;

            @Controller("/documents")
            public class DocumentController {

                // 自定义安全规则
                @Get("/{id}")
                @Secured("#{authentication.name == #id or hasRole('ADMIN')}")
                public Document getDocument(Long id, Authentication authentication) {
                    return documentService.findById(id);
                }

                // 基于方法参数的安全检查
                @Put("/{id}")
                public Document updateDocument(
                    Long id,
                    @Body Document document,
                    Authentication authentication
                ) {
                    // 检查用户是否有权限修改文档
                    Document existing = documentService.findById(id);

                    if (!existing.getOwnerId().equals(authentication.getName()) &&
                        !authentication.getRoles().contains("ROLE_ADMIN")) {
                        throw new ForbiddenException("Access denied");
                    }

                    return documentService.update(id, document);
                }
            }
            ---

05.安全最佳实践
    a.密码加密
        a.功能说明
            使用BCrypt等强加密算法存储密码,避免明文存储。
        b.代码示例
            ---
            import io.micronaut.security.authentication.providers.PasswordEncoder;
            import jakarta.inject.Singleton;
            import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

            @Singleton
            public class UserService {

                private final PasswordEncoder passwordEncoder;

                public UserService(PasswordEncoder passwordEncoder) {
                    this.passwordEncoder = passwordEncoder;
                }

                public User registerUser(String username, String rawPassword) {
                    // 加密密码
                    String encodedPassword = passwordEncoder.encode(rawPassword);

                    User user = new User();
                    user.setUsername(username);
                    user.setPassword(encodedPassword);

                    return userRepository.save(user);
                }

                public boolean verifyPassword(String rawPassword, String encodedPassword) {
                    return passwordEncoder.matches(rawPassword, encodedPassword);
                }
            }
            ---
    b.CSRF防护
        a.功能说明
            启用CSRF防护,防止跨站请求伪造攻击。
        b.配置示例
            ---
            // application.yml
            micronaut:
              security:
                csrf:
                  enabled: true
                  # CSRF Token生成策略
                  token-generator-class: io.micronaut.security.token.jwt.generator.DefaultJwtTokenGenerator

            // 在表单中包含CSRF Token
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.annotation.Get;
            import io.micronaut.security.csrf.CsrfToken;

            @Controller("/form")
            public class FormController {

                @Get
                public String showForm(CsrfToken csrfToken) {
                    return """
                        <form method="POST" action="/submit">
                            <input type="hidden" name="_csrf" value="%s">
                            <input type="text" name="data">
                            <button type="submit">Submit</button>
                        </form>
                        """.formatted(csrfToken.getToken());
                }
            }
            ---
    c.安全头配置
        a.功能说明
            配置HTTP安全头,增强应用的安全性。
        b.配置示例
            ---
            // application.yml
            micronaut:
              security:
                enabled: true
                # 安全头配置
                intercept-url-map:
                  - pattern: /**
                    http-method: GET
                    access:
                      - isAnonymous()
                # X-Frame-Options
                x-frame-options:
                  enabled: true
                  mode: DENY
                # X-Content-Type-Options
                x-content-type-options:
                  enabled: true
                # X-XSS-Protection
                x-xss-protection:
                  enabled: true
                  mode: block
            ---

6.7 GraphQL支持

01.GraphQL概述
    a.核心概念
        GraphQL是一种API查询语言,客户端可以精确指定需要的数据字段,避免过度获取或获取不足的问题。Micronaut提供GraphQL集成,支持Schema定义、查询解析和订阅功能,简化GraphQL API的开发。
    b.主要优势
        a.精确数据获取
            客户端通过查询语句明确指定需要的字段,服务端只返回请求的数据,减少网络传输和数据处理开销。
        b.强类型系统
            GraphQL Schema定义了完整的类型系统,提供自动化的文档生成和类型验证,提升API的可维护性。
        c.单一端点
            所有查询通过单一HTTP端点处理,简化API设计和客户端集成,支持批量查询和嵌套查询。

02.GraphQL集成
    a.依赖配置
        a.功能说明
            Micronaut支持GraphQL Java实现,提供注解驱动的Schema定义和查询解析。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.graphql:micronaut-graphql")
            }

            // application.yml
            graphql:
              enabled: true
              path: /graphql
              graphiql:
                enabled: true
                path: /graphiql
            ---
    b.Schema定义
        a.功能说明
            使用GraphQL SDL定义Schema,描述API的类型、查询和变更操作。
        b.配置示例
            ---
            // src/main/resources/schema.graphqls
            type Query {
                # 查询单个用户
                user(id: ID!): User
                # 查询所有用户
                users: [User!]!
                # 查询订单
                order(id: ID!): Order
                # 查询用户的订单列表
                userOrders(userId: ID!): [Order!]!
            }

            type Mutation {
                # 创建用户
                createUser(input: CreateUserInput!): User!
                # 更新用户
                updateUser(id: ID!, input: UpdateUserInput!): User!
                # 删除用户
                deleteUser(id: ID!): Boolean!
                # 创建订单
                createOrder(input: CreateOrderInput!): Order!
            }

            type User {
                id: ID!
                username: String!
                email: String!
                orders: [Order!]!
                createdAt: String!
            }

            type Order {
                id: ID!
                userId: ID!
                user: User!
                productName: String!
                quantity: Int!
                totalAmount: Float!
                status: OrderStatus!
                createdAt: String!
            }

            enum OrderStatus {
                PENDING
                CONFIRMED
                SHIPPED
                DELIVERED
                CANCELLED
            }

            input CreateUserInput {
                username: String!
                email: String!
                password: String!
            }

            input UpdateUserInput {
                username: String
                email: String
            }

            input CreateOrderInput {
                userId: ID!
                productName: String!
                quantity: Int!
                totalAmount: Float!
            }
            ---

03.查询解析器
    a.Query实现
        a.功能说明
            实现GraphQL查询解析器,处理客户端的查询请求。
        b.代码示例
            ---
            import graphql.schema.DataFetcher;
            import graphql.schema.DataFetchingEnvironment;
            import io.micronaut.graphql.annotations.GraphQLQuery;
            import jakarta.inject.Singleton;

            @Singleton
            public class UserQueryResolver {

                private final UserService userService;

                public UserQueryResolver(UserService userService) {
                    this.userService = userService;
                }

                @GraphQLQuery
                public User user(Long id) {
                    return userService.findById(id);
                }

                @GraphQLQuery
                public List<User> users() {
                    return userService.findAll();
                }

                @GraphQLQuery
                public List<Order> userOrders(Long userId) {
                    return orderService.findByUserId(userId);
                }
            }

            @Singleton
            public class OrderQueryResolver {

                private final OrderService orderService;

                public OrderQueryResolver(OrderService orderService) {
                    this.orderService = orderService;
                }

                @GraphQLQuery
                public Order order(Long id) {
                    return orderService.findById(id);
                }
            }
            ---
    b.Mutation实现
        a.功能说明
            实现GraphQL变更解析器,处理数据的创建、更新和删除操作。
        b.代码示例
            ---
            import io.micronaut.graphql.annotations.GraphQLMutation;
            import jakarta.inject.Singleton;

            @Singleton
            public class UserMutationResolver {

                private final UserService userService;

                public UserMutationResolver(UserService userService) {
                    this.userService = userService;
                }

                @GraphQLMutation
                public User createUser(CreateUserInput input) {
                    User user = new User();
                    user.setUsername(input.getUsername());
                    user.setEmail(input.getEmail());
                    user.setPassword(input.getPassword());

                    return userService.create(user);
                }

                @GraphQLMutation
                public User updateUser(Long id, UpdateUserInput input) {
                    User user = userService.findById(id);

                    if (input.getUsername() != null) {
                        user.setUsername(input.getUsername());
                    }
                    if (input.getEmail() != null) {
                        user.setEmail(input.getEmail());
                    }

                    return userService.update(user);
                }

                @GraphQLMutation
                public Boolean deleteUser(Long id) {
                    userService.delete(id);
                    return true;
                }
            }

            @Singleton
            public class OrderMutationResolver {

                private final OrderService orderService;

                public OrderMutationResolver(OrderService orderService) {
                    this.orderService = orderService;
                }

                @GraphQLMutation
                public Order createOrder(CreateOrderInput input) {
                    Order order = new Order();
                    order.setUserId(input.getUserId());
                    order.setProductName(input.getProductName());
                    order.setQuantity(input.getQuantity());
                    order.setTotalAmount(input.getTotalAmount());
                    order.setStatus(OrderStatus.PENDING);

                    return orderService.create(order);
                }
            }
            ---
    c.字���解析器
        a.功能说明
            实现嵌套字段的解析器,处理对象关联查询。
        b.代码示例
            ---
            import graphql.schema.DataFetcher;
            import graphql.schema.DataFetchingEnvironment;
            import io.micronaut.graphql.annotations.GraphQLDataFetcher;
            import jakarta.inject.Singleton;

            @Singleton
            public class UserFieldResolver {

                private final OrderService orderService;

                public UserFieldResolver(OrderService orderService) {
                    this.orderService = orderService;
                }

                // 解析User.orders字段
                @GraphQLDataFetcher("User.orders")
                public List<Order> orders(DataFetchingEnvironment env) {
                    User user = env.getSource();
                    return orderService.findByUserId(user.getId());
                }
            }

            @Singleton
            public class OrderFieldResolver {

                private final UserService userService;

                public OrderFieldResolver(UserService userService) {
                    this.userService = userService;
                }

                // 解析Order.user字段
                @GraphQLDataFetcher("Order.user")
                public User user(DataFetchingEnvironment env) {
                    Order order = env.getSource();
                    return userService.findById(order.getUserId());
                }
            }
            ---

04.GraphQL查询示例
    a.基础查询
        a.功能说明
            客户端发送GraphQL查询,精确指定需要的字段。
        b.查询示例
            ---
            # 查询单个用户
            query {
              user(id: "1") {
                id
                username
                email
              }
            }

            # 查询用户及其订单
            query {
              user(id: "1") {
                id
                username
                email
                orders {
                  id
                  productName
                  quantity
                  totalAmount
                  status
                }
              }
            }

            # 查询多个资源
            query {
              users {
                id
                username
              }
              order(id: "100") {
                id
                productName
                user {
                  username
                }
              }
            }
            ---
    b.变更操作
        a.功能说明
            使用Mutation执行数据的创建、更新和删除操作。
        b.查询示例
            ---
            # 创建用户
            mutation {
              createUser(input: {
                username: "john_doe"
                email: "john@example.com"
                password: "secret123"
              }) {
                id
                username
                email
                createdAt
              }
            }

            # 更新用户
            mutation {
              updateUser(id: "1", input: {
                username: "john_updated"
                email: "john.new@example.com"
              }) {
                id
                username
                email
              }
            }

            # 创建订单
            mutation {
              createOrder(input: {
                userId: "1"
                productName: "Laptop"
                quantity: 1
                totalAmount: 999.99
              }) {
                id
                productName
                status
                user {
                  username
                }
              }
            }
            ---
    c.查询变量
        a.功能说明
            使用变量参数化查询,提高查询的复用性和安全性。
        b.查询示例
            ---
            # 查询定义
            query GetUser($userId: ID!) {
              user(id: $userId) {
                id
                username
                email
                orders {
                  id
                  productName
                  totalAmount
                }
              }
            }

            # 变量
            {
              "userId": "1"
            }

            # 创建用户Mutation
            mutation CreateUser($input: CreateUserInput!) {
              createUser(input: $input) {
                id
                username
                email
              }
            }

            # 变量
            {
              "input": {
                "username": "jane_doe",
                "email": "jane@example.com",
                "password": "password123"
              }
            }
            ---

05.高级特性
    a.DataLoader
        a.功能说明
            使用DataLoader解决N+1查询问题,批量加载关联数据,提升查询性能。
        b.代码示例
            ---
            import org.dataloader.DataLoader;
            import org.dataloader.DataLoaderRegistry;
            import io.micronaut.context.annotation.Factory;
            import jakarta.inject.Singleton;

            @Factory
            public class DataLoaderFactory {

                @Singleton
                public DataLoaderRegistry dataLoaderRegistry(UserService userService) {
                    DataLoaderRegistry registry = new DataLoaderRegistry();

                    // 用户DataLoader
                    DataLoader<Long, User> userLoader = DataLoader.newDataLoader(
                        userIds -> CompletableFuture.supplyAsync(() ->
                            userService.findByIds(userIds)
                        )
                    );

                    registry.register("userLoader", userLoader);
                    return registry;
                }
            }

            // 在字段解析器中使用
            @Singleton
            public class OrderFieldResolver {

                @GraphQLDataFetcher("Order.user")
                public CompletableFuture<User> user(DataFetchingEnvironment env) {
                    Order order = env.getSource();
                    DataLoader<Long, User> userLoader = env.getDataLoader("userLoader");
                    return userLoader.load(order.getUserId());
                }
            }
            ---
    b.订阅支持
        a.功能说明
            实现GraphQL订阅,支持实时数据推送。
        b.代码示例
            ---
            // Schema定义
            type Subscription {
                orderCreated: Order!
                orderStatusChanged(orderId: ID!): Order!
            }

            // 订阅解析器
            import io.micronaut.graphql.annotations.GraphQLSubscription;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Flux;

            @Singleton
            public class OrderSubscriptionResolver {

                private final Flux<Order> orderStream;

                public OrderSubscriptionResolver() {
                    this.orderStream = Flux.create(emitter -> {
                        // 订阅订单创建事件
                    });
                }

                @GraphQLSubscription
                public Publisher<Order> orderCreated() {
                    return orderStream;
                }

                @GraphQLSubscription
                public Publisher<Order> orderStatusChanged(Long orderId) {
                    return orderStream.filter(order ->
                        order.getId().equals(orderId)
                    );
                }
            }

            // 客户端订阅
            subscription {
              orderCreated {
                id
                productName
                status
                user {
                  username
                }
              }
            }
            ---
    c.错误处理
        a.功能说明
            自定义GraphQL错误处理,提供友好的错误信息。
        b.代码示例
            ---
            import graphql.GraphQLError;
            import graphql.GraphqlErrorBuilder;
            import graphql.schema.DataFetchingEnvironment;
            import io.micronaut.graphql.errors.GraphQLErrorHandler;
            import jakarta.inject.Singleton;

            @Singleton
            public class CustomErrorHandler implements GraphQLErrorHandler {

                @Override
                public GraphQLError handleException(
                    DataFetchingEnvironment environment,
                    Throwable exception
                ) {
                    if (exception instanceof NotFoundException) {
                        return GraphqlErrorBuilder.newError(environment)
                            .message("Resource not found: " + exception.getMessage())
                            .errorType(ErrorType.NOT_FOUND)
                            .build();
                    }

                    if (exception instanceof ValidationException) {
                        return GraphqlErrorBuilder.newError(environment)
                            .message("Validation failed: " + exception.getMessage())
                            .errorType(ErrorType.VALIDATION_ERROR)
                            .build();
                    }

                    return GraphqlErrorBuilder.newError(environment)
                        .message("Internal server error")
                        .errorType(ErrorType.INTERNAL_ERROR)
                        .build();
                }
            }
            ---

6.8 GraalVM原生镜像

01.GraalVM概述
    a.核心概念
        GraalVM原生镜像将Java应用编译为本地可执行文件,实现毫秒级启动时间和极低的内存占用。Micronaut专为GraalVM优化,通过编译时依赖注入和反射元数据生成,简化原生镜像的构建过程。
    b.主要优势
        a.快速启动
            原生镜像启动时间从秒级降低到毫秒级,适用于Serverless和容器化场景,显著提升应用的响应速度。
        b.低内存占用
            原生镜像的内存占用比JVM应用减少50%-80%,降低基础设施成本,提升资源利用率。
        c.即时性能
            无需JVM预热,应用启动即达到峰值性能,避免传统JVM的冷启动问题。

02.环境准备
    a.GraalVM安装
        a.功能说明
            安装GraalVM和Native Image工具,配置环境变量。
        b.安装步骤
            ---
            # 下载GraalVM
            # https://www.graalvm.org/downloads/

            # macOS/Linux安装
            export GRAALVM_HOME=/path/to/graalvm
            export PATH=$GRAALVM_HOME/bin:$PATH

            # 安装Native Image
            gu install native-image

            # 验证安装
            java -version
            native-image --version

            # Windows安装
            # 1. 下载GraalVM Windows版本
            # 2. 解压到目录,如 C:\graalvm
            # 3. 设置环境变量
            #    GRAALVM_HOME=C:\graalvm
            #    PATH=%GRAALVM_HOME%\bin;%PATH%
            # 4. 安装Native Image
            gu.cmd install native-image
            ---
    b.项目配置
        a.功能说明
            配置Gradle或Maven项目,添加GraalVM Native Image插件。
        b.配置示例
            ---
            // build.gradle
            plugins {
                id("io.micronaut.application") version "4.0.0"
                id("io.micronaut.graalvm") version "4.0.0"
            }

            graalvmNative {
                binaries {
                    main {
                        imageName = "micronaut-app"
                        mainClass = "com.example.Application"
                        buildArgs.add("--verbose")
                        buildArgs.add("-H:+ReportExceptionStackTraces")
                    }
                }
            }

            // Maven配置
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
                <version>0.9.28</version>
                <configuration>
                    <imageName>micronaut-app</imageName>
                    <mainClass>com.example.Application</mainClass>
                    <buildArgs>
                        <buildArg>--verbose</buildArg>
                        <buildArg>-H:+ReportExceptionStackTraces</buildArg>
                    </buildArgs>
                </configuration>
            </plugin>
            ---

03.构建原生镜像
    a.本地构建
        a.功能说明
            使用Gradle或Maven命令构建原生镜像。
        b.构建命令
            ---
            # Gradle构建
            ./gradlew nativeCompile

            # Maven构建
            ./mvnw package -Dpackaging=native-image

            # 构建输出
            # build/native/nativeCompile/micronaut-app

            # 运行原生镜像
            ./build/native/nativeCompile/micronaut-app

            # 查看启动时间和内存占用
            time ./build/native/nativeCompile/micronaut-app

            # 输出示例
            # Startup completed in 23ms
            # Memory: 15MB
            ---
    b.Docker构建
        a.功能说明
            使用Docker多阶段构建创建原生镜像容器。
        b.Dockerfile示例
            ---
            # Dockerfile
            FROM ghcr.io/graalvm/graalvm-ce:ol8-java17-22.3.0 AS builder

            WORKDIR /app
            COPY . .

            # 安装Native Image
            RUN gu install native-image

            # 构建原生镜像
            RUN ./gradlew nativeCompile

            # 运行阶段
            FROM oraclelinux:8-slim

            WORKDIR /app

            # 复制原生镜像
            COPY --from=builder /app/build/native/nativeCompile/micronaut-app .

            # 暴露端口
            EXPOSE 8080

            # 运行应用
            ENTRYPOINT ["./micronaut-app"]

            # 构建Docker镜像
            docker build -t micronaut-native:latest .

            # 运行容器
            docker run -p 8080:8080 micronaut-native:latest

            # 查看容器资源占用
            docker stats
            ---
    c.CI/CD集成
        a.功能说明
            在CI/CD流水线中自动构建原生镜像。
        b.GitHub Actions示例
            ---
            # .github/workflows/native-image.yml
            name: Build Native Image

            on:
              push:
                branches: [ main ]

            jobs:
              build:
                runs-on: ubuntu-latest

                steps:
                  - uses: actions/checkout@v3

                  - name: Setup GraalVM
                    uses: graalvm/setup-graalvm@v1
                    with:
                      version: '22.3.0'
                      java-version: '17'
                      components: 'native-image'

                  - name: Build Native Image
                    run: ./gradlew nativeCompile

                  - name: Test Native Image
                    run: |
                      ./build/native/nativeCompile/micronaut-app &
                      sleep 5
                      curl http://localhost:8080/health

                  - name: Upload Artifact
                    uses: actions/upload-artifact@v3
                    with:
                      name: native-image
                      path: build/native/nativeCompile/micronaut-app
            ---

04.反射配置
    a.自动配置
        a.功能说明
            Micronaut自动生成反射配置,无需手动配置大部分反射使用。
        b.配置示例
            ---
            // Micronaut自动处理的反射
            // - @Controller、@Service等注解的类
            // - @ConfigurationProperties配置类
            // - @Introspected注解的类

            // 需要手动配置的反射
            // - 第三方库的反射使用
            // - 动态类加载
            // - JNI调用

            // src/main/resources/META-INF/native-image/reflect-config.json
            [
              {
                "name": "com.example.DynamicClass",
                "allDeclaredConstructors": true,
                "allPublicConstructors": true,
                "allDeclaredMethods": true,
                "allPublicMethods": true,
                "allDeclaredFields": true,
                "allPublicFields": true
              }
            ]
            ---
    b.手动配置
        a.功能说明
            为第三方库或动态加载的类添加反射配置。
        b.代码示例
            ---
            import io.micronaut.core.annotation.Introspected;
            import io.micronaut.core.annotation.ReflectiveAccess;

            // 使用@Introspected注解
            @Introspected
            public class User {
                private Long id;
                private String username;
                private String email;

                // Getters and Setters
            }

            // 使用@ReflectiveAccess注解
            @ReflectiveAccess
            public class DynamicService {

                public void dynamicMethod() {
                    // 动态调用的方法
                }
            }

            // 编程式注册反射
            import io.micronaut.context.annotation.Factory;
            import io.micronaut.core.annotation.TypeHint;
            import jakarta.inject.Singleton;

            @Factory
            public class ReflectionConfiguration {

                @Singleton
                @TypeHint(
                    value = {ThirdPartyClass.class},
                    accessType = {TypeHint.AccessType.ALL_DECLARED_CONSTRUCTORS,
                                  TypeHint.AccessType.ALL_DECLARED_METHODS}
                )
                public ThirdPartyClass thirdPartyBean() {
                    return new ThirdPartyClass();
                }
            }
            ---

05.性能优化
    a.构建优化
        a.功能说明
            配置Native Image构建参数,优化镜像大小和性能。
        b.配置示例
            ---
            // build.gradle
            graalvmNative {
                binaries {
                    main {
                        buildArgs.addAll([
                            // 优化级别
                            "-O3",
                            // 启用G1 GC
                            "--gc=G1",
                            // 静态链接
                            "--static",
                            // 压缩
                            "-H:+CompressedReferences",
                            // 移除未使用代码
                            "-H:+RemoveUnusedSymbols",
                            // 优化字符串
                            "-H:+OptimizeStringConcat",
                            // 内存配置
                            "-J-Xmx8g"
                        ])
                    }
                }
            }
            ---
    b.运行时优化
        a.功能说明
            配置原生镜像的运行时参数,优化内存和性能。
        b.配置示例
            ---
            # 运行时参数
            ./micronaut-app \
              -Xmx128m \
              -Xms128m \
              -XX:MaxDirectMemorySize=64m

            # 环境变量配置
            export MICRONAUT_ENVIRONMENTS=prod
            export JAVA_OPTS="-Xmx128m -Xms128m"

            # Docker运行配置
            docker run \
              -p 8080:8080 \
              -m 256m \
              --cpus 0.5 \
              -e MICRONAUT_ENVIRONMENTS=prod \
              micronaut-native:latest
            ---
    c.监控和诊断
        a.功能说明
            启用原生镜像的监控和诊断功能。
        b.配置示例
            ---
            // build.gradle
            graalvmNative {
                binaries {
                    main {
                        buildArgs.addAll([
                            // 启用监控
                            "--enable-monitoring=heapdump,jfr,jvmstat",
                            // 启用诊断
                            "-H:+AllowVMInspection",
                            // 生成调试信息
                            "-H:+SourceLevelDebug",
                            // 生成性能报告
                            "-H:+DashboardAll",
                            "-H:DashboardDump=dashboard.bgv"
                        ])
                    }
                }
            }

            # 运行时启用JFR
            ./micronaut-app -XX:StartFlightRecording=filename=recording.jfr

            # 生成堆转储
            kill -SIGUSR1 <pid>
            ---

06.常见问题
    a.类初始化问题
        a.功能说明
            配置类的初始化时机,解决构建时初始化错误。
        b.配置示例
            ---
            // src/main/resources/META-INF/native-image/native-image.properties
            Args = --initialize-at-build-time=com.example.StaticClass \
                   --initialize-at-run-time=com.example.DynamicClass

            // 或在build.gradle中配置
            graalvmNative {
                binaries {
                    main {
                        buildArgs.add("--initialize-at-build-time=com.example.StaticClass")
                        buildArgs.add("--initialize-at-run-time=com.example.DynamicClass")
                    }
                }
            }
            ---
    b.资源文件访问
        a.功能说明
            配置资源文件的访问,确保原生镜像能正确加载资源。
        b.配置示例
            ---
            // src/main/resources/META-INF/native-image/resource-config.json
            {
              "resources": {
                "includes": [
                  {"pattern": "application.yml"},
                  {"pattern": "application-*.yml"},
                  {"pattern": "logback.xml"},
                  {"pattern": "META-INF/.*"},
                  {"pattern": "templates/.*\\.html"}
                ]
              }
            }

            // 或使用@ResourceHint注解
            import io.micronaut.core.annotation.ResourceHint;

            @ResourceHint(
                patterns = {
                    "application.yml",
                    "templates/*.html"
                }
            )
            public class Application {
                public static void main(String[] args) {
                    Micronaut.run(Application.class, args);
                }
            }
            ---
    c.第三方库兼容性
        a.功能说明
            处理第三方库的GraalVM兼容性问题。
        b.解决方案
            ---
            # 检查库的GraalVM兼���性
            # https://www.graalvm.org/native-image/libraries-and-frameworks/

            # 常见不兼容库的替代方案
            # - CGLIB → Micronaut AOP
            # - Javassist → ByteBuddy
            # - ASM动态生成 → 编译时生成

            # 添加第三方库的配置
            // build.gradle
            dependencies {
                // 使用GraalVM兼容的库版本
                implementation("org.postgresql:postgresql:42.5.0")

                // 添加GraalVM元数据
                implementation("org.graalvm.buildtools:graalvm-reachability-metadata:0.9.28")
            }

            # 使用Tracing Agent生成配置
            java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image \
                 -jar build/libs/app.jar

            # 运行测试生成配置
            ./gradlew test -Pagent
            ---

7 实战应用

7.1 项目创建与配置

01.项目创建
    a.使用Micronaut Launch
        a.功能说明
            Micronaut Launch是官方的项目生成器,提供Web界面和CLI工具,快速创建项目脚手架。
        b.使用步骤
            ---
            # Web界面创建
            # 访问 https://micronaut.io/launch/
            # 1. 选择应用类型:Application, CLI, Function等
            # 2. 选择Java版本:17, 21
            # 3. 选择构建工具:Gradle或Maven
            # 4. 选择语言:Java, Kotlin, Groovy
            # 5. 添加特性:Data JPA, Security JWT, Kafka等
            # 6. 下载项目压缩包

            # CLI工具创建
            # 安装Micronaut CLI
            sdk install micronaut

            # 创建项目
            mn create-app com.example.demo \
              --features=data-jpa,security-jwt,kafka \
              --build=gradle \
              --lang=java \
              --jdk=17

            # 创建微服务项目
            mn create-app com.example.order-service \
              --features=discovery-consul,tracing-zipkin,graalvm \
              --build=gradle

            # 创建函数项目
            mn create-function com.example.lambda \
              --features=aws-lambda \
              --build=gradle
            ---
    b.项目结构
        a.功能说明
            Micronaut项目遵循标准的Maven/Gradle项目结构,���码组织清晰。
        b.目录结构
            ---
            order-service/
            ├── src/
            │   ├── main/
            │   │   ├── java/
            │   │   │   └── com/example/
            │   │   │       ├── Application.java          # 应用入口
            │   │   │       ├── controller/               # 控制器
            │   │   │       │   └── OrderController.java
            │   │   │       ├── service/                  # 业务逻辑
            │   │   │       │   └── OrderService.java
            │   │   │       ├── repository/               # 数据访问
            │   │   │       │   └── OrderRepository.java
            │   │   │       ├── domain/                   # 领域模型
            │   │   │       │   └── Order.java
            │   │   │       └── config/                   # 配置类
            │   │   │           └── DatabaseConfig.java
            │   │   └── resources/
            │   │       ├── application.yml               # 主配置文件
            │   │       ├── application-dev.yml           # 开发环境配置
            │   │       ├── application-prod.yml          # 生产环境配置
            │   │       └── logback.xml                   # 日志配置
            │   └── test/
            │       ├── java/
            │       │   └── com/example/
            │       │       └── OrderControllerTest.java
            │       └── resources/
            │           └── application-test.yml
            ├── build.gradle                              # Gradle构建文件
            ├── settings.gradle
            ├── gradle.properties
            └── Dockerfile                                # Docker配置
            ---

02.基础配置
    a.应用配置
        a.功能说明
            配置应用的基本信息,包括名称、端口、环境等。
        b.配置示例
            ---
            // application.yml
            micronaut:
              application:
                name: order-service
              server:
                port: 8080
                context-path: /api
              # 环境配置
              environments:
                default: dev

            # 服务器配置
            netty:
              default:
                allocator:
                  max-order: 3

            # 日志配置
            logger:
              levels:
                com.example: DEBUG
                io.micronaut: INFO
            ---
    b.数据源配置
        a.功能说明
            配置数据库连接,支持多数据源和连接池。
        b.配置示例
            ---
            // application.yml
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/orders?serverTimezone=UTC
                driverClassName: com.mysql.cj.jdbc.Driver
                username: root
                password: ${DB_PASSWORD:secret}
                dialect: MYSQL
                # 连接池配置
                maximum-pool-size: 10
                minimum-idle: 2
                connection-timeout: 30000
                idle-timeout: 600000
                max-lifetime: 1800000

            # JPA配置
            jpa:
              default:
                properties:
                  hibernate:
                    hbm2ddl:
                      auto: update
                    show_sql: true
                    format_sql: true

            # 使用配置
            import io.micronaut.data.annotation.Repository;
            import io.micronaut.data.jpa.repository.JpaRepository;

            @Repository
            public interface OrderRepository extends JpaRepository<Order, Long> {
                List<Order> findByStatus(String status);
            }
            ---
    c.环境配置
        a.功能说明
            为不同环境配置不同的参数,如开发、测试、生产环境。
        b.配置示例
            ---
            // application-dev.yml
            micronaut:
              server:
                port: 8080

            datasources:
              default:
                url: jdbc:mysql://localhost:3306/orders_dev

            logger:
              levels:
                com.example: DEBUG

            // application-prod.yml
            micronaut:
              server:
                port: 80

            datasources:
              default:
                url: jdbc:mysql://prod-db:3306/orders
                maximum-pool-size: 50

            logger:
              levels:
                com.example: WARN

            # 启动时指定环境
            java -jar app.jar -Dmicronaut.environments=prod

            # 或使用环境变量
            export MICRONAUT_ENVIRONMENTS=prod
            java -jar app.jar
            ---

03.依赖管理
    a.核心依赖
        a.功能说明
            添加Micronaut核心依赖和常用模块。
        b.配置示例
            ---
            // build.gradle
            plugins {
                id("io.micronaut.application") version "4.0.0"
            }

            version = "1.0.0"
            group = "com.example"

            repositories {
                mavenCentral()
            }

            dependencies {
                // Micronaut核心
                implementation("io.micronaut:micronaut-runtime")
                implementation("io.micronaut:micronaut-http-server-netty")
                implementation("io.micronaut:micronaut-validation")

                // 数据访问
                implementation("io.micronaut.data:micronaut-data-jpa")
                implementation("io.micronaut.sql:micronaut-jdbc-hikari")
                runtimeOnly("mysql:mysql-connector-java")

                // 安全
                implementation("io.micronaut.security:micronaut-security-jwt")

                // 服务发现
                implementation("io.micronaut.discovery:micronaut-discovery-client")

                // 日志
                runtimeOnly("ch.qos.logback:logback-classic")

                // 测试
                testImplementation("io.micronaut.test:micronaut-test-junit5")
                testImplementation("org.junit.jupiter:junit-jupiter-api")
                testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
            }

            application {
                mainClass.set("com.example.Application")
            }

            java {
                sourceCompatibility = JavaVersion.VERSION_17
                targetCompatibility = JavaVersion.VERSION_17
            }
            ---
    b.版本管理
        a.功能说明
            使用BOM统一管理依赖版本,避免版本冲突。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                // 使用Micronaut BOM
                implementation(platform("io.micronaut.platform:micronaut-platform:4.0.0"))

                // 无需指定版本
                implementation("io.micronaut:micronaut-runtime")
                implementation("io.micronaut.data:micronaut-data-jpa")
                implementation("io.micronaut.security:micronaut-security-jwt")
            }

            // gradle.properties
            micronautVersion=4.0.0
            ---

04.应用入口
    a.主类定义
        a.功能说明
            定义应用的主类和启动方法。
        b.代码示例
            ---
            package com.example;

            import io.micronaut.runtime.Micronaut;

            public class Application {

                public static void main(String[] args) {
                    Micronaut.run(Application.class, args);
                }
            }

            // 自定义启动配置
            import io.micronaut.context.ApplicationContext;
            import io.micronaut.runtime.Micronaut;

            public class Application {

                public static void main(String[] args) {
                    Micronaut.build(args)
                        .mainClass(Application.class)
                        .banner(false)  // 禁用启动横幅
                        .start();
                }
            }
            ---
    b.启动监听器
        a.功能说明
            监听应用启动和关闭事件,执行初始化和清理逻辑。
        b.代码示例
            ---
            import io.micronaut.context.event.ApplicationEventListener;
            import io.micronaut.context.event.StartupEvent;
            import io.micronaut.context.event.ShutdownEvent;
            import jakarta.inject.Singleton;
            import org.slf4j.Logger;
            import org.slf4j.LoggerFactory;

            @Singleton
            public class ApplicationStartupListener implements ApplicationEventListener<StartupEvent> {

                private static final Logger LOG = LoggerFactory.getLogger(ApplicationStartupListener.class);

                @Override
                public void onApplicationEvent(StartupEvent event) {
                    LOG.info("Application started successfully");
                    LOG.info("Server running on port: {}", event.getSource().getEnvironment().getProperty("micronaut.server.port", Integer.class).orElse(8080));

                    // 执行初始化逻辑
                    initializeCache();
                    loadConfiguration();
                }

                private void initializeCache() {
                    LOG.info("Initializing cache...");
                }

                private void loadConfiguration() {
                    LOG.info("Loading configuration...");
                }
            }

            @Singleton
            public class ApplicationShutdownListener implements ApplicationEventListener<ShutdownEvent> {

                private static final Logger LOG = LoggerFactory.getLogger(ApplicationShutdownListener.class);

                @Override
                public void onApplicationEvent(ShutdownEvent event) {
                    LOG.info("Application shutting down...");

                    // 执行清理逻辑
                    closeConnections();
                    flushCache();
                }

                private void closeConnections() {
                    LOG.info("Closing database connections...");
                }

                private void flushCache() {
                    LOG.info("Flushing cache...");
                }
            }
            ---

05.开发工具
    a.热重载
        a.功能说明
            配置自动重载,提升开发效率。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                developmentOnly("io.micronaut:micronaut-runtime")
            }

            // 启用自动重载
            micronaut {
                runtime("netty")
                processing {
                    incremental(true)
                    annotations("com.example.*")
                }
            }

            # 运行开发模式
            ./gradlew run --continuous

            # 或使用IDE插件
            # IntelliJ IDEA: Micronaut插件
            # VS Code: Micronaut扩展
            ---
    b.API文档
        a.功能说明
            集成OpenAPI/Swagger,自动生成API文档。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.openapi:micronaut-openapi")
                annotationProcessor("io.micronaut.openapi:micronaut-openapi")
            }

            // application.yml
            micronaut:
              router:
                static-resources:
                  swagger:
                    paths: classpath:META-INF/swagger
                    mapping: /swagger/**
                  swagger-ui:
                    paths: classpath:META-INF/swagger/views/swagger-ui
                    mapping: /swagger-ui/**

            # 访问Swagger UI
            # http://localhost:8080/swagger-ui/

            // 在Controller中添加文档注解
            import io.swagger.v3.oas.annotations.Operation;
            import io.swagger.v3.oas.annotations.tags.Tag;

            @Controller("/orders")
            @Tag(name = "Order Management")
            public class OrderController {

                @Get("/{id}")
                @Operation(summary = "Get order by ID", description = "Returns a single order")
                public Order getOrder(Long id) {
                    return orderService.findById(id);
                }
            }
            ---

7.2 RESTful API开发

01.控制器开发
    a.基础控制器
        a.功能说明
            使用@Controller注解定义RESTful API端点,处理HTTP请求。
        b.代码示例
            ---
            import io.micronaut.http.annotation.*;
            import io.micronaut.http.HttpResponse;
            import jakarta.inject.Inject;

            @Controller("/api/orders")
            public class OrderController {

                @Inject
                private OrderService orderService;

                @Get
                public List<Order> listOrders() {
                    return orderService.findAll();
                }

                @Get("/{id}")
                public Order getOrder(Long id) {
                    return orderService.findById(id)
                        .orElseThrow(() -> new NotFoundException("Order not found"));
                }

                @Post
                public HttpResponse<Order> createOrder(@Body Order order) {
                    Order created = orderService.create(order);
                    return HttpResponse.created(created);
                }

                @Put("/{id}")
                public Order updateOrder(Long id, @Body Order order) {
                    return orderService.update(id, order);
                }

                @Delete("/{id}")
                public HttpResponse<?> deleteOrder(Long id) {
                    orderService.delete(id);
                    return HttpResponse.noContent();
                }
            }
            ---
    b.参数绑定
        a.功能说明
            自动绑定路径参数、查询参数、请求体等。
        b.代码示例
            ---
            @Controller("/api/products")
            public class ProductController {

                // 路径参数
                @Get("/{id}")
                public Product getProduct(@PathVariable Long id) {
                    return productService.findById(id);
                }

                // 查询参数
                @Get("/search")
                public List<Product> searchProducts(
                    @QueryValue String keyword,
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "10") int size
                ) {
                    return productService.search(keyword, page, size);
                }

                // 请求头
                @Get("/user-products")
                public List<Product> getUserProducts(
                    @Header("Authorization") String token
                ) {
                    String userId = extractUserId(token);
                    return productService.findByUserId(userId);
                }

                // Cookie
                @Get("/preferences")
                public Map<String, Object> getPreferences(
                    @CookieValue("session-id") String sessionId
                ) {
                    return preferenceService.getBySession(sessionId);
                }
            }
            ---

02.数据验证
    a.Bean Validation
        a.功能说明
            使用JSR-380注解验证请求数据。
        b.代码示例
            ---
            import jakarta.validation.constraints.*;

            public class CreateOrderRequest {

                @NotBlank(message = "Product name is required")
                @Size(min = 3, max = 100)
                private String productName;

                @NotNull
                @Min(value = 1, message = "Quantity must be at least 1")
                @Max(value = 1000)
                private Integer quantity;

                @NotNull
                @DecimalMin(value = "0.01")
                private BigDecimal price;

                @Email(message = "Invalid email format")
                private String customerEmail;

                @Pattern(regexp = "^\\+?[1-9]\\d{1,14}$", message = "Invalid phone number")
                private String phoneNumber;

                // Getters and Setters
            }

            @Controller("/api/orders")
            public class OrderController {

                @Post
                public HttpResponse<Order> createOrder(@Valid @Body CreateOrderRequest request) {
                    Order order = orderService.create(request);
                    return HttpResponse.created(order);
                }
            }
            ---
    b.自定义验证器
        a.功能说明
            实现自定义验证逻辑。
        b.代码示例
            ---
            import jakarta.validation.Constraint;
            import jakarta.validation.ConstraintValidator;
            import jakarta.validation.ConstraintValidatorContext;
            import jakarta.validation.Payload;
            import java.lang.annotation.*;

            @Target({ElementType.FIELD, ElementType.PARAMETER})
            @Retention(RetentionPolicy.RUNTIME)
            @Constraint(validatedBy = OrderStatusValidator.class)
            public @interface ValidOrderStatus {
                String message() default "Invalid order status";
                Class<?>[] groups() default {};
                Class<? extends Payload>[] payload() default {};
            }

            public class OrderStatusValidator implements ConstraintValidator<ValidOrderStatus, String> {

                private static final Set<String> VALID_STATUSES = Set.of(
                    "PENDING", "CONFIRMED", "SHIPPED", "DELIVERED", "CANCELLED"
                );

                @Override
                public boolean isValid(String value, ConstraintValidatorContext context) {
                    return value != null && VALID_STATUSES.contains(value.toUpperCase());
                }
            }

            // 使用自定义验证器
            public class UpdateOrderRequest {

                @ValidOrderStatus
                private String status;

                // Getters and Setters
            }
            ---

03.异常处理
    a.全局异常处理
        a.功能说明
            使用@Error注解处理全局异常。
        b.代码示例
            ---
            import io.micronaut.http.HttpRequest;
            import io.micronaut.http.HttpResponse;
            import io.micronaut.http.annotation.Error;
            import io.micronaut.http.annotation.Controller;
            import io.micronaut.http.hateoas.JsonError;

            @Controller
            public class GlobalExceptionHandler {

                @Error(global = true, exception = NotFoundException.class)
                public HttpResponse<JsonError> handleNotFound(HttpRequest request, NotFoundException e) {
                    JsonError error = new JsonError(e.getMessage())
                        .link("self", request.getUri());

                    return HttpResponse.notFound(error);
                }

                @Error(global = true, exception = ValidationException.class)
                public HttpResponse<JsonError> handleValidation(HttpRequest request, ValidationException e) {
                    JsonError error = new JsonError("Validation failed: " + e.getMessage());
                    return HttpResponse.badRequest(error);
                }

                @Error(global = true)
                public HttpResponse<JsonError> handleGeneric(HttpRequest request, Throwable e) {
                    JsonError error = new JsonError("Internal server error");
                    return HttpResponse.serverError(error);
                }
            }
            ---
    b.自定义异常
        a.功能说明
            定义业务异常类型。
        b.代码示例
            ---
            public class NotFoundException extends RuntimeException {
                public NotFoundException(String message) {
                    super(message);
                }
            }

            public class BusinessException extends RuntimeException {
                private final String errorCode;

                public BusinessException(String errorCode, String message) {
                    super(message);
                    this.errorCode = errorCode;
                }

                public String getErrorCode() {
                    return errorCode;
                }
            }

            // 异常处理器
            @Error(exception = BusinessException.class)
            public HttpResponse<Map<String, Object>> handleBusinessException(
                HttpRequest request,
                BusinessException e
            ) {
                Map<String, Object> error = Map.of(
                    "code", e.getErrorCode(),
                    "message", e.getMessage(),
                    "path", request.getPath()
                );

                return HttpResponse.badRequest(error);
            }
            ---

04.响应处理
    a.JSON响应
        a.功能说明
            自动序列化对象为JSON响应。
        b.代码示例
            ---
            @Controller("/api/users")
            public class UserController {

                @Get("/{id}")
                public User getUser(Long id) {
                    // 自动序列化为JSON
                    return userService.findById(id);
                }

                @Get
                public HttpResponse<List<User>> listUsers() {
                    List<User> users = userService.findAll();
                    return HttpResponse.ok(users)
                        .header("X-Total-Count", String.valueOf(users.size()));
                }

                // 自定义响应状态
                @Post
                public HttpResponse<User> createUser(@Body User user) {
                    User created = userService.create(user);
                    return HttpResponse.created(created)
                        .header("Location", "/api/users/" + created.getId());
                }
            }
            ---
    b.分页响应
        a.功能说明
            实现分页查询和响应。
        b.代码示例
            ---
            import io.micronaut.data.model.Page;
            import io.micronaut.data.model.Pageable;

            @Controller("/api/orders")
            public class OrderController {

                @Get
                public HttpResponse<Page<Order>> listOrders(
                    @QueryValue(defaultValue = "0") int page,
                    @QueryValue(defaultValue = "20") int size,
                    @QueryValue(defaultValue = "id,desc") String sort
                ) {
                    Pageable pageable = Pageable.from(page, size);
                    Page<Order> orders = orderService.findAll(pageable);

                    return HttpResponse.ok(orders)
                        .header("X-Total-Count", String.valueOf(orders.getTotalSize()))
                        .header("X-Total-Pages", String.valueOf(orders.getTotalPages()));
                }
            }

            // 自定义分页响应
            public class PageResponse<T> {
                private List<T> content;
                private int page;
                private int size;
                private long total;
                private int totalPages;

                // Constructor, Getters and Setters
            }

            @Get("/custom-page")
            public PageResponse<Order> customPage(Pageable pageable) {
                Page<Order> page = orderService.findAll(pageable);

                return new PageResponse<>(
                    page.getContent(),
                    page.getPageNumber(),
                    page.getSize(),
                    page.getTotalSize(),
                    page.getTotalPages()
                );
            }
            ---

05.API版本控制
    a.URL版本控制
        a.功能说明
            通过URL路径实现API版本控制。
        b.代码示例
            ---
            @Controller("/api/v1/orders")
            public class OrderControllerV1 {

                @Get("/{id}")
                public OrderV1 getOrder(Long id) {
                    return orderService.findByIdV1(id);
                }
            }

            @Controller("/api/v2/orders")
            public class OrderControllerV2 {

                @Get("/{id}")
                public OrderV2 getOrder(Long id) {
                    return orderService.findByIdV2(id);
                }
            }
            ---
    b.Header版本控制
        a.功能说明
            通过请求头实现API版本控制。
        b.代码示例
            ---
            @Controller("/api/orders")
            public class OrderController {

                @Get(value = "/{id}", produces = "application/vnd.api.v1+json")
                public OrderV1 getOrderV1(Long id) {
                    return orderService.findByIdV1(id);
                }

                @Get(value = "/{id}", produces = "application/vnd.api.v2+json")
                public OrderV2 getOrderV2(Long id) {
                    return orderService.findByIdV2(id);
                }
            }

            // 客户端请求
            // GET /api/orders/1
            // Accept: application/vnd.api.v1+json
            ---

7.3 微服务架构实践

01.服务拆分
    a.拆分原则
        a.功能说明
            按照业务领域和职责边界拆分微服务,遵循单一职责原则。
        b.拆分示例
            ---
            # 电商系统微服务拆分
            order-service/          # 订单服务
              - 订单创建
              - 订单查询
              - 订单状态管理

            inventory-service/      # 库存服务
              - 库存查询
              - 库存扣减
              - 库存补充

            payment-service/        # 支付服务
              - 支付处理
              - 退款处理
              - 支付查询

            user-service/           # 用户服务
              - 用户注册
              - 用户认证
              - 用户信息管理

            notification-service/   # 通知服务
              - 邮件通知
              - 短信通知
              - 推送通知
            ---
    b.服务通信
        a.同步通信
            a.功能说明
                使用HTTP客户端进行服务间同步调用。
            b.代码示例
                ---
                // 订单服务调用库存服务
                import io.micronaut.http.client.annotation.Client;
                import io.micronaut.http.annotation.Get;
                import io.micronaut.http.annotation.Post;

                @Client("inventory-service")
                public interface InventoryClient {

                    @Get("/inventory/{productId}")
                    Inventory getInventory(Long productId);

                    @Post("/inventory/reserve")
                    boolean reserveInventory(@Body ReserveRequest request);
                }

                @Service
                public class OrderService {

                    @Inject
                    private InventoryClient inventoryClient;

                    @Inject
                    private PaymentClient paymentClient;

                    public Order createOrder(CreateOrderRequest request) {
                        // 1. 检查库存
                        Inventory inventory = inventoryClient.getInventory(request.getProductId());
                        if (inventory.getQuantity() < request.getQuantity()) {
                            throw new BusinessException("INSUFFICIENT_INVENTORY", "库存不足");
                        }

                        // 2. 预留库存
                        boolean reserved = inventoryClient.reserveInventory(
                            new ReserveRequest(request.getProductId(), request.getQuantity())
                        );

                        if (!reserved) {
                            throw new BusinessException("RESERVE_FAILED", "库存预留失败");
                        }

                        // 3. 创建订单
                        Order order = new Order();
                        order.setProductId(request.getProductId());
                        order.setQuantity(request.getQuantity());
                        order.setStatus("PENDING");

                        return orderRepository.save(order);
                    }
                }
                ---
        b.异步通信
            a.功能说明
                使用消息队列实现服务间异步通信。
            b.代码示例
                ---
                // 订单服务发布订单创建事件
                import io.micronaut.configuration.kafka.annotation.KafkaClient;
                import io.micronaut.configuration.kafka.annotation.Topic;

                @KafkaClient
                public interface OrderEventProducer {

                    @Topic("order-events")
                    void publishOrderCreated(OrderCreatedEvent event);
                }

                @Service
                public class OrderService {

                    @Inject
                    private OrderEventProducer eventProducer;

                    public Order createOrder(CreateOrderRequest request) {
                        Order order = orderRepository.save(new Order(request));

                        // 发布事件
                        OrderCreatedEvent event = new OrderCreatedEvent(
                            order.getId(),
                            order.getUserId(),
                            order.getTotalAmount()
                        );
                        eventProducer.publishOrderCreated(event);

                        return order;
                    }
                }

                // 通知服务消费订单事件
                import io.micronaut.configuration.kafka.annotation.KafkaListener;
                import io.micronaut.configuration.kafka.annotation.Topic;

                @KafkaListener(groupId = "notification-service")
                public class OrderEventConsumer {

                    @Inject
                    private NotificationService notificationService;

                    @Topic("order-events")
                    public void onOrderCreated(OrderCreatedEvent event) {
                        // 发送订单确认邮件
                        notificationService.sendOrderConfirmation(
                            event.getUserId(),
                            event.getOrderId()
                        );
                    }
                }
                ---

02.服务编排
    a.Saga模式
        a.功能说明
            使用Saga模式管理分布式事务,确保数据一致性。
        b.代码示例
            ---
            @Service
            public class OrderSagaOrchestrator {

                @Inject
                private InventoryClient inventoryClient;

                @Inject
                private PaymentClient paymentClient;

                @Inject
                private OrderRepository orderRepository;

                public Order executeOrderSaga(CreateOrderRequest request) {
                    Order order = null;
                    boolean inventoryReserved = false;
                    boolean paymentProcessed = false;

                    try {
                        // Step 1: 创建订单
                        order = new Order(request);
                        order.setStatus("PENDING");
                        order = orderRepository.save(order);

                        // Step 2: 预留库存
                        inventoryReserved = inventoryClient.reserveInventory(
                            new ReserveRequest(order.getProductId(), order.getQuantity())
                        );

                        if (!inventoryReserved) {
                            throw new SagaException("库存预留失败");
                        }

                        // Step 3: 处理支付
                        PaymentResult paymentResult = paymentClient.processPayment(
                            new PaymentRequest(order.getId(), order.getTotalAmount())
                        );

                        if (!"SUCCESS".equals(paymentResult.getStatus())) {
                            throw new SagaException("支付失败");
                        }

                        paymentProcessed = true;

                        // Step 4: 确认订单
                        order.setStatus("CONFIRMED");
                        order = orderRepository.update(order);

                        return order;

                    } catch (Exception e) {
                        // 补偿操作
                        if (paymentProcessed) {
                            paymentClient.refund(order.getId());
                        }

                        if (inventoryReserved) {
                            inventoryClient.releaseInventory(
                                new ReleaseRequest(order.getProductId(), order.getQuantity())
                            );
                        }

                        if (order != null) {
                            order.setStatus("CANCELLED");
                            orderRepository.update(order);
                        }

                        throw new BusinessException("ORDER_FAILED", "订单创建失败: " + e.getMessage());
                    }
                }
            }
            ---
    b.事件驱动编排
        a.功能说明
            使用事件驱动方式编排服务流程。
        b.代码示例
            ---
            // 订单服务
            @Service
            public class OrderService {

                @Inject
                private OrderEventProducer eventProducer;

                public Order createOrder(CreateOrderRequest request) {
                    Order order = orderRepository.save(new Order(request));

                    // 发布订单创建事件
                    eventProducer.publishOrderCreated(new OrderCreatedEvent(order));

                    return order;
                }

                @KafkaListener(groupId = "order-service")
                @Topic("payment-events")
                public void onPaymentCompleted(PaymentCompletedEvent event) {
                    Order order = orderRepository.findById(event.getOrderId()).orElseThrow();
                    order.setStatus("PAID");
                    orderRepository.update(order);

                    // 发布订单已支付事件
                    eventProducer.publishOrderPaid(new OrderPaidEvent(order));
                }
            }

            // 库存服务
            @KafkaListener(groupId = "inventory-service")
            public class InventoryEventConsumer {

                @Topic("order-events")
                public void onOrderCreated(OrderCreatedEvent event) {
                    // 预留库存
                    boolean reserved = inventoryService.reserve(
                        event.getProductId(),
                        event.getQuantity()
                    );

                    if (reserved) {
                        eventProducer.publishInventoryReserved(
                            new InventoryReservedEvent(event.getOrderId())
                        );
                    } else {
                        eventProducer.publishInventoryReserveFailed(
                            new InventoryReserveFailedEvent(event.getOrderId())
                        );
                    }
                }

                @Topic("order-events")
                public void onOrderPaid(OrderPaidEvent event) {
                    // 扣减库存
                    inventoryService.deduct(event.getProductId(), event.getQuantity());
                }
            }
            ---

03.服务治理
    a.熔断器
        a.功能说明
            使用Resilience4j实现熔断器模式,防止故障扩散。
        b.代码示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.resilience4j:micronaut-resilience4j")
            }

            // application.yml
            resilience4j:
              circuitbreaker:
                instances:
                  inventory-service:
                    failure-rate-threshold: 50
                    wait-duration-in-open-state: 10s
                    sliding-window-size: 10

            // 使用熔断器
            import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;

            @Service
            public class OrderService {

                @Inject
                private InventoryClient inventoryClient;

                @CircuitBreaker(name = "inventory-service", fallbackMethod = "getInventoryFallback")
                public Inventory getInventory(Long productId) {
                    return inventoryClient.getInventory(productId);
                }

                public Inventory getInventoryFallback(Long productId, Exception e) {
                    // 降级逻辑:返回默认库存信息
                    return new Inventory(productId, 0, "服务暂时不可用");
                }
            }
            ---
    b.限流
        a.功能说明
            实现API限流,保护服务不被过载。
        b.代码示例
            ---
            // application.yml
            resilience4j:
              ratelimiter:
                instances:
                  order-api:
                    limit-for-period: 100
                    limit-refresh-period: 1s
                    timeout-duration: 0s

            // 使用限流器
            import io.github.resilience4j.ratelimiter.annotation.RateLimiter;

            @Controller("/api/orders")
            public class OrderController {

                @Post
                @RateLimiter(name = "order-api")
                public HttpResponse<Order> createOrder(@Body CreateOrderRequest request) {
                    Order order = orderService.createOrder(request);
                    return HttpResponse.created(order);
                }
            }
            ---

04.配置管理
    a.集中配置
        a.功能说明
            使用配置中心管理所有微服务的配置。
        b.配置示例
            ---
            // bootstrap.yml
            micronaut:
              application:
                name: order-service
              config-client:
                enabled: true

            consul:
              client:
                config:
                  enabled: true
                  format: YAML
                defaultZone: localhost:8500

            # Consul配置结构
            /config/application/data          # 所有服务共享
            /config/order-service/data        # 订单服务专属
            /config/order-service,prod/data   # 生产环境配置
            ---
    b.配置刷新
        a.功能说明
            支持配置动态刷新,无需重启服务。
        b.代码示例
            ---
            import io.micronaut.runtime.context.scope.Refreshable;
            import io.micronaut.context.annotation.ConfigurationProperties;

            @Refreshable
            @ConfigurationProperties("order")
            public class OrderConfig {

                private int maxOrdersPerDay;
                private BigDecimal minOrderAmount;

                // Getters and Setters
            }

            @Service
            public class OrderService {

                @Inject
                private OrderConfig orderConfig;

                public void validateOrder(Order order) {
                    if (order.getTotalAmount().compareTo(orderConfig.getMinOrderAmount()) < 0) {
                        throw new ValidationException("订单金额低于最小限制");
                    }
                }
            }
            ---

05.监控和追踪
    a.分布式追踪
        a.功能说明
            使用Zipkin追踪跨服务调用链路。
        b.配置示例
            ---
            // application.yml
            tracing:
              zipkin:
                enabled: true
                url: http://zipkin:9411
                sampler:
                  probability: 0.1

            # 自动追踪HTTP调用
            @Client("inventory-service")
            public interface InventoryClient {
                @Get("/inventory/{id}")
                Inventory getInventory(Long id);  // 自动追踪
            }
            ---
    b.健康检查
        a.功能说明
            实现健康检查端点,监控服务状态。
        b.代码示例
            ---
            // application.yml
            endpoints:
              health:
                enabled: true
                sensitive: false

            // 自定义健康检查
            import io.micronaut.management.health.indicator.HealthIndicator;
            import io.micronaut.management.health.indicator.HealthResult;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Mono;

            @Singleton
            public class DatabaseHealthIndicator implements HealthIndicator {

                @Inject
                private DataSource dataSource;

                @Override
                public Publisher<HealthResult> getResult() {
                    return Mono.fromCallable(() -> {
                        try (Connection conn = dataSource.getConnection()) {
                            boolean isValid = conn.isValid(5);
                            return isValid ?
                                HealthResult.builder("database").status(HealthStatus.UP).build() :
                                HealthResult.builder("database").status(HealthStatus.DOWN).build();
                        } catch (Exception e) {
                            return HealthResult.builder("database")
                                .status(HealthStatus.DOWN)
                                .exception(e)
                                .build();
                        }
                    });
                }
            }
            ---

7.4 性能调优

01.JVM调优
    a.内存配置
        a.功能说明
            优化JVM堆内存和垃圾回收器配置,提升应用性能。
        b.配置示例
            ---
            # 启动参数
            java -Xms512m -Xmx2g \
                 -XX:+UseG1GC \
                 -XX:MaxGCPauseMillis=200 \
                 -XX:+ParallelRefProcEnabled \
                 -jar app.jar

            # Docker配置
            docker run -m 2g \
                       -e JAVA_OPTS="-Xms512m -Xmx2g -XX:+UseG1GC" \
                       micronaut-app

            # Kubernetes配置
            resources:
              requests:
                memory: "512Mi"
                cpu: "500m"
              limits:
                memory: "2Gi"
                cpu: "2000m"
            ---
    b.GC调优
        a.功能说明
            选择合适的垃圾回收器并优化GC参数。
        b.配置示例
            ---
            # G1 GC配置(推荐)
            -XX:+UseG1GC
            -XX:MaxGCPauseMillis=200
            -XX:G1HeapRegionSize=16m
            -XX:InitiatingHeapOccupancyPercent=45

            # ZGC配置(低延迟)
            -XX:+UseZGC
            -XX:ZCollectionInterval=5
            -XX:ZAllocationSpikeTolerance=2

            # GC日志
            -Xlog:gc*:file=gc.log:time,uptime,level,tags
            ---

02.数据库优化
    a.连接池配置
        a.功能说明
            优化数据库连接池参数,提升数据库访问性能。
        b.配置示例
            ---
            // application.yml
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/db
                maximum-pool-size: 20
                minimum-idle: 5
                connection-timeout: 30000
                idle-timeout: 600000
                max-lifetime: 1800000
                connection-test-query: SELECT 1
                leak-detection-threshold: 60000
            ---
    b.查询优化
        a.功能说明
            优化数据库查询,使用索引和批量操作。
        b.代码示例
            ---
            @Repository
            public interface OrderRepository extends JpaRepository<Order, Long> {

                // 使用索引字段查询
                @Query("SELECT o FROM Order o WHERE o.userId = :userId AND o.status = :status")
                List<Order> findByUserIdAndStatus(Long userId, String status);

                // 批量查询
                @Query("SELECT o FROM Order o WHERE o.id IN :ids")
                List<Order> findByIds(List<Long> ids);

                // 分页查询
                Page<Order> findByStatus(String status, Pageable pageable);

                // 使用DTO投影
                @Query("SELECT new com.example.dto.OrderSummary(o.id, o.totalAmount, o.status) " +
                       "FROM Order o WHERE o.userId = :userId")
                List<OrderSummary> findOrderSummaries(Long userId);
            }

            // 批量插入
            @Service
            public class OrderService {

                @Transactional
                public void batchInsert(List<Order> orders) {
                    int batchSize = 100;
                    for (int i = 0; i < orders.size(); i++) {
                        orderRepository.save(orders.get(i));
                        if (i % batchSize == 0) {
                            entityManager.flush();
                            entityManager.clear();
                        }
                    }
                }
            }
            ---

03.缓存优化
    a.本地缓存
        a.功能说明
            使用Caffeine实现本地缓存,减少数据库访问。
        b.代码示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.cache:micronaut-cache-caffeine")
            }

            // application.yml
            micronaut:
              caches:
                products:
                  maximum-size: 1000
                  expire-after-write: 10m
                users:
                  maximum-size: 500
                  expire-after-access: 30m

            // 使用缓存
            import io.micronaut.cache.annotation.Cacheable;
            import io.micronaut.cache.annotation.CacheInvalidate;

            @Service
            public class ProductService {

                @Cacheable("products")
                public Product findById(Long id) {
                    return productRepository.findById(id).orElseThrow();
                }

                @CacheInvalidate("products")
                public Product update(Long id, Product product) {
                    return productRepository.update(product);
                }
            }
            ---
    b.分布式缓存
        a.功能说明
            使用Redis实现分布式缓存。
        b.代码示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.redis:micronaut-redis-lettuce")
            }

            // application.yml
            redis:
              uri: redis://localhost:6379
              caches:
                orders:
                  expire-after-write: 1h

            // 使用Redis缓存
            @Service
            public class OrderService {

                @Inject
                private RedisCommands<String, String> redis;

                public Order findById(Long id) {
                    String cacheKey = "order:" + id;
                    String cached = redis.get(cacheKey);

                    if (cached != null) {
                        return objectMapper.readValue(cached, Order.class);
                    }

                    Order order = orderRepository.findById(id).orElseThrow();
                    redis.setex(cacheKey, 3600, objectMapper.writeValueAsString(order));

                    return order;
                }
            }
            ---

04.HTTP优化
    a.连接池配置
        a.功能说明
            优化HTTP客户端连接池配置。
        b.配置示例
            ---
            // application.yml
            micronaut:
              http:
                client:
                  pool:
                    enabled: true
                    max-connections: 50
                    max-pending-acquires: 100
                  read-timeout: 10s
                  connect-timeout: 5s
            ---
    b.响应压缩
        a.功能说明
            启用HTTP响应压缩,减少网络传输。
        b.配置示例
            ---
            // application.yml
            micronaut:
              server:
                netty:
                  compression:
                    enabled: true
                    mime-types:
                      - application/json
                      - text/html
                    threshold: 1024
            ---

05.异步处理
    a.响应式编程
        a.功能说明
            使用响应式编程提升并发处理能力。
        b.代码示例
            ---
            import reactor.core.publisher.Mono;
            import reactor.core.publisher.Flux;

            @Controller("/api/orders")
            public class OrderController {

                @Get("/{id}")
                public Mono<Order> getOrder(Long id) {
                    return Mono.fromCallable(() -> orderService.findById(id));
                }

                @Get
                public Flux<Order> listOrders() {
                    return Flux.fromIterable(orderService.findAll());
                }

                @Post
                public Mono<HttpResponse<Order>> createOrder(@Body Order order) {
                    return Mono.fromCallable(() -> orderService.create(order))
                        .map(HttpResponse::created);
                }
            }
            ---
    b.线程池配置
        a.功能说明
            配置异步任务线程池。
        b.配置示例
            ---
            // application.yml
            micronaut:
              executors:
                io:
                  type: fixed
                  n-threads: 75
                scheduled:
                  type: scheduled
                  core-pool-size: 2

            // 使用异步执行
            import io.micronaut.scheduling.annotation.Async;

            @Service
            public class NotificationService {

                @Async
                public void sendEmail(String to, String subject, String body) {
                    // 异步发送邮件
                }

                @Async("io")
                public void processLargeFile(String filePath) {
                    // 使用IO线程池处理文件
                }
            }
            ---

7.5 监控与日志

01.日志配置
    a.Logback配置
        a.功能说明
            配置Logback日志框架,实现日志分级和输出。
        b.配置示例
            ---
            // src/main/resources/logback.xml
            <configuration>
                <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                    <encoder>
                        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
                    </encoder>
                </appender>

                <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
                    <file>logs/application.log</file>
                    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                        <fileNamePattern>logs/application-%d{yyyy-MM-dd}.log</fileNamePattern>
                        <maxHistory>30</maxHistory>
                    </rollingPolicy>
                    <encoder>
                        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
                    </encoder>
                </appender>

                <logger name="com.example" level="DEBUG"/>
                <logger name="io.micronaut" level="INFO"/>
                <logger name="io.netty" level="WARN"/>

                <root level="INFO">
                    <appender-ref ref="STDOUT"/>
                    <appender-ref ref="FILE"/>
                </root>
            </configuration>

            // 在代码中使用
            import org.slf4j.Logger;
            import org.slf4j.LoggerFactory;

            @Service
            public class OrderService {

                private static final Logger LOG = LoggerFactory.getLogger(OrderService.class);

                public Order createOrder(Order order) {
                    LOG.debug("Creating order: {}", order);

                    try {
                        Order created = orderRepository.save(order);
                        LOG.info("Order created successfully: {}", created.getId());
                        return created;
                    } catch (Exception e) {
                        LOG.error("Failed to create order", e);
                        throw e;
                    }
                }
            }
            ---
    b.结构化日志
        a.功能说明
            使用JSON格式输出结构化日志,便于日志分析。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("net.logstash.logback:logstash-logback-encoder:7.3")
            }

            // logback.xml
            <appender name="JSON" class="ch.qos.logback.core.ConsoleAppender">
                <encoder class="net.logstash.logback.encoder.LogstashEncoder">
                    <includeMdcKeyName>traceId</includeMdcKeyName>
                    <includeMdcKeyName>spanId</includeMdcKeyName>
                </encoder>
            </appender>

            // 使用MDC添加上下文信息
            import org.slf4j.MDC;

            @Service
            public class OrderService {

                public Order createOrder(Order order) {
                    MDC.put("orderId", order.getId().toString());
                    MDC.put("userId", order.getUserId().toString());

                    try {
                        LOG.info("Processing order");
                        return orderRepository.save(order);
                    } finally {
                        MDC.clear();
                    }
                }
            }
            ---

02.指标监控
    a.Micrometer集成
        a.功能说明
            使用Micrometer收集应用指标。
        b.配置示例
            ---
            // build.gradle
            dependencies {
                implementation("io.micronaut.micrometer:micronaut-micrometer-core")
                implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus")
            }

            // application.yml
            micronaut:
              metrics:
                enabled: true
                export:
                  prometheus:
                    enabled: true
                    step: PT1M
                    descriptions: true

            endpoints:
              prometheus:
                sensitive: false

            // 访问指标端点
            // http://localhost:8080/prometheus

            // 自定义指标
            import io.micrometer.core.instrument.MeterRegistry;
            import io.micrometer.core.instrument.Counter;
            import io.micrometer.core.instrument.Timer;

            @Service
            public class OrderService {

                private final Counter orderCounter;
                private final Timer orderTimer;

                public OrderService(MeterRegistry registry) {
                    this.orderCounter = registry.counter("orders.created");
                    this.orderTimer = registry.timer("orders.processing.time");
                }

                public Order createOrder(Order order) {
                    return orderTimer.record(() -> {
                        Order created = orderRepository.save(order);
                        orderCounter.increment();
                        return created;
                    });
                }
            }
            ---
    b.健康检查
        a.功能说明
            实现健康检查端点,监控服务状态。
        b.代码示例
            ---
            // application.yml
            endpoints:
              health:
                enabled: true
                sensitive: false
                details-visible: ANONYMOUS

            // 自定义健康检查
            import io.micronaut.management.health.indicator.HealthIndicator;
            import io.micronaut.management.health.indicator.HealthResult;
            import org.reactivestreams.Publisher;
            import reactor.core.publisher.Mono;

            @Singleton
            public class CustomHealthIndicator implements HealthIndicator {

                @Inject
                private OrderService orderService;

                @Override
                public Publisher<HealthResult> getResult() {
                    return Mono.fromCallable(() -> {
                        try {
                            // 检查服务是否正常
                            long count = orderService.count();

                            return HealthResult.builder("order-service")
                                .status(HealthStatus.UP)
                                .details(Map.of("totalOrders", count))
                                .build();
                        } catch (Exception e) {
                            return HealthResult.builder("order-service")
                                .status(HealthStatus.DOWN)
                                .exception(e)
                                .build();
                        }
                    });
                }
            }

            // 访问健康检查
            // http://localhost:8080/health
            ---

03.APM集成
    a.Prometheus监控
        a.功能说明
            集成Prometheus进行指标采集和监控。
        b.配置示例
            ---
            // prometheus.yml
            global:
              scrape_interval: 15s

            scrape_configs:
              - job_name: 'micronaut-app'
                static_configs:
                  - targets: ['localhost:8080']
                metrics_path: '/prometheus'

            # 启动Prometheus
            docker run -d \
              -p 9090:9090 \
              -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
              prom/prometheus

            # 访问Prometheus UI
            # http://localhost:9090
            ---
    b.Grafana可视化
        a.功能说明
            使用Grafana创建监控仪表板。
        b.配置示例
            ---
            # 启动Grafana
            docker run -d \
              -p 3000:3000 \
              grafana/grafana

            # 配置数据源
            # 1. 访问 http://localhost:3000
            # 2. 添加Prometheus数据源
            # 3. URL: http://prometheus:9090

            # 导入Micronaut仪表板
            # Dashboard ID: 11955

            # 常用查询
            # - JVM内存使用: jvm_memory_used_bytes
            # - HTTP请求数: http_server_requests_total
            # - 响应时间: http_server_requests_seconds
            # - 数据库连接: hikaricp_connections_active
            ---

04.日志聚合
    a.ELK Stack
        a.功能说明
            使用Elasticsearch、Logstash、Kibana进行日志聚合和分析。
        b.配置示例
            ---
            // logback.xml - Logstash输出
            <appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
                <destination>logstash:5000</destination>
                <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
            </appender>

            // docker-compose.yml
            version: '3'
            services:
              elasticsearch:
                image: elasticsearch:8.5.0
                ports:
                  - "9200:9200"
                environment:
                  - discovery.type=single-node

              logstash:
                image: logstash:8.5.0
                ports:
                  - "5000:5000"
                volumes:
                  - ./logstash.conf:/usr/share/logstash/pipeline/logstash.conf

              kibana:
                image: kibana:8.5.0
                ports:
                  - "5601:5601"
                depends_on:
                  - elasticsearch

            // logstash.conf
            input {
              tcp {
                port => 5000
                codec => json
              }
            }

            output {
              elasticsearch {
                hosts => ["elasticsearch:9200"]
                index => "micronaut-logs-%{+YYYY.MM.dd}"
              }
            }
            ---
    b.日志查询
        a.功能说明
            在Kibana中查询和分析日志。
        b.查询示例
            ---
            # Kibana查询语法
            # 查询错误日志
            level: ERROR

            # 查询特定服务
            logger_name: "com.example.OrderService"

            # 查询特定时间范围
            @timestamp: [2024-01-01 TO 2024-01-31]

            # 组合查询
            level: ERROR AND logger_name: "com.example.*"

            # 聚合查询
            # 按日志级别统计
            # 按服务统计错误数
            ---

05.告警配置
    a.Prometheus告警
        a.功能说明
            配置Prometheus告警规则。
        b.配置示例
            ---
            // alert.rules.yml
            groups:
              - name: micronaut_alerts
                interval: 30s
                rules:
                  - alert: HighErrorRate
                    expr: rate(http_server_requests_total{status=~"5.."}[5m]) > 0.05
                    for: 5m
                    labels:
                      severity: critical
                    annotations:
                      summary: "High error rate detected"
                      description: "Error rate is {{ $value }} requests/sec"

                  - alert: HighMemoryUsage
                    expr: jvm_memory_used_bytes / jvm_memory_max_bytes > 0.9
                    for: 5m
                    labels:
                      severity: warning
                    annotations:
                      summary: "High memory usage"
                      description: "Memory usage is {{ $value | humanizePercentage }}"

                  - alert: ServiceDown
                    expr: up == 0
                    for: 1m
                    labels:
                      severity: critical
                    annotations:
                      summary: "Service is down"
            ---
    b.Alertmanager配置
        a.功能说明
            配置告警通知渠道。
        b.配置示例
            ---
            // alertmanager.yml
            global:
              resolve_timeout: 5m

            route:
              group_by: ['alertname']
              group_wait: 10s
              group_interval: 10s
              repeat_interval: 1h
              receiver: 'email'

            receivers:
              - name: 'email'
                email_configs:
                  - to: 'ops@example.com'
                    from: 'alertmanager@example.com'
                    smarthost: 'smtp.example.com:587'
                    auth_username: 'alertmanager'
                    auth_password: 'password'

              - name: 'slack'
                slack_configs:
                  - api_url: 'https://hooks.slack.com/services/xxx'
                    channel: '#alerts'
            ---

7.6 容器化部署

01.Docker镜像构建
    a.Dockerfile编写
        a.功能说明
            编写Dockerfile构建应用镜像。
        b.配置示例
            ---
            # 多阶段构建Dockerfile
            FROM gradle:8.5-jdk17 AS builder

            WORKDIR /app
            COPY . .

            RUN gradle clean build --no-daemon

            FROM eclipse-temurin:17-jre-alpine

            WORKDIR /app

            COPY --from=builder /app/build/libs/app.jar app.jar

            EXPOSE 8080

            ENTRYPOINT ["java", "-jar", "app.jar"]

            # 构建镜像
            docker build -t micronaut-app:1.0.0 .

            # 运行容器
            docker run -d \
              -p 8080:8080 \
              --name micronaut-app \
              micronaut-app:1.0.0
            ---
    b.镜像优化
        a.功能说明
            优化Docker镜像大小和构建速度。
        b.配置示例
            ---
            # 使用.dockerignore
            .git
            .gradle
            build
            *.md
            .idea

            # 分层构建
            FROM gradle:8.5-jdk17 AS builder
            WORKDIR /app

            # 先复制依赖文件
            COPY build.gradle settings.gradle ./
            COPY gradle ./gradle
            RUN gradle dependencies --no-daemon

            # 再复制源代码
            COPY src ./src
            RUN gradle build --no-daemon

            # 使用Alpine基础镜像
            FROM eclipse-temurin:17-jre-alpine

            # 添加非root用户
            RUN addgroup -S micronaut && adduser -S micronaut -G micronaut

            WORKDIR /app
            COPY --from=builder /app/build/libs/app.jar app.jar

            RUN chown -R micronaut:micronaut /app
            USER micronaut

            EXPOSE 8080

            ENTRYPOINT ["java", \
              "-XX:+UseContainerSupport", \
              "-XX:MaxRAMPercentage=75.0", \
              "-jar", "app.jar"]
            ---

02.Docker Compose
    a.多服务编排
        a.功能说明
            使用Docker Compose编排多个服务。
        b.配置示例
            ---
            # docker-compose.yml
            version: '3.8'

            services:
              order-service:
                build: ./order-service
                ports:
                  - "8080:8080"
                environment:
                  - MICRONAUT_ENVIRONMENTS=prod
                  - DB_HOST=mysql
                  - REDIS_HOST=redis
                depends_on:
                  - mysql
                  - redis
                networks:
                  - app-network

              inventory-service:
                build: ./inventory-service
                ports:
                  - "8081:8080"
                environment:
                  - MICRONAUT_ENVIRONMENTS=prod
                  - DB_HOST=mysql
                depends_on:
                  - mysql
                networks:
                  - app-network

              mysql:
                image: mysql:8.0
                environment:
                  - MYSQL_ROOT_PASSWORD=secret
                  - MYSQL_DATABASE=orders
                volumes:
                  - mysql-data:/var/lib/mysql
                networks:
                  - app-network

              redis:
                image: redis:7-alpine
                networks:
                  - app-network

            volumes:
              mysql-data:

            networks:
              app-network:
                driver: bridge

            # 启动所有服务
            docker-compose up -d

            # 查看日志
            docker-compose logs -f order-service

            # 停止服务
            docker-compose down
            ---
    b.健康检查
        a.功能说明
            配置容器健康检查。
        b.配置示例
            ---
            # docker-compose.yml
            services:
              order-service:
                build: ./order-service
                healthcheck:
                  test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
                  interval: 30s
                  timeout: 10s
                  retries: 3
                  start_period: 40s

            # Dockerfile
            FROM eclipse-temurin:17-jre-alpine

            # 安装curl用于健康检查
            RUN apk add --no-cache curl

            WORKDIR /app
            COPY app.jar app.jar

            HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
              CMD curl -f http://localhost:8080/health || exit 1

            ENTRYPOINT ["java", "-jar", "app.jar"]
            ---

03.Kubernetes部署
    a.Deployment配置
        a.功能说明
            创建Kubernetes Deployment部署应用。
        b.配置示例
            ---
            # deployment.yaml
            apiVersion: apps/v1
            kind: Deployment
            metadata:
              name: order-service
              labels:
                app: order-service
            spec:
              replicas: 3
              selector:
                matchLabels:
                  app: order-service
              template:
                metadata:
                  labels:
                    app: order-service
                spec:
                  containers:
                  - name: order-service
                    image: micronaut-app:1.0.0
                    ports:
                    - containerPort: 8080
                    env:
                    - name: MICRONAUT_ENVIRONMENTS
                      value: "prod"
                    - name: DB_HOST
                      value: "mysql-service"
                    resources:
                      requests:
                        memory: "512Mi"
                        cpu: "500m"
                      limits:
                        memory: "1Gi"
                        cpu: "1000m"
                    livenessProbe:
                      httpGet:
                        path: /health
                        port: 8080
                      initialDelaySeconds: 30
                      periodSeconds: 10
                    readinessProbe:
                      httpGet:
                        path: /health
                        port: 8080
                      initialDelaySeconds: 20
                      periodSeconds: 5

            # 部署应用
            kubectl apply -f deployment.yaml

            # 查看部署状态
            kubectl get deployments
            kubectl get pods

            # 查看日志
            kubectl logs -f deployment/order-service
            ---
    b.Service配置
        a.功能说明
            创建Kubernetes Service暴露应用。
        b.配置示例
            ---
            # service.yaml
            apiVersion: v1
            kind: Service
            metadata:
              name: order-service
            spec:
              type: LoadBalancer
              selector:
                app: order-service
              ports:
              - protocol: TCP
                port: 80
                targetPort: 8080

            # 部署Service
            kubectl apply -f service.yaml

            # 查看Service
            kubectl get services

            # 获取外部IP
            kubectl get service order-service
            ---
    c.ConfigMap和Secret
        a.功能说明
            使用ConfigMap和Secret管理配置和敏感信息。
        b.配置示例
            ---
            # configmap.yaml
            apiVersion: v1
            kind: ConfigMap
            metadata:
              name: order-config
            data:
              application.yml: |
                micronaut:
                  application:
                    name: order-service
                  server:
                    port: 8080

            # secret.yaml
            apiVersion: v1
            kind: Secret
            metadata:
              name: order-secret
            type: Opaque
            data:
              db-password: c2VjcmV0  # base64编码

            # 在Deployment中使用
            spec:
              containers:
              - name: order-service
                env:
                - name: DB_PASSWORD
                  valueFrom:
                    secretKeyRef:
                      name: order-secret
                      key: db-password
                volumeMounts:
                - name: config
                  mountPath: /app/config
              volumes:
              - name: config
                configMap:
                  name: order-config

            # 创建ConfigMap和Secret
            kubectl apply -f configmap.yaml
            kubectl apply -f secret.yaml
            ---

04.Helm部署
    a.Chart创建
        a.功能说明
            使用Helm简化Kubernetes应用部署。
        b.配置示例
            ---
            # 创建Helm Chart
            helm create micronaut-app

            # Chart.yaml
            apiVersion: v2
            name: micronaut-app
            version: 1.0.0
            appVersion: "1.0.0"

            # values.yaml
            replicaCount: 3

            image:
              repository: micronaut-app
              tag: "1.0.0"
              pullPolicy: IfNotPresent

            service:
              type: LoadBalancer
              port: 80
              targetPort: 8080

            resources:
              requests:
                memory: "512Mi"
                cpu: "500m"
              limits:
                memory: "1Gi"
                cpu: "1000m"

            env:
              - name: MICRONAUT_ENVIRONMENTS
                value: "prod"

            # 安装Chart
            helm install order-service ./micronaut-app

            # 升级
            helm upgrade order-service ./micronaut-app

            # 回滚
            helm rollback order-service 1

            # 卸载
            helm uninstall order-service
            ---
    b.多环境配置
        a.功能说明
            为不同环境配置不同的values文件。
        b.配置示例
            ---
            # values-dev.yaml
            replicaCount: 1
            image:
              tag: "dev"
            env:
              - name: MICRONAUT_ENVIRONMENTS
                value: "dev"

            # values-prod.yaml
            replicaCount: 5
            image:
              tag: "1.0.0"
            env:
              - name: MICRONAUT_ENVIRONMENTS
                value: "prod"
            resources:
              requests:
                memory: "1Gi"
                cpu: "1000m"

            # 部署到不同环境
            helm install order-service-dev ./micronaut-app -f values-dev.yaml
            helm install order-service-prod ./micronaut-app -f values-prod.yaml
            ---

05.CI/CD集成
    a.GitHub Actions
        a.功能说明
            使用GitHub Actions自动化构建和部署。
        b.配置示例
            ---
            # .github/workflows/deploy.yml
            name: Build and Deploy

            on:
              push:
                branches: [ main ]

            jobs:
              build:
                runs-on: ubuntu-latest

                steps:
                  - uses: actions/checkout@v3

                  - name: Set up JDK 17
                    uses: actions/setup-java@v3
                    with:
                      java-version: '17'
                      distribution: 'temurin'

                  - name: Build with Gradle
                    run: ./gradlew build

                  - name: Build Docker image
                    run: docker build -t micronaut-app:${{ github.sha }} .

                  - name: Push to Registry
                    run: |
                      echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
                      docker tag micronaut-app:${{ github.sha }} myregistry/micronaut-app:${{ github.sha }}
                      docker push myregistry/micronaut-app:${{ github.sha }}

                  - name: Deploy to Kubernetes
                    uses: azure/k8s-deploy@v4
                    with:
                      manifests: |
                        k8s/deployment.yaml
                        k8s/service.yaml
                      images: |
                        myregistry/micronaut-app:${{ github.sha }}
            ---
    b.GitLab CI
        a.功能说明
            使用GitLab CI/CD进行自动化部署。
        b.配置示例
            ---
            # .gitlab-ci.yml
            stages:
              - build
              - test
              - deploy

            variables:
              DOCKER_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA

            build:
              stage: build
              image: gradle:8.5-jdk17
              script:
                - gradle clean build
              artifacts:
                paths:
                  - build/libs/*.jar

            docker:
              stage: build
              image: docker:latest
              services:
                - docker:dind
              script:
                - docker build -t $DOCKER_IMAGE .
                - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
                - docker push $DOCKER_IMAGE

            deploy:
              stage: deploy
              image: bitnami/kubectl:latest
              script:
                - kubectl set image deployment/order-service order-service=$DOCKER_IMAGE
                - kubectl rollout status deployment/order-service
              only:
                - main
            ---

7.7 常见问题排查

01.启动问题
    a.端口占用
        a.问题描述
            应用启动失败,提示端口已被占用。
        b.解决方案
            ---
            # 查看端口占用
            # Linux/macOS
            lsof -i :8080
            netstat -an | grep 8080

            # Windows
            netstat -ano | findstr :8080

            # 终止占用进程
            kill -9 <PID>

            # 或修改应用端口
            // application.yml
            micronaut:
              server:
                port: 8081

            # 或使用随机端口
            micronaut:
              server:
                port: -1
            ---
    b.依赖冲突
        a.问题描述
            应用启动时出现ClassNotFoundException或NoSuchMethodError。
        b.解决方案
            ---
            # 查看依赖树
            ./gradlew dependencies

            # 排除冲突依赖
            // build.gradle
            dependencies {
                implementation("io.micronaut:micronaut-runtime") {
                    exclude group: 'org.slf4j', module: 'slf4j-api'
                }
            }

            # 强制使用特定版本
            configurations.all {
                resolutionStrategy {
                    force 'org.slf4j:slf4j-api:2.0.0'
                }
            }

            # 清理缓存重新构建
            ./gradlew clean build --refresh-dependencies
            ---
    c.Bean注入失败
        a.问题描述
            启动时提示No bean of type found。
        b.解决方案
            ---
            # 检查Bean定义
            @Singleton  // 确保有注解
            public class OrderService {
                // ...
            }

            # 检查包扫描路径
            @Application
            @ComponentScan("com.example")  // 指定扫描路径
            public class Application {
                // ...
            }

            # 检查依赖注入
            @Controller("/orders")
            public class OrderController {

                @Inject  // 使用@Inject注解
                private OrderService orderService;

                // 或使用构造器注入(推荐)
                public OrderController(OrderService orderService) {
                    this.orderService = orderService;
                }
            }

            # 查看Bean定义
            ./gradlew run --debug
            ---

02.数据库问题
    a.连接失败
        a.问题描述
            应用无法连接到数据库。
        b.解决方案
            ---
            # 检查数据库配置
            // application.yml
            datasources:
              default:
                url: jdbc:mysql://localhost:3306/db?serverTimezone=UTC
                username: root
                password: secret
                driverClassName: com.mysql.cj.jdbc.Driver

            # 测试数据库连接
            mysql -h localhost -u root -p

            # 检查防火墙
            telnet localhost 3306

            # 检查数据库驱动
            // build.gradle
            dependencies {
                runtimeOnly("mysql:mysql-connector-java:8.0.33")
            }

            # 启用SQL日志
            // application.yml
            jpa:
              default:
                properties:
                  hibernate:
                    show_sql: true
                    format_sql: true

            logger:
              levels:
                org.hibernate.SQL: DEBUG
                org.hibernate.type.descriptor.sql.BasicBinder: TRACE
            ---
    b.事务问题
        a.问题描述
            数据未正确提交或回滚。
        b.解决方案
            ---
            # 确保使用@Transactional注解
            @Service
            public class OrderService {

                @Transactional
                public Order createOrder(Order order) {
                    return orderRepository.save(order);
                }

                @Transactional(readOnly = true)
                public Order findById(Long id) {
                    return orderRepository.findById(id).orElseThrow();
                }
            }

            # 检查事务传播
            @Transactional(propagation = Propagation.REQUIRES_NEW)
            public void independentOperation() {
                // 独立事务
            }

            # 异常回滚配置
            @Transactional(rollbackFor = Exception.class)
            public void riskyOperation() throws Exception {
                // 所有��常都回滚
            }

            # 手动事务管理
            @Inject
            private TransactionOperations<Connection> transactionManager;

            public void manualTransaction() {
                transactionManager.executeWrite(status -> {
                    // 事务操作
                    return null;
                });
            }
            ---

03.性能问题
    a.响应慢
        a.问题描述
            API响应时间过长。
        b.解决方案
            ---
            # 启用请求日志
            // application.yml
            logger:
              levels:
                io.micronaut.http.server: DEBUG

            # 添加性能监控
            import io.micrometer.core.instrument.Timer;

            @Controller("/orders")
            public class OrderController {

                @Inject
                private MeterRegistry registry;

                @Get("/{id}")
                public Order getOrder(Long id) {
                    Timer.Sample sample = Timer.start(registry);

                    try {
                        return orderService.findById(id);
                    } finally {
                        sample.stop(registry.timer("order.get.time"));
                    }
                }
            }

            # 检查数据库查询
            // 启用慢查询日志
            jpa:
              default:
                properties:
                  hibernate:
                    generate_statistics: true

            # 添加数据库索引
            @Entity
            @Table(indexes = {
                @Index(name = "idx_user_id", columnList = "user_id"),
                @Index(name = "idx_status", columnList = "status")
            })
            public class Order {
                // ...
            }

            # 使用缓存
            @Cacheable("orders")
            public Order findById(Long id) {
                return orderRepository.findById(id).orElseThrow();
            }
            ---
    b.内存泄漏
        a.问题描述
            应用内存持续增长,最终OOM。
        b.解决方案
            ---
            # 生成堆转储
            jmap -dump:live,format=b,file=heap.bin <pid>

            # 分析堆转储
            # 使用Eclipse MAT或VisualVM

            # 启用GC日志
            java -Xlog:gc*:file=gc.log:time,uptime,level,tags \
                 -jar app.jar

            # 检查资源泄漏
            @Service
            public class FileService {

                public void processFile(String path) {
                    // 使用try-with-resources
                    try (InputStream is = new FileInputStream(path)) {
                        // 处理文件
                    } catch (IOException e) {
                        LOG.error("Failed to process file", e);
                    }
                }
            }

            # 检查线程池
            @Inject
            @Named("io")
            private ExecutorService executor;

            @PreDestroy
            public void cleanup() {
                executor.shutdown();
            }
            ---

04.网络问题
    a.服务调用失败
        a.问题描述
            微服务间调用失败或超时。
        b.解决方案
            ---
            # 检查服务发现
            @Client("inventory-service")
            public interface InventoryClient {
                @Get("/inventory/{id}")
                Inventory getInventory(Long id);
            }

            # 配置超时
            // application.yml
            micronaut:
              http:
                client:
                  read-timeout: 30s
                  connect-timeout: 10s

            # 添加重试
            // build.gradle
            dependencies {
                implementation("io.micronaut.retry:micronaut-retry")
            }

            @Retryable(attempts = "3", delay = "1s")
            public Inventory getInventory(Long id) {
                return inventoryClient.getInventory(id);
            }

            # 添加熔断器
            @CircuitBreaker(name = "inventory-service")
            public Inventory getInventory(Long id) {
                return inventoryClient.getInventory(id);
            }

            # 检查网络连通性
            curl http://inventory-service:8080/health
            ping inventory-service
            ---
    b.负载均衡问题
        a.问题描述
            请求未均匀分配到服务实例。
        b.解决方案
            ---
            # 检查服务注册
            curl http://consul:8500/v1/catalog/service/order-service

            # 配置负载均衡策略
            // application.yml
            micronaut:
              http:
                client:
                  load-balancer:
                    strategy: round-robin  # 或 random

            # 健康检查配置
            consul:
              client:
                registration:
                  check:
                    enabled: true
                    interval: 10s
                    http: true
                    path: /health

            # 查看负载均衡日志
            logger:
              levels:
                io.micronaut.http.client.loadbalance: DEBUG
            ---

05.配置问题
    a.配置不生效
        a.问题描述
            修改配置后应用行为未改变。
        b.解决方案
            ---
            # 检查配置文件位置
            src/main/resources/application.yml
            src/main/resources/application-{env}.yml

            # 检查环境变量
            export MICRONAUT_ENVIRONMENTS=prod
            java -jar app.jar

            # 或使用系统属性
            java -Dmicronaut.environments=prod -jar app.jar

            # 查看生效的配置
            @Inject
            private Environment environment;

            public void printConfig() {
                environment.getPropertySources().forEach(source -> {
                    LOG.info("Config source: {}", source.getName());
                });
            }

            # 配置优先级
            # 1. 命令行参数
            # 2. 系统属性
            # 3. 环境变量
            # 4. 配置中心
            # 5. application.yml
            ---
    b.配置验证失败
        a.问题描述
            启动时提示配置验证错误。
        b.解决方案
            ---
            # 检查配置类
            @ConfigurationProperties("app")
            public class AppConfig {

                @NotBlank
                private String name;

                @Min(1)
                private int maxConnections;

                // Getters and Setters
            }

            # 提供正确的配置
            // application.yml
            app:
              name: "order-service"
              max-connections: 10

            # 禁用验证(不推荐)
            @ConfigurationProperties(value = "app", validate = false)
            public class AppConfig {
                // ...
            }
            ---

06.日志问题
    a.日志未输出
        a.问题描述
            应用日志未正常输出。
        b.解决方案
            ---
            # 检查logback配置
            // src/main/resources/logback.xml
            <configuration>
                <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                    <encoder>
                        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
                    </encoder>
                </appender>

                <root level="INFO">
                    <appender-ref ref="STDOUT"/>
                </root>
            </configuration>

            # 检查日志级别
            // application.yml
            logger:
              levels:
                com.example: DEBUG
                io.micronaut: INFO

            # 使用正确的Logger
            import org.slf4j.Logger;
            import org.slf4j.LoggerFactory;

            private static final Logger LOG = LoggerFactory.getLogger(OrderService.class);

            # 检查依赖
            // build.gradle
            dependencies {
                runtimeOnly("ch.qos.logback:logback-classic")
            }
            ---
    b.日志文件过大
        a.问题描述
            日志文件占用大量磁盘空间。
        b.解决方案
            ---
            # 配置日志滚动
            <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <file>logs/application.log</file>
                <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
                    <fileNamePattern>logs/application-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
                    <maxFileSize>100MB</maxFileSize>
                    <maxHistory>30</maxHistory>
                    <totalSizeCap>10GB</totalSizeCap>
                </rollingPolicy>
                <encoder>
                    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
                </encoder>
            </appender>

            # 调整日志级别
            logger:
              levels:
                root: WARN
                com.example: INFO

            # 使用异步日志
            <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
                <appender-ref ref="FILE"/>
                <queueSize>512</queueSize>
            </appender>
            ---

'+_e+"");let bn=$e?$e.createHTML(_e):_e;if(Ul===Qi)try{at=new U().parseFromString(bn,ih)}catch{}if(!at||!at.documentElement){at=qe.createDocument(Ul,"template",null);try{at.documentElement.innerHTML=_f?Ce:bn}catch{}}let ka=at.body||at.documentElement;return _e&&It&&ka.insertBefore(Oe.createTextNode(It),ka.childNodes[0]||null),Ul===Qi?ft.call(at,yn?"html":"body")[0]:yn?at.documentElement:ka},QO=function(_e){return lt.call(_e.ownerDocument||_e,_e,de.SHOW_ELEMENT|de.SHOW_COMMENT|de.SHOW_TEXT|de.SHOW_PROCESSING_INSTRUCTION|de.SHOW_CDATA_SECTION,null)},JO=function(_e){return _e instanceof he&&(typeof _e.nodeName!="string"||typeof _e.textContent!="string"||typeof _e.removeChild!="function"||!(_e.attributes instanceof ie)||typeof _e.removeAttribute!="function"||typeof _e.setAttribute!="function"||typeof _e.namespaceURI!="string"||typeof _e.insertBefore!="function"||typeof _e.hasChildNodes!="function")},eP=function(_e){return typeof xe=="function"&&_e instanceof xe},Yc=function(_e,at,It){st[_e]&&h(st[_e],bn=>{bn.call(Ee,at,It,bi)})},tP=function(_e){let at=null;if(Yc("beforeSanitizeElements",_e,null),JO(_e))return Wl(_e),!0;let It=xn(_e.nodeName);if(Yc("uponSanitizeElement",_e,{tagName:It,allowedTags:tt}),_e.hasChildNodes()&&!eP(_e.firstElementChild)&&_(/<[/\w]/g,_e.innerHTML)&&_(/<[/\w]/g,_e.textContent)||_e.nodeType===ue.progressingInstruction||Fa&&_e.nodeType===ue.comment&&_(/<[/\w]/g,_e.data))return Wl(_e),!0;if(!tt[It]||en[It]){if(!en[It]&&nP(It)&&(Jt.tagNameCheck instanceof RegExp&&_(Jt.tagNameCheck,It)||Jt.tagNameCheck instanceof Function&&Jt.tagNameCheck(It)))return!1;if(yt&&!me[It]){let bn=ge(_e)||_e.parentNode,ka=Fe(_e)||_e.childNodes;if(ka&&bn){let ea=ka.length;for(let ls=ea-1;ls>=0;--ls){let Hl=ye(ka[ls],!0);Hl.__removalCount=(_e.__removalCount||0)+1,bn.insertBefore(Hl,Ge(_e))}}}return Wl(_e),!0}return _e instanceof q&&!$a(_e)||(It==="noscript"||It==="noembed"||It==="noframes")&&_(/<\/no(script|embed|frames)/i,_e.innerHTML)?(Wl(_e),!0):(xi&&_e.nodeType===ue.text&&(at=_e.textContent,h([Ue,Ke,it],bn=>{at=y(at,bn," ")}),_e.textContent!==at&&(d(Ee.removed,{element:_e.cloneNode()}),_e.textContent=at)),Yc("afterSanitizeElements",_e,null),!1)},rP=function(_e,at,It){if(Rt&&(at==="id"||at==="name")&&(It in Oe||It in KO))return!1;if(!(cn&&!Cr[at]&&_(mt,at))){if(!(Kn&&_(Ht,at))){if(!ur[at]||Cr[at]){if(!(nP(_e)&&(Jt.tagNameCheck instanceof RegExp&&_(Jt.tagNameCheck,_e)||Jt.tagNameCheck instanceof Function&&Jt.tagNameCheck(_e))&&(Jt.attributeNameCheck instanceof RegExp&&_(Jt.attributeNameCheck,at)||Jt.attributeNameCheck instanceof Function&&Jt.attributeNameCheck(at))||at==="is"&&Jt.allowCustomizedBuiltInElements&&(Jt.tagNameCheck instanceof RegExp&&_(Jt.tagNameCheck,It)||Jt.tagNameCheck instanceof Function&&Jt.tagNameCheck(It))))return!1}else if(!m1[at]){if(!_(bt,y(It,et,""))){if(!((at==="src"||at==="xlink:href"||at==="href")&&_e!=="script"&&x(It,"data:")===0&&p1[_e])){if(!(Rn&&!_(ot,y(It,et,"")))){if(It)return!1}}}}}}return!0},nP=function(_e){return _e!=="annotation-xml"&&m(_e,ht)},iP=function(_e){Yc("beforeSanitizeAttributes",_e,null);let{attributes:at}=_e;if(!at)return;let It={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ur},bn=at.length;for(;bn--;){let ka=at[bn],{name:ea,namespaceURI:ls,value:Hl}=ka,b1=xn(ea),Ga=ea==="value"?Hl:b(Hl);if(It.attrName=b1,It.attrValue=Ga,It.keepAttr=!0,It.forceKeepAttr=void 0,Yc("uponSanitizeAttribute",_e,It),Ga=It.attrValue,Fa&&_(/((--!?|])>)|<\/(style|title)/i,Ga)){rb(ea,_e);continue}if(It.forceKeepAttr||(rb(ea,_e),!It.keepAttr))continue;if(!Vr&&_(/\/>/i,Ga)){rb(ea,_e);continue}xi&&h([Ue,Ke,it],sP=>{Ga=y(Ga,sP," ")});let aP=xn(_e.nodeName);if(rP(aP,b1,Ga)){if(wt&&(b1==="id"||b1==="name")&&(rb(ea,_e),Ga=He+Ga),$e&&typeof ke=="object"&&typeof ke.getAttributeType=="function"&&!ls)switch(ke.getAttributeType(aP,b1)){case"TrustedHTML":{Ga=$e.createHTML(Ga);break}case"TrustedScriptURL":{Ga=$e.createScriptURL(Ga);break}}try{ls?_e.setAttributeNS(ls,ea,Ga):_e.setAttribute(ea,Ga),JO(_e)?Wl(_e):f(Ee.removed)}catch{}}}Yc("afterSanitizeAttributes",_e,null)},Pme=function Gt(_e){let at=null,It=QO(_e);for(Yc("beforeSanitizeShadowDOM",_e,null);at=It.nextNode();)Yc("uponSanitizeShadowNode",at,null),!tP(at)&&(at.content instanceof Re&&Gt(at.content),iP(at));Yc("afterSanitizeShadowDOM",_e,null)};return Ee.sanitize=function(Gt){let _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},at=null,It=null,bn=null,ka=null;if(_f=!Gt,_f&&(Gt=""),typeof Gt!="string"&&!eP(Gt))if(typeof Gt.toString=="function"){if(Gt=Gt.toString(),typeof Gt!="string")throw k("dirty is not a string, aborting")}else throw k("toString is not a function");if(!Ee.isSupported)return Gt;if(os||Vl(_e),Ee.removed=[],typeof Gt=="string"&&(fe=!1),fe){if(Gt.nodeName){let Hl=xn(Gt.nodeName);if(!tt[Hl]||en[Hl])throw k("root node is forbidden and cannot be sanitized in-place")}}else if(Gt instanceof xe)at=ZO(""),It=at.ownerDocument.importNode(Gt,!0),It.nodeType===ue.element&&It.nodeName==="BODY"||It.nodeName==="HTML"?at=It:at.appendChild(It);else{if(!Zi&&!xi&&!yn&&Gt.indexOf("<")===-1)return $e&&pt?$e.createHTML(Gt):Gt;if(at=ZO(Gt),!at)return Zi?null:pt?Ce:""}at&&fo&&Wl(at.firstChild);let ea=QO(fe?Gt:at);for(;bn=ea.nextNode();)tP(bn)||(bn.content instanceof Re&&Pme(bn.content),iP(bn));if(fe)return Gt;if(Zi){if($i)for(ka=xt.call(at.ownerDocument);at.firstChild;)ka.appendChild(at.firstChild);else ka=at;return(ur.shadowroot||ur.shadowrootmode)&&(ka=Ze.call(De,ka,!0)),ka}let ls=yn?at.outerHTML:at.innerHTML;return yn&&tt["!doctype"]&&at.ownerDocument&&at.ownerDocument.doctype&&at.ownerDocument.doctype.name&&_(Z,at.ownerDocument.doctype.name)&&(ls=" `+ls),xi&&h([Ue,Ke,it],Hl=>{ls=y(ls,Hl," ")}),$e&&pt?$e.createHTML(ls):ls},Ee.setConfig=function(){let Gt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Vl(Gt),os=!0},Ee.clearConfig=function(){bi=null,os=!1},Ee.isValidAttribute=function(Gt,_e,at){bi||Vl({});let It=xn(Gt),bn=xn(_e);return rP(It,bn,at)},Ee.addHook=function(Gt,_e){typeof _e=="function"&&(st[Gt]=st[Gt]||[],d(st[Gt],_e))},Ee.removeHook=function(Gt){if(st[Gt])return f(st[Gt])},Ee.removeHooks=function(Gt){st[Gt]&&(st[Gt]=[])},Ee.removeAllHooks=function(){st={}},Ee}var we=ae();return we})});var cF={};vr(cF,{default:()=>Qve});function h1e(t){return String(t).replace(u1e,e=>c1e[e])}function g1e(t){if(t.default)return t.default;var e=t.type,r=Array.isArray(e)?e[0]:e;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function k1e(t){for(var e=0;e=i[0]&&t<=i[1])return r.name}return null}function gB(t){for(var e=0;e=wb[e]&&t<=wb[e+1])return!0;return!1}function M1e(t,e){jl[t]=e}function dS(t,e,r){if(!jl[e])throw new Error("Font metrics not found for font: "+e+".");var n=t.charCodeAt(0),i=jl[e][n];if(!i&&t[0]in FP&&(n=FP[t[0]].charCodeAt(0),i=jl[e][n]),!i&&r==="text"&&gB(n)&&(i=jl[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}function D1e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!UE[e]){var r=UE[e]={cssEmPerMu:cb.quad[e]/18};for(var n in cb)cb.hasOwnProperty(n)&&(r[n]=cb[n][e])}return UE[e]}function GP(t){if(t instanceof hs)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function F1e(t){if(t instanceof Of)return t;throw new Error("Expected span but got "+String(t)+".")}function G(t,e,r,n,i,a){wn[t][i]={font:e,group:r,replace:n},a&&n&&(wn[t][n]=wn[t][i])}function vt(t){for(var{type:e,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=t,o={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0?!0:n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:i},l=0;l0&&(a.push(mb(s,e)),s=[]),a.push(n[o]));s.length>0&&a.push(mb(s,e));var u;r?(u=mb(Ti(r,e,!0)),u.classes=["tag"],a.push(u)):i&&a.push(i);var h=eu(["katex-html"],a);if(h.setAttribute("aria-hidden","true"),u){var f=u.children[0];f.style.height=ut(h.height+h.depth),h.depth&&(f.style.verticalAlign=ut(-h.depth))}return h}function AB(t){return new Df(t)}function qP(t,e,r,n,i){var a=fs(t,r),s;a.length===1&&a[0]instanceof us&&qt.contains(["mrow","mtable"],a[0].type)?s=a[0]:s=new rt.MathNode("mrow",a);var o=new rt.MathNode("annotation",[new rt.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var l=new rt.MathNode("semantics",[s,o]),u=new rt.MathNode("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),n&&u.setAttribute("display","block");var h=i?"katex":"katex-mathml";return Be.makeSpan([h],[u])}function hr(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function vS(t){var e=Ib(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function Ib(t){return t&&(t.type==="atom"||$1e.hasOwnProperty(t.type))?t:null}function NB(t,e){var r=Ti(t.body,e,!0);return mve([t.mclass],r,e)}function IB(t,e){var r,n=fs(t.body,e);return t.mclass==="minner"?r=new rt.MathNode("mpadded",n):t.mclass==="mord"?t.isCharacterBox?(r=n[0],r.type="mi"):r=new rt.MathNode("mi",n):(t.isCharacterBox?(r=n[0],r.type="mo"):r=new rt.MathNode("mo",n),t.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):t.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):t.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}function xve(t,e,r){var n=vve[t];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=r.callFunction("\\\\cdleft",[e[0]],[]),a={type:"atom",text:n,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),o=r.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,s,o]};return r.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function bve(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var r=t.fetch().text;if(r==="&"||r==="\\\\")t.consume();else if(r==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new nt("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var n=[],i=[n],a=0;a-1))if("<>AV".indexOf(u)>-1)for(var f=0;f<2;f++){for(var d=!0,p=l+1;pAV=|." after @',s[l]);var g=xve(u,h,t),m={type:"styling",body:[g],mode:"math",style:"display"};n.push(m),o=YP()}a%2===0?n.push(o):n.shift(),n=[],i.push(n)}t.gullet.endGroup(),t.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}function Db(t,e){var r=Ib(t);if(r&&qt.contains(Mve,r.text))return r;throw r?new nt("Invalid delimiter '"+r.text+"' after '"+e.funcName+"'",t):new nt("Invalid delimiter type '"+t.type+"'",t)}function KP(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function Zl(t){for(var{type:e,names:r,props:n,handler:i,htmlBuilder:a,mathmlBuilder:s}=t,o={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l1||!h)&&m.pop(),x.length{Gs=class t{constructor(e,r,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=r,this.end=n}static range(e,r){return r?!e||!e.loc||!r.loc||e.loc.lexer!==r.loc.lexer?null:new t(e.loc.lexer,e.loc.start,r.loc.end):e&&e.loc}},vo=class t{constructor(e,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=r}range(e,r){return new t(r,Gs.range(this,e))}},nt=class t{constructor(e,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n="KaTeX parse error: "+e,i,a,s=r&&r.loc;if(s&&s.start<=s.end){var o=s.lexer.input;i=s.start,a=s.end,i===o.length?n+=" at end of input: ":n+=" at position "+(i+1)+": ";var l=o.slice(i,a).replace(/[^]/g,"$&\u0332"),u;i>15?u="\u2026"+o.slice(i-15,i):u=o.slice(0,i);var h;a+15":">","<":"<",'"':""","'":"'"},u1e=/[&><"']/g;pB=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},f1e=function(e){var r=pB(e);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},d1e=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},p1e=function(e){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},qt={contains:a1e,deflt:s1e,escape:h1e,hyphenate:l1e,getBaseElem:pB,isCharacterBox:f1e,protocolFromUrl:p1e},bb={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};R1=class{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var r in bb)if(bb.hasOwnProperty(r)){var n=bb[r];this[r]=e[r]!==void 0?n.processor?n.processor(e[r]):e[r]:g1e(n)}}reportNonstrict(e,r,n){var i=this.strict;if(typeof i=="function"&&(i=i(e,r,n)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new nt("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+e+"]"),n);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+e+"]"))}}useStrictBehavior(e,r,n){var i=this.strict;if(typeof i=="function")try{i=i(e,r,n)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+r+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var r=qt.protocolFromUrl(e.url);if(r==null)return!1;e.protocol=r}var n=typeof this.trust=="function"?this.trust(e):this.trust;return!!n}},Yl=class{constructor(e,r,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=r,this.cramped=n}sup(){return Xl[m1e[this.id]]}sub(){return Xl[v1e[this.id]]}fracNum(){return Xl[y1e[this.id]]}fracDen(){return Xl[x1e[this.id]]}cramp(){return Xl[b1e[this.id]]}text(){return Xl[w1e[this.id]]}isTight(){return this.size>=2}},fS=0,kb=1,Y0=2,Qc=3,N1=4,mo=5,X0=6,Ua=7,Xl=[new Yl(fS,0,!1),new Yl(kb,0,!0),new Yl(Y0,1,!1),new Yl(Qc,1,!0),new Yl(N1,2,!1),new Yl(mo,2,!0),new Yl(X0,3,!1),new Yl(Ua,3,!0)],m1e=[N1,mo,N1,mo,X0,Ua,X0,Ua],v1e=[mo,mo,mo,mo,Ua,Ua,Ua,Ua],y1e=[Y0,Qc,N1,mo,X0,Ua,X0,Ua],x1e=[Qc,Qc,mo,mo,Ua,Ua,Ua,Ua],b1e=[kb,kb,Qc,Qc,mo,mo,Ua,Ua],w1e=[fS,kb,Y0,Qc,Y0,Qc,Y0,Qc],Xt={DISPLAY:Xl[fS],TEXT:Xl[Y0],SCRIPT:Xl[N1],SCRIPTSCRIPT:Xl[X0]},eS=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];wb=[];eS.forEach(t=>t.blocks.forEach(e=>wb.push(...e)));q0=80,T1e=function(e,r){return"M95,"+(622+e+r)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 c69,-144,104.5,-217.7,106.5,-221 l`+e/2.075+" -"+e+` c5.3,-9.3,12,-14,20,-14 H400000v`+(40+e)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z M`+(834+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},E1e=function(e,r){return"M263,"+(601+e+r)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+e/2.084+" -"+e+` c4.7,-7.3,11,-11,19,-11 H40000v`+(40+e)+`H1012.3 s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},S1e=function(e,r){return"M983 "+(10+e+r)+` l`+e/3.13+" -"+e+` c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z M`+(1001+e)+" "+r+"h400000v"+(40+e)+"h-400000z"},C1e=function(e,r){return"M424,"+(2398+e+r)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000 v`+(40+e)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+r+` h400000v`+(40+e)+"h-400000z"},A1e=function(e,r){return"M473,"+(2713+e+r)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, 606zM`+(1001+e)+" "+r+"h400000v"+(40+e)+"H1017.7z"},_1e=function(e){var r=e/2;return"M400000 "+e+" H0 L"+r+" 0 l65 45 L145 "+(e-80)+" H400000z"},L1e=function(e,r,n){var i=n-54-r-e;return"M702 "+(e+r)+"H400000"+(40+e)+` H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 219 661 l218 661zM702 `+r+"H400000v"+(40+e)+"H742z"},R1e=function(e,r,n){r=1e3*r;var i="";switch(e){case"sqrtMain":i=T1e(r,q0);break;case"sqrtSize1":i=E1e(r,q0);break;case"sqrtSize2":i=S1e(r,q0);break;case"sqrtSize3":i=C1e(r,q0);break;case"sqrtSize4":i=A1e(r,q0);break;case"sqrtTall":i=L1e(r,q0,n)}return i},N1e=function(e,r){switch(e){case"\u239C":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"\u2223":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"\u2225":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"\u239F":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"\u23A2":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"\u23A5":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"\u23AA":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"\u23D0":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"\u2016":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},BP={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 435 0h399565z`,leftgroupunder:`M400000 262 H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},I1e=function(e,r){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+" v585 h43z";case"doublevert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+` v585 h43z M367 15 v585 v`+r+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+r+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+r+` v1715 h263 v84 H319z MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+r+` v1799 H0 v-84 H319z MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v602 h84z M403 1759 V0 H319 V1759 v`+r+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v602 h84z M347 1759 V0 h-84 V1759 v`+r+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, -36,557 l0,`+(r+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 l0,-`+(r+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(r+9)+` c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}},Df=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return qt.contains(this.classes,e)}toNode(){for(var e=document.createDocumentFragment(),r=0;rr.toText();return this.children.map(e).join("")}},jl={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},cb={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},FP={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};UE={};O1e=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],zP=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],$P=function(e,r){return r.size<2?e:O1e[e-1][r.size-1]},Tb=class t{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||t.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=zP[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return new t(r)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:$P(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:zP[e-1]})}havingBaseStyle(e){e=e||this.style.text();var r=$P(t.BASESIZE,e);return this.size===r&&this.textSize===t.BASESIZE&&this.style===e?this:this.extend({style:e,size:r})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==t.BASESIZE?["sizing","reset-size"+this.size,"size"+t.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=D1e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};Tb.BASESIZE=6;tS={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},P1e={ex:!0,em:!0,mu:!0},mB=function(e){return typeof e!="string"&&(e=e.unit),e in tS||e in P1e||e==="ex"},Wn=function(e,r){var n;if(e.unit in tS)n=tS[e.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(e.unit==="mu")n=r.fontMetrics().cssEmPerMu;else{var i;if(r.style.isTight()?i=r.havingStyle(r.style.text()):i=r,e.unit==="ex")n=i.fontMetrics().xHeight;else if(e.unit==="em")n=i.fontMetrics().quad;else throw new nt("Invalid unit: '"+e.unit+"'");i!==r&&(n*=i.sizeMultiplier/r.sizeMultiplier)}return Math.min(e.number*n,r.maxSize)},ut=function(e){return+e.toFixed(4)+"em"},lh=function(e){return e.filter(r=>r).join(" ")},vB=function(e,r,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},r){r.style.isTight()&&this.classes.push("mtight");var i=r.getColor();i&&(this.style.color=i)}},yB=function(e){var r=document.createElement(e);r.className=lh(this.classes);for(var n in this.style)this.style.hasOwnProperty(n)&&(r.style[n]=this.style[n]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&r.setAttribute(i,this.attributes[i]);for(var a=0;a",r},Of=class{constructor(e,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,vB.call(this,e,n,i),this.children=r||[]}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return qt.contains(this.classes,e)}toNode(){return yB.call(this,"span")}toMarkup(){return xB.call(this,"span")}},I1=class{constructor(e,r,n,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,vB.call(this,r,i),this.children=n||[],this.setAttribute("href",e)}setAttribute(e,r){this.attributes[e]=r}hasClass(e){return qt.contains(this.classes,e)}toNode(){return yB.call(this,"a")}toMarkup(){return xB.call(this,"a")}},rS=class{constructor(e,r,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=e,this.classes=["mord"],this.style=n}hasClass(e){return qt.contains(this.classes,e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(e.style[r]=this.style[r]);return e}toMarkup(){var e=''+qt.escape(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=ut(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=lh(this.classes));for(var n in this.style)this.style.hasOwnProperty(n)&&(r=r||document.createElement("span"),r.style[n]=this.style[n]);return r?(r.appendChild(e),r):e}toMarkup(){var e=!1,r="0&&(n+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(n+=qt.hyphenate(i)+":"+this.style[i]+";");n&&(e=!0,r+=' style="'+qt.escape(n)+'"');var a=qt.escape(this.text);return e?(r+=">",r+=a,r+="",r):a}},nl=class{constructor(e,r){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=r||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"svg");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);for(var i=0;i':''}},M1=class{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",r=document.createElementNS(e,"line");for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&r.setAttribute(n,this.attributes[n]);return r}toMarkup(){var e="","\\gt",!0);G(V,ne,be,"\u2208","\\in",!0);G(V,ne,be,"\uE020","\\@not");G(V,ne,be,"\u2282","\\subset",!0);G(V,ne,be,"\u2283","\\supset",!0);G(V,ne,be,"\u2286","\\subseteq",!0);G(V,ne,be,"\u2287","\\supseteq",!0);G(V,ve,be,"\u2288","\\nsubseteq",!0);G(V,ve,be,"\u2289","\\nsupseteq",!0);G(V,ne,be,"\u22A8","\\models");G(V,ne,be,"\u2190","\\leftarrow",!0);G(V,ne,be,"\u2264","\\le");G(V,ne,be,"\u2264","\\leq",!0);G(V,ne,be,"<","\\lt",!0);G(V,ne,be,"\u2192","\\rightarrow",!0);G(V,ne,be,"\u2192","\\to");G(V,ve,be,"\u2271","\\ngeq",!0);G(V,ve,be,"\u2270","\\nleq",!0);G(V,ne,ru,"\xA0","\\ ");G(V,ne,ru,"\xA0","\\space");G(V,ne,ru,"\xA0","\\nobreakspace");G(Je,ne,ru,"\xA0","\\ ");G(Je,ne,ru,"\xA0"," ");G(Je,ne,ru,"\xA0","\\space");G(Je,ne,ru,"\xA0","\\nobreakspace");G(V,ne,ru,null,"\\nobreak");G(V,ne,ru,null,"\\allowbreak");G(V,ne,Rb,",",",");G(V,ne,Rb,";",";");G(V,ve,Tt,"\u22BC","\\barwedge",!0);G(V,ve,Tt,"\u22BB","\\veebar",!0);G(V,ne,Tt,"\u2299","\\odot",!0);G(V,ne,Tt,"\u2295","\\oplus",!0);G(V,ne,Tt,"\u2297","\\otimes",!0);G(V,ne,Se,"\u2202","\\partial",!0);G(V,ne,Tt,"\u2298","\\oslash",!0);G(V,ve,Tt,"\u229A","\\circledcirc",!0);G(V,ve,Tt,"\u22A1","\\boxdot",!0);G(V,ne,Tt,"\u25B3","\\bigtriangleup");G(V,ne,Tt,"\u25BD","\\bigtriangledown");G(V,ne,Tt,"\u2020","\\dagger");G(V,ne,Tt,"\u22C4","\\diamond");G(V,ne,Tt,"\u22C6","\\star");G(V,ne,Tt,"\u25C3","\\triangleleft");G(V,ne,Tt,"\u25B9","\\triangleright");G(V,ne,Us,"{","\\{");G(Je,ne,Se,"{","\\{");G(Je,ne,Se,"{","\\textbraceleft");G(V,ne,Va,"}","\\}");G(Je,ne,Se,"}","\\}");G(Je,ne,Se,"}","\\textbraceright");G(V,ne,Us,"{","\\lbrace");G(V,ne,Va,"}","\\rbrace");G(V,ne,Us,"[","\\lbrack",!0);G(Je,ne,Se,"[","\\lbrack",!0);G(V,ne,Va,"]","\\rbrack",!0);G(Je,ne,Se,"]","\\rbrack",!0);G(V,ne,Us,"(","\\lparen",!0);G(V,ne,Va,")","\\rparen",!0);G(Je,ne,Se,"<","\\textless",!0);G(Je,ne,Se,">","\\textgreater",!0);G(V,ne,Us,"\u230A","\\lfloor",!0);G(V,ne,Va,"\u230B","\\rfloor",!0);G(V,ne,Us,"\u2308","\\lceil",!0);G(V,ne,Va,"\u2309","\\rceil",!0);G(V,ne,Se,"\\","\\backslash");G(V,ne,Se,"\u2223","|");G(V,ne,Se,"\u2223","\\vert");G(Je,ne,Se,"|","\\textbar",!0);G(V,ne,Se,"\u2225","\\|");G(V,ne,Se,"\u2225","\\Vert");G(Je,ne,Se,"\u2225","\\textbardbl");G(Je,ne,Se,"~","\\textasciitilde");G(Je,ne,Se,"\\","\\textbackslash");G(Je,ne,Se,"^","\\textasciicircum");G(V,ne,be,"\u2191","\\uparrow",!0);G(V,ne,be,"\u21D1","\\Uparrow",!0);G(V,ne,be,"\u2193","\\downarrow",!0);G(V,ne,be,"\u21D3","\\Downarrow",!0);G(V,ne,be,"\u2195","\\updownarrow",!0);G(V,ne,be,"\u21D5","\\Updownarrow",!0);G(V,ne,pi,"\u2210","\\coprod");G(V,ne,pi,"\u22C1","\\bigvee");G(V,ne,pi,"\u22C0","\\bigwedge");G(V,ne,pi,"\u2A04","\\biguplus");G(V,ne,pi,"\u22C2","\\bigcap");G(V,ne,pi,"\u22C3","\\bigcup");G(V,ne,pi,"\u222B","\\int");G(V,ne,pi,"\u222B","\\intop");G(V,ne,pi,"\u222C","\\iint");G(V,ne,pi,"\u222D","\\iiint");G(V,ne,pi,"\u220F","\\prod");G(V,ne,pi,"\u2211","\\sum");G(V,ne,pi,"\u2A02","\\bigotimes");G(V,ne,pi,"\u2A01","\\bigoplus");G(V,ne,pi,"\u2A00","\\bigodot");G(V,ne,pi,"\u222E","\\oint");G(V,ne,pi,"\u222F","\\oiint");G(V,ne,pi,"\u2230","\\oiiint");G(V,ne,pi,"\u2A06","\\bigsqcup");G(V,ne,pi,"\u222B","\\smallint");G(Je,ne,j0,"\u2026","\\textellipsis");G(V,ne,j0,"\u2026","\\mathellipsis");G(Je,ne,j0,"\u2026","\\ldots",!0);G(V,ne,j0,"\u2026","\\ldots",!0);G(V,ne,j0,"\u22EF","\\@cdots",!0);G(V,ne,j0,"\u22F1","\\ddots",!0);G(V,ne,Se,"\u22EE","\\varvdots");G(V,ne,Mn,"\u02CA","\\acute");G(V,ne,Mn,"\u02CB","\\grave");G(V,ne,Mn,"\xA8","\\ddot");G(V,ne,Mn,"~","\\tilde");G(V,ne,Mn,"\u02C9","\\bar");G(V,ne,Mn,"\u02D8","\\breve");G(V,ne,Mn,"\u02C7","\\check");G(V,ne,Mn,"^","\\hat");G(V,ne,Mn,"\u20D7","\\vec");G(V,ne,Mn,"\u02D9","\\dot");G(V,ne,Mn,"\u02DA","\\mathring");G(V,ne,Yt,"\uE131","\\@imath");G(V,ne,Yt,"\uE237","\\@jmath");G(V,ne,Se,"\u0131","\u0131");G(V,ne,Se,"\u0237","\u0237");G(Je,ne,Se,"\u0131","\\i",!0);G(Je,ne,Se,"\u0237","\\j",!0);G(Je,ne,Se,"\xDF","\\ss",!0);G(Je,ne,Se,"\xE6","\\ae",!0);G(Je,ne,Se,"\u0153","\\oe",!0);G(Je,ne,Se,"\xF8","\\o",!0);G(Je,ne,Se,"\xC6","\\AE",!0);G(Je,ne,Se,"\u0152","\\OE",!0);G(Je,ne,Se,"\xD8","\\O",!0);G(Je,ne,Mn,"\u02CA","\\'");G(Je,ne,Mn,"\u02CB","\\`");G(Je,ne,Mn,"\u02C6","\\^");G(Je,ne,Mn,"\u02DC","\\~");G(Je,ne,Mn,"\u02C9","\\=");G(Je,ne,Mn,"\u02D8","\\u");G(Je,ne,Mn,"\u02D9","\\.");G(Je,ne,Mn,"\xB8","\\c");G(Je,ne,Mn,"\u02DA","\\r");G(Je,ne,Mn,"\u02C7","\\v");G(Je,ne,Mn,"\xA8",'\\"');G(Je,ne,Mn,"\u02DD","\\H");G(Je,ne,Mn,"\u25EF","\\textcircled");bB={"--":!0,"---":!0,"``":!0,"''":!0};G(Je,ne,Se,"\u2013","--",!0);G(Je,ne,Se,"\u2013","\\textendash");G(Je,ne,Se,"\u2014","---",!0);G(Je,ne,Se,"\u2014","\\textemdash");G(Je,ne,Se,"\u2018","`",!0);G(Je,ne,Se,"\u2018","\\textquoteleft");G(Je,ne,Se,"\u2019","'",!0);G(Je,ne,Se,"\u2019","\\textquoteright");G(Je,ne,Se,"\u201C","``",!0);G(Je,ne,Se,"\u201C","\\textquotedblleft");G(Je,ne,Se,"\u201D","''",!0);G(Je,ne,Se,"\u201D","\\textquotedblright");G(V,ne,Se,"\xB0","\\degree",!0);G(Je,ne,Se,"\xB0","\\degree");G(Je,ne,Se,"\xB0","\\textdegree",!0);G(V,ne,Se,"\xA3","\\pounds");G(V,ne,Se,"\xA3","\\mathsterling",!0);G(Je,ne,Se,"\xA3","\\pounds");G(Je,ne,Se,"\xA3","\\textsterling",!0);G(V,ve,Se,"\u2720","\\maltese");G(Je,ve,Se,"\u2720","\\maltese");UP='0123456789/@."';for(ub=0;ub0)return rl(a,u,i,r,s.concat(h));if(l){var f,d;if(l==="boldsymbol"){var p=V1e(a,i,r,s,n);f=p.fontName,d=[p.fontClass]}else o?(f=TB[l].fontName,d=[l]):(f=gb(l,r.fontWeight,r.fontShape),d=[l,r.fontWeight,r.fontShape]);if(Nb(a,f,i).metrics)return rl(a,f,i,r,s.concat(d));if(bB.hasOwnProperty(a)&&f.slice(0,10)==="Typewriter"){for(var g=[],m=0;m{if(lh(t.classes)!==lh(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var r=t.classes[0];if(r==="mbin"||r==="mord")return!1}for(var n in t.style)if(t.style.hasOwnProperty(n)&&t.style[n]!==e.style[n])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&t.style[i]!==e.style[i])return!1;return!0},q1e=t=>{for(var e=0;er&&(r=s.height),s.depth>n&&(n=s.depth),s.maxFontSize>i&&(i=s.maxFontSize)}e.height=r,e.depth=n,e.maxFontSize=i},cs=function(e,r,n,i){var a=new Of(e,r,n,i);return pS(a),a},wB=(t,e,r,n)=>new Of(t,e,r,n),Y1e=function(e,r,n){var i=cs([e],[],r);return i.height=Math.max(n||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),i.style.borderBottomWidth=ut(i.height),i.maxFontSize=1,i},X1e=function(e,r,n,i){var a=new I1(e,r,n,i);return pS(a),a},kB=function(e){var r=new Df(e);return pS(r),r},j1e=function(e,r){return e instanceof Df?cs([],[e],r):e},K1e=function(e){if(e.positionType==="individualShift"){for(var r=e.children,n=[r[0]],i=-r[0].shift-r[0].elem.depth,a=i,s=1;s{var r=cs(["mspace"],[],e),n=Wn(t,e);return r.style.marginRight=ut(n),r},gb=function(e,r,n){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var a;return r==="textbf"&&n==="textit"?a="BoldItalic":r==="textbf"?a="Bold":r==="textit"?a="Italic":a="Regular",i+"-"+a},TB={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},EB={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},J1e=function(e,r){var[n,i,a]=EB[e],s=new Kl(n),o=new nl([s],{width:ut(i),height:ut(a),style:"width:"+ut(i),viewBox:"0 0 "+1e3*i+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),l=wB(["overlay"],[o],r);return l.height=a,l.style.height=ut(a),l.style.width=ut(i),l},Be={fontMap:TB,makeSymbol:rl,mathsym:U1e,makeSpan:cs,makeSvgSpan:wB,makeLineSpan:Y1e,makeAnchor:X1e,makeFragment:kB,wrapFragment:j1e,makeVList:Z1e,makeOrd:W1e,makeGlue:Q1e,staticSvg:J1e,svgData:EB,tryCombineChars:q1e},Vn={number:3,unit:"mu"},If={number:4,unit:"mu"},Zc={number:5,unit:"mu"},eve={mord:{mop:Vn,mbin:If,mrel:Zc,minner:Vn},mop:{mord:Vn,mop:Vn,mrel:Zc,minner:Vn},mbin:{mord:If,mop:If,mopen:If,minner:If},mrel:{mord:Zc,mop:Zc,mopen:Zc,minner:Zc},mopen:{},mclose:{mop:Vn,mbin:If,mrel:Zc,minner:Vn},mpunct:{mord:Vn,mop:Vn,mrel:Zc,mopen:Vn,mclose:Vn,mpunct:Vn,minner:Vn},minner:{mord:Vn,mop:Vn,mbin:If,mrel:Zc,mopen:Vn,mpunct:Vn,minner:Vn}},tve={mord:{mop:Vn},mop:{mord:Vn,mop:Vn},mbin:{},mrel:{},mopen:{},mclose:{mop:Vn},mpunct:{},minner:{mop:Vn}},SB={},Sb={},Cb={};Ab=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},si=function(e){return e.type==="ordgroup"?e.body:[e]},eu=Be.makeSpan,rve=["leftmost","mbin","mopen","mrel","mop","mpunct"],nve=["rightmost","mrel","mclose","mpunct"],ive={display:Xt.DISPLAY,text:Xt.TEXT,script:Xt.SCRIPT,scriptscript:Xt.SCRIPTSCRIPT},ave={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Ti=function(e,r,n,i){i===void 0&&(i=[null,null]);for(var a=[],s=0;s{var y=m.classes[0],x=g.classes[0];y==="mbin"&&qt.contains(nve,x)?m.classes[0]="mord":x==="mbin"&&qt.contains(rve,y)&&(g.classes[0]="mord")},{node:f},d,p),HP(a,(g,m)=>{var y=iS(m),x=iS(g),b=y&&x?g.hasClass("mtight")?tve[y][x]:eve[y][x]:null;if(b)return Be.makeGlue(b,u)},{node:f},d,p),a},HP=function t(e,r,n,i,a){i&&e.push(i);for(var s=0;sd=>{e.splice(f+1,0,d),s++})(s)}i&&e.pop()},CB=function(e){return e instanceof Df||e instanceof I1||e instanceof Of&&e.hasClass("enclosing")?e:null},sve=function t(e,r){var n=CB(e);if(n){var i=n.children;if(i.length){if(r==="right")return t(i[i.length-1],"right");if(r==="left")return t(i[0],"left")}}return e},iS=function(e,r){return e?(r&&(e=sve(e,r)),ave[e.classes[0]]||null):null},D1=function(e,r){var n=["nulldelimiter"].concat(e.baseSizingClasses());return eu(r.concat(n))},Ar=function(e,r,n){if(!e)return eu();if(Sb[e.type]){var i=Sb[e.type](e,r);if(n&&r.size!==n.size){i=eu(r.sizingClasses(n),[i],r);var a=r.sizeMultiplier/n.sizeMultiplier;i.height*=a,i.depth*=a}return i}else throw new nt("Got group of unknown type: '"+e.type+"'")};us=class{constructor(e,r,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=r||[],this.classes=n||[]}setAttribute(e,r){this.attributes[e]=r}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&e.setAttribute(r,this.attributes[r]);this.classes.length>0&&(e.className=lh(this.classes));for(var n=0;n0&&(e+=' class ="'+qt.escape(lh(this.classes))+'"'),e+=">";for(var n=0;n",e}toText(){return this.children.map(e=>e.toText()).join("")}},Mf=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return qt.escape(this.toText())}toText(){return this.text}},sS=class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character="\u200A":e>=.1666&&e<=.1667?this.character="\u2009":e>=.2222&&e<=.2223?this.character="\u2005":e>=.2777&&e<=.2778?this.character="\u2005\u200A":e>=-.05556&&e<=-.05555?this.character="\u200A\u2063":e>=-.1667&&e<=-.1666?this.character="\u2009\u2063":e>=-.2223&&e<=-.2222?this.character="\u205F\u2063":e>=-.2778&&e<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",ut(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}},rt={MathNode:us,TextNode:Mf,SpaceNode:sS,newDocumentFragment:AB},yo=function(e,r,n){return wn[r][e]&&wn[r][e].replace&&e.charCodeAt(0)!==55349&&!(bB.hasOwnProperty(e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)==="tt"||n.font&&n.font.slice(4,6)==="tt"))&&(e=wn[r][e].replace),new rt.TextNode(e)},gS=function(e){return e.length===1?e[0]:new rt.MathNode("mrow",e)},mS=function(e,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var n=r.font;if(!n||n==="mathnormal")return null;var i=e.mode;if(n==="mathit")return"italic";if(n==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(n==="mathbf")return"bold";if(n==="mathbb")return"double-struck";if(n==="mathfrak")return"fraktur";if(n==="mathscr"||n==="mathcal")return"script";if(n==="mathsf")return"sans-serif";if(n==="mathtt")return"monospace";var a=e.text;if(qt.contains(["\\imath","\\jmath"],a))return null;wn[i][a]&&wn[i][a].replace&&(a=wn[i][a].replace);var s=Be.fontMap[n].fontName;return dS(a,s,i)?Be.fontMap[n].variant:null},fs=function(e,r,n){if(e.length===1){var i=hn(e[0],r);return n&&i instanceof us&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var a=[],s,o=0;o0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(l),s=l}return a},ch=function(e,r,n){return gS(fs(e,r,n))},hn=function(e,r){if(!e)return new rt.MathNode("mrow");if(Cb[e.type]){var n=Cb[e.type](e,r);return n}else throw new nt("Got group of unknown type: '"+e.type+"'")};_B=function(e){return new Tb({style:e.displayMode?Xt.DISPLAY:Xt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},LB=function(e,r){if(r.displayMode){var n=["katex-display"];r.leqno&&n.push("leqno"),r.fleqn&&n.push("fleqn"),e=Be.makeSpan(n,[e])}return e},ove=function(e,r,n){var i=_B(n),a;if(n.output==="mathml")return qP(e,r,i,n.displayMode,!0);if(n.output==="html"){var s=aS(e,i);a=Be.makeSpan(["katex"],[s])}else{var o=qP(e,r,i,n.displayMode,!1),l=aS(e,i);a=Be.makeSpan(["katex"],[o,l])}return LB(a,n)},lve=function(e,r,n){var i=_B(n),a=aS(e,i),s=Be.makeSpan(["katex"],[a]);return LB(s,n)},cve={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},uve=function(e){var r=new rt.MathNode("mo",[new rt.TextNode(cve[e.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},hve={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},fve=function(e){return e.type==="ordgroup"?e.body.length:1},dve=function(e,r){function n(){var o=4e5,l=e.label.slice(1);if(qt.contains(["widehat","widecheck","widetilde","utilde"],l)){var u=e,h=fve(u.base),f,d,p;if(h>5)l==="widehat"||l==="widecheck"?(f=420,o=2364,p=.42,d=l+"4"):(f=312,o=2340,p=.34,d="tilde4");else{var g=[1,1,2,2,3,3][h];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][g],f=[0,239,300,360,420][g],p=[0,.24,.3,.3,.36,.42][g],d=l+g):(o=[0,600,1033,2339,2340][g],f=[0,260,286,306,312][g],p=[0,.26,.286,.3,.306,.34][g],d="tilde"+g)}var m=new Kl(d),y=new nl([m],{width:"100%",height:ut(p),viewBox:"0 0 "+o+" "+f,preserveAspectRatio:"none"});return{span:Be.makeSvgSpan([],[y],r),minWidth:0,height:p}}else{var x=[],b=hve[l],[w,_,k]=b,E=k/1e3,L=w.length,S,C;if(L===1){var M=b[3];S=["hide-tail"],C=[M]}else if(L===2)S=["halfarrow-left","halfarrow-right"],C=["xMinYMin","xMaxYMin"];else if(L===3)S=["brace-left","brace-center","brace-right"],C=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support `+L+" children.");for(var R=0;R0&&(i.style.minWidth=ut(a)),i},pve=function(e,r,n,i,a){var s,o=e.height+e.depth+n+i;if(/fbox|color|angl/.test(r)){if(s=Be.makeSpan(["stretchy",r],[],a),r==="fbox"){var l=a.color&&a.getColor();l&&(s.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(r)&&u.push(new M1({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&u.push(new M1({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new nl(u,{width:"100%",height:ut(o)});s=Be.makeSvgSpan([],[h],a)}return s.height=o,s.style.height=ut(o),s},tu={encloseSpan:pve,mathMLnode:uve,svgSpan:dve};yS=(t,e)=>{var r,n,i;t&&t.type==="supsub"?(n=hr(t.base,"accent"),r=n.base,t.base=r,i=F1e(Ar(t,e)),t.base=n):(n=hr(t,"accent"),r=n.base);var a=Ar(r,e.havingCrampedStyle()),s=n.isShifty&&qt.isCharacterBox(r),o=0;if(s){var l=qt.getBaseElem(r),u=Ar(l,e.havingCrampedStyle());o=GP(u).skew}var h=n.label==="\\c",f=h?a.height+a.depth:Math.min(a.height,e.fontMetrics().xHeight),d;if(n.isStretchy)d=tu.svgSpan(n,e),d=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+ut(2*o)+")",marginLeft:ut(2*o)}:void 0}]},e);else{var p,g;n.label==="\\vec"?(p=Be.staticSvg("vec",e),g=Be.svgData.vec[1]):(p=Be.makeOrd({mode:n.mode,text:n.label},e,"textord"),p=GP(p),p.italic=0,g=p.width,h&&(f+=p.depth)),d=Be.makeSpan(["accent-body"],[p]);var m=n.label==="\\textcircled";m&&(d.classes.push("accent-full"),f=a.height);var y=o;m||(y-=g/2),d.style.left=ut(y),n.label==="\\textcircled"&&(d.style.top=".2em"),d=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:d}]},e)}var x=Be.makeSpan(["mord","accent"],[d],e);return i?(i.children[0]=x,i.height=Math.max(x.height,i.height),i.classes[0]="mord",i):x},RB=(t,e)=>{var r=t.isStretchy?tu.mathMLnode(t.label):new rt.MathNode("mo",[yo(t.label,t.mode)]),n=new rt.MathNode("mover",[hn(t.base,e),r]);return n.setAttribute("accent","true"),n},gve=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));vt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var r=Ab(e[0]),n=!gve.test(t.funcName),i=!n||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:n,isShifty:i,base:r}},htmlBuilder:yS,mathmlBuilder:RB});vt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var r=e[0],n=t.parser.mode;return n==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),n="text"),{type:"accent",mode:n,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:yS,mathmlBuilder:RB});vt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0];return{type:"accentUnder",mode:r.mode,label:n,base:i}},htmlBuilder:(t,e)=>{var r=Ar(t.base,e),n=tu.svgSpan(t,e),i=t.label==="\\utilde"?.12:0,a=Be.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:r}]},e);return Be.makeSpan(["mord","accentunder"],[a],e)},mathmlBuilder:(t,e)=>{var r=tu.mathMLnode(t.label),n=new rt.MathNode("munder",[hn(t.base,e),r]);return n.setAttribute("accentunder","true"),n}});vb=t=>{var e=new rt.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};vt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,r){var{parser:n,funcName:i}=t;return{type:"xArrow",mode:n.mode,label:i,body:e[0],below:r[0]}},htmlBuilder(t,e){var r=e.style,n=e.havingStyle(r.sup()),i=Be.wrapFragment(Ar(t.body,n,e),e),a=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(a+"-arrow-pad");var s;t.below&&(n=e.havingStyle(r.sub()),s=Be.wrapFragment(Ar(t.below,n,e),e),s.classes.push(a+"-arrow-pad"));var o=tu.svgSpan(t,e),l=-e.fontMetrics().axisHeight+.5*o.height,u=-e.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(u-=i.depth);var h;if(s){var f=-e.fontMetrics().axisHeight+s.height+.5*o.height+.111;h=Be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l},{type:"elem",elem:s,shift:f}]},e)}else h=Be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:u},{type:"elem",elem:o,shift:l}]},e);return h.children[0].children[0].children[1].classes.push("svg-align"),Be.makeSpan(["mrel","x-arrow"],[h],e)},mathmlBuilder(t,e){var r=tu.mathMLnode(t.label);r.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var n;if(t.body){var i=vb(hn(t.body,e));if(t.below){var a=vb(hn(t.below,e));n=new rt.MathNode("munderover",[r,a,i])}else n=new rt.MathNode("mover",[r,i])}else if(t.below){var s=vb(hn(t.below,e));n=new rt.MathNode("munder",[r,s])}else n=vb(),n=new rt.MathNode("mover",[r,n]);return n}});mve=Be.makeSpan;vt({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:r,funcName:n}=t,i=e[0];return{type:"mclass",mode:r.mode,mclass:"m"+n.slice(5),body:si(i),isCharacterBox:qt.isCharacterBox(i)}},htmlBuilder:NB,mathmlBuilder:IB});Mb=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};vt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:r}=t;return{type:"mclass",mode:r.mode,mclass:Mb(e[0]),body:si(e[1]),isCharacterBox:qt.isCharacterBox(e[1])}}});vt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:r,funcName:n}=t,i=e[1],a=e[0],s;n!=="\\stackrel"?s=Mb(i):s="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:n!=="\\stackrel",body:si(i)},l={type:"supsub",mode:a.mode,base:o,sup:n==="\\underset"?null:a,sub:n==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[l],isCharacterBox:qt.isCharacterBox(l)}},htmlBuilder:NB,mathmlBuilder:IB});vt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"pmb",mode:r.mode,mclass:Mb(e[0]),body:si(e[0])}},htmlBuilder(t,e){var r=Ti(t.body,e,!0),n=Be.makeSpan([t.mclass],r,e);return n.style.textShadow="0.02em 0.01em 0.04px",n},mathmlBuilder(t,e){var r=fs(t.body,e),n=new rt.MathNode("mstyle",r);return n.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),n}});vve={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},YP=()=>({type:"styling",body:[],mode:"math",style:"display"}),XP=t=>t.type==="textord"&&t.text==="@",yve=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;vt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t;return{type:"cdlabel",mode:r.mode,side:n.slice(4),label:e[0]}},htmlBuilder(t,e){var r=e.havingStyle(e.style.sup()),n=Be.wrapFragment(Ar(t.label,r,e),e);return n.classes.push("cd-label-"+t.side),n.style.bottom=ut(.8-n.depth),n.height=0,n.depth=0,n},mathmlBuilder(t,e){var r=new rt.MathNode("mrow",[hn(t.label,e)]);return r=new rt.MathNode("mpadded",[r]),r.setAttribute("width","0"),t.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new rt.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});vt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:r}=t;return{type:"cdlabelparent",mode:r.mode,fragment:e[0]}},htmlBuilder(t,e){var r=Be.wrapFragment(Ar(t.fragment,e),e);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(t,e){return new rt.MathNode("mrow",[hn(t.fragment,e)])}});vt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:r}=t,n=hr(e[0],"ordgroup"),i=n.body,a="",s=0;s=1114111)throw new nt("\\@char with invalid code point "+a);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:r.mode,text:u}}});MB=(t,e)=>{var r=Ti(t.body,e.withColor(t.color),!1);return Be.makeFragment(r)},DB=(t,e)=>{var r=fs(t.body,e.withColor(t.color)),n=new rt.MathNode("mstyle",r);return n.setAttribute("mathcolor",t.color),n};vt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:r}=t,n=hr(e[0],"color-token").color,i=e[1];return{type:"color",mode:r.mode,color:n,body:si(i)}},htmlBuilder:MB,mathmlBuilder:DB});vt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:r,breakOnTokenText:n}=t,i=hr(e[0],"color-token").color;r.gullet.macros.set("\\current@color",i);var a=r.parseExpression(!0,n);return{type:"color",mode:r.mode,color:i,body:a}},htmlBuilder:MB,mathmlBuilder:DB});vt({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,r){var{parser:n}=t,i=n.gullet.future().text==="["?n.parseSizeGroup(!0):null,a=!n.settings.displayMode||!n.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:n.mode,newLine:a,size:i&&hr(i,"size").value}},htmlBuilder(t,e){var r=Be.makeSpan(["mspace"],[],e);return t.newLine&&(r.classes.push("newline"),t.size&&(r.style.marginTop=ut(Wn(t.size,e)))),r},mathmlBuilder(t,e){var r=new rt.MathNode("mspace");return t.newLine&&(r.setAttribute("linebreak","newline"),t.size&&r.setAttribute("height",ut(Wn(t.size,e)))),r}});oS={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},OB=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new nt("Expected a control sequence",t);return e},wve=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},PB=(t,e,r,n)=>{var i=t.gullet.macros.get(r.text);i==null&&(r.noexpand=!0,i={tokens:[r],numArgs:0,unexpandable:!t.gullet.isExpandable(r.text)}),t.gullet.macros.set(e,i,n)};vt({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:r}=t;e.consumeSpaces();var n=e.fetch();if(oS[n.text])return(r==="\\global"||r==="\\\\globallong")&&(n.text=oS[n.text]),hr(e.parseFunction(),"internal");throw new nt("Invalid token after macro prefix",n)}});vt({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=e.gullet.popToken(),i=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new nt("Expected a control sequence",n);for(var a=0,s,o=[[]];e.gullet.future().text!=="{";)if(n=e.gullet.popToken(),n.text==="#"){if(e.gullet.future().text==="{"){s=e.gullet.future(),o[a].push("{");break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new nt('Invalid argument number "'+n.text+'"');if(parseInt(n.text)!==a+1)throw new nt('Argument number "'+n.text+'" out of order');a++,o.push([])}else{if(n.text==="EOF")throw new nt("Expected a macro definition");o[a].push(n.text)}var{tokens:l}=e.gullet.consumeArg();return s&&l.unshift(s),(r==="\\edef"||r==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:a,delimiters:o},r===oS[r]),{type:"internal",mode:e.mode}}});vt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=OB(e.gullet.popToken());e.gullet.consumeSpaces();var i=wve(e);return PB(e,n,i,r==="\\\\globallet"),{type:"internal",mode:e.mode}}});vt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:r}=t,n=OB(e.gullet.popToken()),i=e.gullet.popToken(),a=e.gullet.popToken();return PB(e,n,a,r==="\\\\globalfuture"),e.gullet.pushToken(a),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});_1=function(e,r,n){var i=wn.math[e]&&wn.math[e].replace,a=dS(i||e,r,n);if(!a)throw new Error("Unsupported symbol "+e+" and font size "+r+".");return a},xS=function(e,r,n,i){var a=n.havingBaseStyle(r),s=Be.makeSpan(i.concat(a.sizingClasses(n)),[e],n),o=a.sizeMultiplier/n.sizeMultiplier;return s.height*=o,s.depth*=o,s.maxFontSize=a.sizeMultiplier,s},BB=function(e,r,n){var i=r.havingBaseStyle(n),a=(1-r.sizeMultiplier/i.sizeMultiplier)*r.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=ut(a),e.height-=a,e.depth+=a},kve=function(e,r,n,i,a,s){var o=Be.makeSymbol(e,"Main-Regular",a,i),l=xS(o,r,i,s);return n&&BB(l,i,r),l},Tve=function(e,r,n,i){return Be.makeSymbol(e,"Size"+r+"-Regular",n,i)},FB=function(e,r,n,i,a,s){var o=Tve(e,r,a,i),l=xS(Be.makeSpan(["delimsizing","size"+r],[o],i),Xt.TEXT,i,s);return n&&BB(l,i,Xt.TEXT),l},HE=function(e,r,n){var i;r==="Size1-Regular"?i="delim-size1":i="delim-size4";var a=Be.makeSpan(["delimsizinginner",i],[Be.makeSpan([],[Be.makeSymbol(e,r,n)])]);return{type:"elem",elem:a}},qE=function(e,r,n){var i=jl["Size4-Regular"][e.charCodeAt(0)]?jl["Size4-Regular"][e.charCodeAt(0)][4]:jl["Size1-Regular"][e.charCodeAt(0)][4],a=new Kl("inner",N1e(e,Math.round(1e3*r))),s=new nl([a],{width:ut(i),height:ut(r),style:"width:"+ut(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),o=Be.makeSvgSpan([],[s],n);return o.height=r,o.style.height=ut(r),o.style.width=ut(i),{type:"elem",elem:o}},lS=.008,yb={type:"kern",size:-1*lS},Eve=["|","\\lvert","\\rvert","\\vert"],Sve=["\\|","\\lVert","\\rVert","\\Vert"],zB=function(e,r,n,i,a,s){var o,l,u,h,f="",d=0;o=u=h=e,l=null;var p="Size1-Regular";e==="\\uparrow"?u=h="\u23D0":e==="\\Uparrow"?u=h="\u2016":e==="\\downarrow"?o=u="\u23D0":e==="\\Downarrow"?o=u="\u2016":e==="\\updownarrow"?(o="\\uparrow",u="\u23D0",h="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",u="\u2016",h="\\Downarrow"):qt.contains(Eve,e)?(u="\u2223",f="vert",d=333):qt.contains(Sve,e)?(u="\u2225",f="doublevert",d=556):e==="["||e==="\\lbrack"?(o="\u23A1",u="\u23A2",h="\u23A3",p="Size4-Regular",f="lbrack",d=667):e==="]"||e==="\\rbrack"?(o="\u23A4",u="\u23A5",h="\u23A6",p="Size4-Regular",f="rbrack",d=667):e==="\\lfloor"||e==="\u230A"?(u=o="\u23A2",h="\u23A3",p="Size4-Regular",f="lfloor",d=667):e==="\\lceil"||e==="\u2308"?(o="\u23A1",u=h="\u23A2",p="Size4-Regular",f="lceil",d=667):e==="\\rfloor"||e==="\u230B"?(u=o="\u23A5",h="\u23A6",p="Size4-Regular",f="rfloor",d=667):e==="\\rceil"||e==="\u2309"?(o="\u23A4",u=h="\u23A5",p="Size4-Regular",f="rceil",d=667):e==="("||e==="\\lparen"?(o="\u239B",u="\u239C",h="\u239D",p="Size4-Regular",f="lparen",d=875):e===")"||e==="\\rparen"?(o="\u239E",u="\u239F",h="\u23A0",p="Size4-Regular",f="rparen",d=875):e==="\\{"||e==="\\lbrace"?(o="\u23A7",l="\u23A8",h="\u23A9",u="\u23AA",p="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="\u23AB",l="\u23AC",h="\u23AD",u="\u23AA",p="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(o="\u23A7",h="\u23A9",u="\u23AA",p="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(o="\u23AB",h="\u23AD",u="\u23AA",p="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(o="\u23A7",h="\u23AD",u="\u23AA",p="Size4-Regular"):(e==="\\rmoustache"||e==="\u23B1")&&(o="\u23AB",h="\u23A9",u="\u23AA",p="Size4-Regular");var g=_1(o,p,a),m=g.height+g.depth,y=_1(u,p,a),x=y.height+y.depth,b=_1(h,p,a),w=b.height+b.depth,_=0,k=1;if(l!==null){var E=_1(l,p,a);_=E.height+E.depth,k=2}var L=m+w+_,S=Math.max(0,Math.ceil((r-L)/(k*x))),C=L+S*k*x,M=i.fontMetrics().axisHeight;n&&(M*=i.sizeMultiplier);var R=C/2-M,T=[];if(f.length>0){var I=C-m-w,A=Math.round(C*1e3),D=I1e(f,Math.round(I*1e3)),N=new Kl(f,D),O=(d/1e3).toFixed(3)+"em",B=(A/1e3).toFixed(3)+"em",P=new nl([N],{width:O,height:B,viewBox:"0 0 "+d+" "+A}),$=Be.makeSvgSpan([],[P],i);$.height=A/1e3,$.style.width=O,$.style.height=B,T.push({type:"elem",elem:$})}else{if(T.push(HE(h,p,a)),T.push(yb),l===null){var z=C-m-w+2*lS;T.push(qE(u,z,i))}else{var H=(C-m-w-_)/2+2*lS;T.push(qE(u,H,i)),T.push(yb),T.push(HE(l,p,a)),T.push(yb),T.push(qE(u,H,i))}T.push(yb),T.push(HE(o,p,a))}var J=i.havingBaseStyle(Xt.TEXT),X=Be.makeVList({positionType:"bottom",positionData:R,children:T},J);return xS(Be.makeSpan(["delimsizing","mult"],[X],J),Xt.TEXT,i,s)},YE=80,XE=.08,jE=function(e,r,n,i,a){var s=R1e(e,i,n),o=new Kl(e,s),l=new nl([o],{width:"400em",height:ut(r),viewBox:"0 0 400000 "+n,preserveAspectRatio:"xMinYMin slice"});return Be.makeSvgSpan(["hide-tail"],[l],a)},Cve=function(e,r){var n=r.havingBaseSizing(),i=VB("\\surd",e*n.sizeMultiplier,UB,n),a=n.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),o,l=0,u=0,h=0,f;return i.type==="small"?(h=1e3+1e3*s+YE,e<1?a=1:e<1.4&&(a=.7),l=(1+s+XE)/a,u=(1+s)/a,o=jE("sqrtMain",l,h,s,r),o.style.minWidth="0.853em",f=.833/a):i.type==="large"?(h=(1e3+YE)*L1[i.size],u=(L1[i.size]+s)/a,l=(L1[i.size]+s+XE)/a,o=jE("sqrtSize"+i.size,l,h,s,r),o.style.minWidth="1.02em",f=1/a):(l=e+s+XE,u=e+s,h=Math.floor(1e3*e+s)+YE,o=jE("sqrtTall",l,h,s,r),o.style.minWidth="0.742em",f=1.056),o.height=u,o.style.height=ut(l),{span:o,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},$B=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"],Ave=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"],GB=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],L1=[0,1.2,1.8,2.4,3],_ve=function(e,r,n,i,a){if(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),qt.contains($B,e)||qt.contains(GB,e))return FB(e,r,!1,n,i,a);if(qt.contains(Ave,e))return zB(e,L1[r],!1,n,i,a);throw new nt("Illegal delimiter: '"+e+"'")},Lve=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Rve=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"stack"}],UB=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Nve=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},VB=function(e,r,n,i){for(var a=Math.min(2,3-i.style.size),s=a;sr)return n[s]}return n[n.length-1]},WB=function(e,r,n,i,a,s){e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle");var o;qt.contains(GB,e)?o=Lve:qt.contains($B,e)?o=UB:o=Rve;var l=VB(e,r,o,i);return l.type==="small"?kve(e,l.style,n,i,a,s):l.type==="large"?FB(e,l.size,n,i,a,s):zB(e,r,n,i,a,s)},Ive=function(e,r,n,i,a,s){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,u=5/i.fontMetrics().ptPerEm,h=Math.max(r-o,n+o),f=Math.max(h/500*l,2*h-u);return WB(e,f,!0,i,a,s)},Jc={sqrtImage:Cve,sizedDelim:_ve,sizeToMaxHeight:L1,customSizedDelim:WB,leftRightDelim:Ive},jP={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Mve=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];vt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var r=Db(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:jP[t.funcName].size,mclass:jP[t.funcName].mclass,delim:r.text}},htmlBuilder:(t,e)=>t.delim==="."?Be.makeSpan([t.mclass]):Jc.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(yo(t.delim,t.mode));var r=new rt.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var n=ut(Jc.sizeToMaxHeight[t.size]);return r.setAttribute("minsize",n),r.setAttribute("maxsize",n),r}});vt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=t.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new nt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:Db(e[0],t).text,color:r}}});vt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=Db(e[0],t),n=t.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=hr(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim,rightColor:a.color}},htmlBuilder:(t,e)=>{KP(t);for(var r=Ti(t.body,e,!0,["mopen","mclose"]),n=0,i=0,a=!1,s=0;s{KP(t);var r=fs(t.body,e);if(t.left!=="."){var n=new rt.MathNode("mo",[yo(t.left,t.mode)]);n.setAttribute("fence","true"),r.unshift(n)}if(t.right!=="."){var i=new rt.MathNode("mo",[yo(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),r.push(i)}return gS(r)}});vt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var r=Db(e[0],t);if(!t.parser.leftrightDepth)throw new nt("\\middle without preceding \\left",r);return{type:"middle",mode:t.parser.mode,delim:r.text}},htmlBuilder:(t,e)=>{var r;if(t.delim===".")r=D1(e,[]);else{r=Jc.sizedDelim(t.delim,1,e,t.mode,[]);var n={delim:t.delim,options:e};r.isMiddle=n}return r},mathmlBuilder:(t,e)=>{var r=t.delim==="\\vert"||t.delim==="|"?yo("|","text"):yo(t.delim,t.mode),n=new rt.MathNode("mo",[r]);return n.setAttribute("fence","true"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});bS=(t,e)=>{var r=Be.wrapFragment(Ar(t.body,e),e),n=t.label.slice(1),i=e.sizeMultiplier,a,s=0,o=qt.isCharacterBox(t.body);if(n==="sout")a=Be.makeSpan(["stretchy","sout"]),a.height=e.fontMetrics().defaultRuleThickness/i,s=-.5*e.fontMetrics().xHeight;else if(n==="phase"){var l=Wn({number:.6,unit:"pt"},e),u=Wn({number:.35,unit:"ex"},e),h=e.havingBaseSizing();i=i/h.sizeMultiplier;var f=r.height+r.depth+l+u;r.style.paddingLeft=ut(f/2+l);var d=Math.floor(1e3*f*i),p=_1e(d),g=new nl([new Kl("phase",p)],{width:"400em",height:ut(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});a=Be.makeSvgSpan(["hide-tail"],[g],e),a.style.height=ut(f),s=r.depth+l+u}else{/cancel/.test(n)?o||r.classes.push("cancel-pad"):n==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var m=0,y=0,x=0;/box/.test(n)?(x=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),m=e.fontMetrics().fboxsep+(n==="colorbox"?0:x),y=m):n==="angl"?(x=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),m=4*x,y=Math.max(0,.25-r.depth)):(m=o?.2:0,y=m),a=tu.encloseSpan(r,n,m,y,e),/fbox|boxed|fcolorbox/.test(n)?(a.style.borderStyle="solid",a.style.borderWidth=ut(x)):n==="angl"&&x!==.049&&(a.style.borderTopWidth=ut(x),a.style.borderRightWidth=ut(x)),s=r.depth+y,t.backgroundColor&&(a.style.backgroundColor=t.backgroundColor,t.borderColor&&(a.style.borderColor=t.borderColor))}var b;if(t.backgroundColor)b=Be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]},e);else{var w=/cancel|phase/.test(n)?["svg-align"]:[];b=Be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:w}]},e)}return/cancel/.test(n)&&(b.height=r.height,b.depth=r.depth),/cancel/.test(n)&&!o?Be.makeSpan(["mord","cancel-lap"],[b],e):Be.makeSpan(["mord"],[b],e)},wS=(t,e)=>{var r=0,n=new rt.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[hn(t.body,e)]);switch(t.label){case"\\cancel":n.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":n.setAttribute("notation","downdiagonalstrike");break;case"\\phase":n.setAttribute("notation","phasorangle");break;case"\\sout":n.setAttribute("notation","horizontalstrike");break;case"\\fbox":n.setAttribute("notation","box");break;case"\\angl":n.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,n.setAttribute("width","+"+2*r+"pt"),n.setAttribute("height","+"+2*r+"pt"),n.setAttribute("lspace",r+"pt"),n.setAttribute("voffset",r+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);n.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":n.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&n.setAttribute("mathbackground",t.backgroundColor),n};vt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,r){var{parser:n,funcName:i}=t,a=hr(e[0],"color-token").color,s=e[1];return{type:"enclose",mode:n.mode,label:i,backgroundColor:a,body:s}},htmlBuilder:bS,mathmlBuilder:wS});vt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,r){var{parser:n,funcName:i}=t,a=hr(e[0],"color-token").color,s=hr(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:n.mode,label:i,backgroundColor:s,borderColor:a,body:o}},htmlBuilder:bS,mathmlBuilder:wS});vt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"enclose",mode:r.mode,label:"\\fbox",body:e[0]}}});vt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t,i=e[0];return{type:"enclose",mode:r.mode,label:n,body:i}},htmlBuilder:bS,mathmlBuilder:wS});vt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:r}=t;return{type:"enclose",mode:r.mode,label:"\\angl",body:e[0]}}});HB={};qB={};Ob=t=>{var e=t.parser.settings;if(!e.displayMode)throw new nt("{"+t.envName+"} can be used only in display mode.")};Ql=function(e,r){var n,i,a=e.body.length,s=e.hLinesBeforeRow,o=0,l=new Array(a),u=[],h=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,d=5*f;if(e.colSeparationType&&e.colSeparationType==="small"){var p=r.havingStyle(Xt.SCRIPT).sizeMultiplier;d=.2778*(p/r.sizeMultiplier)}var g=e.colSeparationType==="CD"?Wn({number:3,unit:"ex"},r):12*f,m=3*f,y=e.arraystretch*g,x=.7*y,b=.3*y,w=0;function _(we){for(var Ie=0;Ie0&&(w+=.25),u.push({pos:w,isDashed:we[Ie]})}for(_(s[0]),n=0;n0&&(R+=b,Lwe))for(n=0;n=o)){var ee=void 0;(i>0||e.hskipBeforeAndAfter)&&(ee=qt.deflt(H.pregap,d),ee!==0&&(D=Be.makeSpan(["arraycolsep"],[]),D.style.width=ut(ee),A.push(D)));var Q=[];for(n=0;n0){for(var se=Be.makeLineSpan("hline",r,h),ce=Be.makeLineSpan("hdashline",r,h),ue=[{type:"elem",elem:l,shift:0}];u.length>0;){var te=u.pop(),Ne=te.pos-T;te.isDashed?ue.push({type:"elem",elem:ce,shift:Ne}):ue.push({type:"elem",elem:se,shift:Ne})}l=Be.makeVList({positionType:"individualShift",children:ue},r)}if(O.length===0)return Be.makeSpan(["mord"],[l],r);var ae=Be.makeVList({positionType:"individualShift",children:O},r);return ae=Be.makeSpan(["tag"],[ae],r),Be.makeFragment([l,ae])},Dve={c:"center ",l:"left ",r:"right "},Jl=function(e,r){for(var n=[],i=new rt.MathNode("mtd",[],["mtr-glue"]),a=new rt.MathNode("mtd",[],["mml-eqn-num"]),s=0;s0){var g=e.cols,m="",y=!1,x=0,b=g.length;g[0].type==="separator"&&(d+="top ",x=1),g[g.length-1].type==="separator"&&(d+="bottom ",b-=1);for(var w=x;w0?"left ":"",d+=S[S.length-1].length>0?"right ":"";for(var C=1;C-1?"alignat":"align",a=e.envName==="split",s=uh(e.parser,{cols:n,addJot:!0,autoTag:a?void 0:kS(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:a?2:void 0,leqno:e.parser.settings.leqno},"display"),o,l=0,u={type:"ordgroup",mode:e.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var h="",f=0;f0&&p&&(y=1),n[g]={type:"align",align:m,pregap:y,postgap:0}}return s.colSeparationType=p?"align":"alignat",s};Zl({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var r=Ib(e[0]),n=r?[e[0]]:hr(e[0],"ordgroup").body,i=n.map(function(s){var o=vS(s),l=o.text;if("lcr".indexOf(l)!==-1)return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new nt("Unknown column alignment: "+l,s)}),a={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return uh(t.parser,a,TS(t.envName))},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],r="c",n={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(t.envName.charAt(t.envName.length-1)==="*"){var i=t.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),r=i.fetch().text,"lcr".indexOf(r)===-1)throw new nt("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),n.cols=[{type:"align",align:r}]}}var a=uh(t.parser,n,TS(t.envName)),s=Math.max(0,...a.body.map(o=>o.length));return a.cols=new Array(s).fill({type:"align",align:r}),e?{type:"leftright",mode:t.mode,body:[a],left:e[0],right:e[1],rightColor:void 0}:a},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},r=uh(t.parser,e,"script");return r.colSeparationType="small",r},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var r=Ib(e[0]),n=r?[e[0]]:hr(e[0],"ordgroup").body,i=n.map(function(s){var o=vS(s),l=o.text;if("lc".indexOf(l)!==-1)return{type:"align",align:l};throw new nt("Unknown column alignment: "+l,s)});if(i.length>1)throw new nt("{subarray} can contain only one column");var a={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(a=uh(t.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new nt("{subarray} can contain only one column");return a},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=uh(t.parser,e,TS(t.envName));return{type:"leftright",mode:t.mode,body:[r],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:YB,htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){qt.contains(["gather","gather*"],t.envName)&&Ob(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:kS(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return uh(t.parser,e,"display")},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:YB,htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Ob(t);var e={autoTag:kS(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return uh(t.parser,e,"display")},htmlBuilder:Ql,mathmlBuilder:Jl});Zl({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Ob(t),bve(t.parser)},htmlBuilder:Ql,mathmlBuilder:Jl});le("\\nonumber","\\gdef\\@eqnsw{0}");le("\\notag","\\nonumber");vt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new nt(t.funcName+" valid only within array environment")}});QP=HB;vt({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:r,funcName:n}=t,i=e[0];if(i.type!=="ordgroup")throw new nt("Invalid environment name",i);for(var a="",s=0;s{var r=t.font,n=e.withFont(r);return Ar(t.body,n)},jB=(t,e)=>{var r=t.font,n=e.withFont(r);return hn(t.body,n)},JP={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};vt({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=Ab(e[0]),a=n;return a in JP&&(a=JP[a]),{type:"font",mode:r.mode,font:a.slice(1),body:i}},htmlBuilder:XB,mathmlBuilder:jB});vt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:r}=t,n=e[0],i=qt.isCharacterBox(n);return{type:"mclass",mode:r.mode,mclass:Mb(n),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:n}],isCharacterBox:i}}});vt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:r,funcName:n,breakOnTokenText:i}=t,{mode:a}=r,s=r.parseExpression(!0,i),o="math"+n.slice(1);return{type:"font",mode:a,font:o,body:{type:"ordgroup",mode:r.mode,body:s}}},htmlBuilder:XB,mathmlBuilder:jB});KB=(t,e)=>{var r=e;return t==="display"?r=r.id>=Xt.SCRIPT.id?r.text():Xt.DISPLAY:t==="text"&&r.size===Xt.DISPLAY.size?r=Xt.TEXT:t==="script"?r=Xt.SCRIPT:t==="scriptscript"&&(r=Xt.SCRIPTSCRIPT),r},ES=(t,e)=>{var r=KB(t.size,e.style),n=r.fracNum(),i=r.fracDen(),a;a=e.havingStyle(n);var s=Ar(t.numer,a,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;s.height=s.height0?g=3*d:g=7*d,m=e.fontMetrics().denom1):(f>0?(p=e.fontMetrics().num2,g=d):(p=e.fontMetrics().num3,g=3*d),m=e.fontMetrics().denom2);var y;if(h){var b=e.fontMetrics().axisHeight;p-s.depth-(b+.5*f){var r=new rt.MathNode("mfrac",[hn(t.numer,e),hn(t.denom,e)]);if(!t.hasBarLine)r.setAttribute("linethickness","0px");else if(t.barSize){var n=Wn(t.barSize,e);r.setAttribute("linethickness",ut(n))}var i=KB(t.size,e.style);if(i.size!==e.style.size){r=new rt.MathNode("mstyle",[r]);var a=i.size===Xt.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",a),r.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var s=[];if(t.leftDelim!=null){var o=new rt.MathNode("mo",[new rt.TextNode(t.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}if(s.push(r),t.rightDelim!=null){var l=new rt.MathNode("mo",[new rt.TextNode(t.rightDelim.replace("\\",""))]);l.setAttribute("fence","true"),s.push(l)}return gS(s)}return r};vt({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0],a=e[1],s,o=null,l=null,u="auto";switch(n){case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,o="(",l=")";break;case"\\\\bracefrac":s=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":s=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(n){case"\\dfrac":case"\\dbinom":u="display";break;case"\\tfrac":case"\\tbinom":u="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:i,denom:a,hasBarLine:s,leftDelim:o,rightDelim:l,size:u,barSize:null}},htmlBuilder:ES,mathmlBuilder:SS});vt({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0],a=e[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:i,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});vt({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:r,token:n}=t,i;switch(r){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:n}}});eB=["display","text","script","scriptscript"],tB=function(e){var r=null;return e.length>0&&(r=e,r=r==="."?null:r),r};vt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:r}=t,n=e[4],i=e[5],a=Ab(e[0]),s=a.type==="atom"&&a.family==="open"?tB(a.text):null,o=Ab(e[1]),l=o.type==="atom"&&o.family==="close"?tB(o.text):null,u=hr(e[2],"size"),h,f=null;u.isBlank?h=!0:(f=u.value,h=f.number>0);var d="auto",p=e[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=hr(p.body[0],"textord");d=eB[Number(g.text)]}}else p=hr(p,"textord"),d=eB[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:n,denom:i,continued:!1,hasBarLine:h,barSize:f,leftDelim:s,rightDelim:l,size:d}},htmlBuilder:ES,mathmlBuilder:SS});vt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:r,funcName:n,token:i}=t;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:hr(e[0],"size").value,token:i}}});vt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0],a=d1e(hr(e[1],"infix").size),s=e[2],o=a.number>0;return{type:"genfrac",mode:r.mode,numer:i,denom:s,continued:!1,hasBarLine:o,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:ES,mathmlBuilder:SS});ZB=(t,e)=>{var r=e.style,n,i;t.type==="supsub"?(n=t.sup?Ar(t.sup,e.havingStyle(r.sup()),e):Ar(t.sub,e.havingStyle(r.sub()),e),i=hr(t.base,"horizBrace")):i=hr(t,"horizBrace");var a=Ar(i.base,e.havingBaseStyle(Xt.DISPLAY)),s=tu.svgSpan(i,e),o;if(i.isOver?(o=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},e),o.children[0].children[0].children[1].classes.push("svg-align")):(o=Be.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},e),o.children[0].children[0].children[0].classes.push("svg-align")),n){var l=Be.makeSpan(["mord",i.isOver?"mover":"munder"],[o],e);i.isOver?o=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:n}]},e):o=Be.makeVList({positionType:"bottom",positionData:l.depth+.2+n.height+n.depth,children:[{type:"elem",elem:n},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return Be.makeSpan(["mord",i.isOver?"mover":"munder"],[o],e)},Ove=(t,e)=>{var r=tu.mathMLnode(t.label);return new rt.MathNode(t.isOver?"mover":"munder",[hn(t.base,e),r])};vt({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:r,funcName:n}=t;return{type:"horizBrace",mode:r.mode,label:n,isOver:/^\\over/.test(n),base:e[0]}},htmlBuilder:ZB,mathmlBuilder:Ove});vt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[1],i=hr(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:r.mode,href:i,body:si(n)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var r=Ti(t.body,e,!1);return Be.makeAnchor(t.href,[],r,e)},mathmlBuilder:(t,e)=>{var r=ch(t.body,e);return r instanceof us||(r=new us("mrow",[r])),r.setAttribute("href",t.href),r}});vt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=hr(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:n}))return r.formatUnsupportedCmd("\\url");for(var i=[],a=0;a{var{parser:r,funcName:n,token:i}=t,a=hr(e[0],"raw").string,s=e[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(n){case"\\htmlClass":l.class=a,o={command:"\\htmlClass",class:a};break;case"\\htmlId":l.id=a,o={command:"\\htmlId",id:a};break;case"\\htmlStyle":l.style=a,o={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var u=a.split(","),h=0;h{var r=Ti(t.body,e,!1),n=["enclosing"];t.attributes.class&&n.push(...t.attributes.class.trim().split(/\s+/));var i=Be.makeSpan(n,r,e);for(var a in t.attributes)a!=="class"&&t.attributes.hasOwnProperty(a)&&i.setAttribute(a,t.attributes[a]);return i},mathmlBuilder:(t,e)=>ch(t.body,e)});vt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t;return{type:"htmlmathml",mode:r.mode,html:si(e[0]),mathml:si(e[1])}},htmlBuilder:(t,e)=>{var r=Ti(t.html,e,!1);return Be.makeFragment(r)},mathmlBuilder:(t,e)=>ch(t.mathml,e)});KE=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!r)throw new nt("Invalid size: '"+e+"' in \\includegraphics");var n={number:+(r[1]+r[2]),unit:r[3]};if(!mB(n))throw new nt("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n};vt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,r)=>{var{parser:n}=t,i={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},o="";if(r[0])for(var l=hr(r[0],"raw").string,u=l.split(","),h=0;h{var r=Wn(t.height,e),n=0;t.totalheight.number>0&&(n=Wn(t.totalheight,e)-r);var i=0;t.width.number>0&&(i=Wn(t.width,e));var a={height:ut(r+n)};i>0&&(a.width=ut(i)),n>0&&(a.verticalAlign=ut(-n));var s=new rS(t.src,t.alt,a);return s.height=r,s.depth=n,s},mathmlBuilder:(t,e)=>{var r=new rt.MathNode("mglyph",[]);r.setAttribute("alt",t.alt);var n=Wn(t.height,e),i=0;if(t.totalheight.number>0&&(i=Wn(t.totalheight,e)-n,r.setAttribute("valign",ut(-i))),r.setAttribute("height",ut(n+i)),t.width.number>0){var a=Wn(t.width,e);r.setAttribute("width",ut(a))}return r.setAttribute("src",t.src),r}});vt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:r,funcName:n}=t,i=hr(e[0],"size");if(r.settings.strict){var a=n[1]==="m",s=i.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" supports only mu units, "+("not "+i.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+n+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:i.value}},htmlBuilder(t,e){return Be.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var r=Wn(t.dimension,e);return new rt.SpaceNode(r)}});vt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0];return{type:"lap",mode:r.mode,alignment:n.slice(5),body:i}},htmlBuilder:(t,e)=>{var r;t.alignment==="clap"?(r=Be.makeSpan([],[Ar(t.body,e)]),r=Be.makeSpan(["inner"],[r],e)):r=Be.makeSpan(["inner"],[Ar(t.body,e)]);var n=Be.makeSpan(["fix"],[]),i=Be.makeSpan([t.alignment],[r,n],e),a=Be.makeSpan(["strut"]);return a.style.height=ut(i.height+i.depth),i.depth&&(a.style.verticalAlign=ut(-i.depth)),i.children.unshift(a),i=Be.makeSpan(["thinbox"],[i],e),Be.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var r=new rt.MathNode("mpadded",[hn(t.body,e)]);if(t.alignment!=="rlap"){var n=t.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",n+"width")}return r.setAttribute("width","0px"),r}});vt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:r,parser:n}=t,i=n.mode;n.switchMode("math");var a=r==="\\("?"\\)":"$",s=n.parseExpression(!1,a);return n.expect(a),n.switchMode(i),{type:"styling",mode:n.mode,style:"text",body:s}}});vt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new nt("Mismatched "+t.funcName)}});rB=(t,e)=>{switch(e.style.size){case Xt.DISPLAY.size:return t.display;case Xt.TEXT.size:return t.text;case Xt.SCRIPT.size:return t.script;case Xt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};vt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:r}=t;return{type:"mathchoice",mode:r.mode,display:si(e[0]),text:si(e[1]),script:si(e[2]),scriptscript:si(e[3])}},htmlBuilder:(t,e)=>{var r=rB(t,e),n=Ti(r,e,!1);return Be.makeFragment(n)},mathmlBuilder:(t,e)=>{var r=rB(t,e);return ch(r,e)}});QB=(t,e,r,n,i,a,s)=>{t=Be.makeSpan([],[t]);var o=r&&qt.isCharacterBox(r),l,u;if(e){var h=Ar(e,n.havingStyle(i.sup()),n);u={elem:h,kern:Math.max(n.fontMetrics().bigOpSpacing1,n.fontMetrics().bigOpSpacing3-h.depth)}}if(r){var f=Ar(r,n.havingStyle(i.sub()),n);l={elem:f,kern:Math.max(n.fontMetrics().bigOpSpacing2,n.fontMetrics().bigOpSpacing4-f.height)}}var d;if(u&&l){var p=n.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+s;d=Be.makeVList({positionType:"bottom",positionData:p,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else if(l){var g=t.height-s;d=Be.makeVList({positionType:"top",positionData:g,children:[{type:"kern",size:n.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:ut(-a)},{type:"kern",size:l.kern},{type:"elem",elem:t}]},n)}else if(u){var m=t.depth+s;d=Be.makeVList({positionType:"bottom",positionData:m,children:[{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:ut(a)},{type:"kern",size:n.fontMetrics().bigOpSpacing5}]},n)}else return t;var y=[d];if(l&&a!==0&&!o){var x=Be.makeSpan(["mspace"],[],n);x.style.marginRight=ut(a),y.unshift(x)}return Be.makeSpan(["mop","op-limits"],y,n)},JB=["\\smallint"],K0=(t,e)=>{var r,n,i=!1,a;t.type==="supsub"?(r=t.sup,n=t.sub,a=hr(t.base,"op"),i=!0):a=hr(t,"op");var s=e.style,o=!1;s.size===Xt.DISPLAY.size&&a.symbol&&!qt.contains(JB,a.name)&&(o=!0);var l;if(a.symbol){var u=o?"Size2-Regular":"Size1-Regular",h="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(h=a.name.slice(1),a.name=h==="oiint"?"\\iint":"\\iiint"),l=Be.makeSymbol(a.name,u,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),h.length>0){var f=l.italic,d=Be.staticSvg(h+"Size"+(o?"2":"1"),e);l=Be.makeVList({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:o?.08:0}]},e),a.name="\\"+h,l.classes.unshift("mop"),l.italic=f}}else if(a.body){var p=Ti(a.body,e,!0);p.length===1&&p[0]instanceof hs?(l=p[0],l.classes[0]="mop"):l=Be.makeSpan(["mop"],p,e)}else{for(var g=[],m=1;m{var r;if(t.symbol)r=new us("mo",[yo(t.name,t.mode)]),qt.contains(JB,t.name)&&r.setAttribute("largeop","false");else if(t.body)r=new us("mo",fs(t.body,e));else{r=new us("mi",[new Mf(t.name.slice(1))]);var n=new us("mo",[yo("\u2061","text")]);t.parentIsSupSub?r=new us("mrow",[r,n]):r=AB([r,n])}return r},Pve={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};vt({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=n;return i.length===1&&(i=Pve[i]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:K0,mathmlBuilder:O1});vt({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:si(n)}},htmlBuilder:K0,mathmlBuilder:O1});Bve={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};vt({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:r}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:K0,mathmlBuilder:O1});vt({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:r}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:K0,mathmlBuilder:O1});vt({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0},handler(t){var{parser:e,funcName:r}=t,n=r;return n.length===1&&(n=Bve[n]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}},htmlBuilder:K0,mathmlBuilder:O1});eF=(t,e)=>{var r,n,i=!1,a;t.type==="supsub"?(r=t.sup,n=t.sub,a=hr(t.base,"operatorname"),i=!0):a=hr(t,"operatorname");var s;if(a.body.length>0){for(var o=a.body.map(f=>{var d=f.text;return typeof d=="string"?{type:"textord",mode:f.mode,text:d}:f}),l=Ti(o,e.withFont("mathrm"),!0),u=0;u{for(var r=fs(t.body,e.withFont("mathrm")),n=!0,i=0;ih.toText()).join("");r=[new rt.TextNode(o)]}var l=new rt.MathNode("mi",r);l.setAttribute("mathvariant","normal");var u=new rt.MathNode("mo",[yo("\u2061","text")]);return t.parentIsSupSub?new rt.MathNode("mrow",[l,u]):rt.newDocumentFragment([l,u])};vt({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:r,funcName:n}=t,i=e[0];return{type:"operatorname",mode:r.mode,body:si(i),alwaysHandleSupSub:n==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:eF,mathmlBuilder:Fve});le("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Pf({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Be.makeFragment(Ti(t.body,e,!1)):Be.makeSpan(["mord"],Ti(t.body,e,!0),e)},mathmlBuilder(t,e){return ch(t.body,e,!0)}});vt({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:r}=t,n=e[0];return{type:"overline",mode:r.mode,body:n}},htmlBuilder(t,e){var r=Ar(t.body,e.havingCrampedStyle()),n=Be.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,a=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n},{type:"kern",size:i}]},e);return Be.makeSpan(["mord","overline"],[a],e)},mathmlBuilder(t,e){var r=new rt.MathNode("mo",[new rt.TextNode("\u203E")]);r.setAttribute("stretchy","true");var n=new rt.MathNode("mover",[hn(t.body,e),r]);return n.setAttribute("accent","true"),n}});vt({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"phantom",mode:r.mode,body:si(n)}},htmlBuilder:(t,e)=>{var r=Ti(t.body,e.withPhantom(),!1);return Be.makeFragment(r)},mathmlBuilder:(t,e)=>{var r=fs(t.body,e);return new rt.MathNode("mphantom",r)}});vt({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"hphantom",mode:r.mode,body:n}},htmlBuilder:(t,e)=>{var r=Be.makeSpan([],[Ar(t.body,e.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var n=0;n{var r=fs(si(t.body),e),n=new rt.MathNode("mphantom",r),i=new rt.MathNode("mpadded",[n]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});vt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:r}=t,n=e[0];return{type:"vphantom",mode:r.mode,body:n}},htmlBuilder:(t,e)=>{var r=Be.makeSpan(["inner"],[Ar(t.body,e.withPhantom())]),n=Be.makeSpan(["fix"],[]);return Be.makeSpan(["mord","rlap"],[r,n],e)},mathmlBuilder:(t,e)=>{var r=fs(si(t.body),e),n=new rt.MathNode("mphantom",r),i=new rt.MathNode("mpadded",[n]);return i.setAttribute("width","0px"),i}});vt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:r}=t,n=hr(e[0],"size").value,i=e[1];return{type:"raisebox",mode:r.mode,dy:n,body:i}},htmlBuilder(t,e){var r=Ar(t.body,e),n=Wn(t.dy,e);return Be.makeVList({positionType:"shift",positionData:-n,children:[{type:"elem",elem:r}]},e)},mathmlBuilder(t,e){var r=new rt.MathNode("mpadded",[hn(t.body,e)]),n=t.dy.number+t.dy.unit;return r.setAttribute("voffset",n),r}});vt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});vt({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,argTypes:["size","size","size"]},handler(t,e,r){var{parser:n}=t,i=r[0],a=hr(e[0],"size"),s=hr(e[1],"size");return{type:"rule",mode:n.mode,shift:i&&hr(i,"size").value,width:a.value,height:s.value}},htmlBuilder(t,e){var r=Be.makeSpan(["mord","rule"],[],e),n=Wn(t.width,e),i=Wn(t.height,e),a=t.shift?Wn(t.shift,e):0;return r.style.borderRightWidth=ut(n),r.style.borderTopWidth=ut(i),r.style.bottom=ut(a),r.width=n,r.height=i+a,r.depth=-a,r.maxFontSize=i*1.125*e.sizeMultiplier,r},mathmlBuilder(t,e){var r=Wn(t.width,e),n=Wn(t.height,e),i=t.shift?Wn(t.shift,e):0,a=e.color&&e.getColor()||"black",s=new rt.MathNode("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",ut(r)),s.setAttribute("height",ut(n));var o=new rt.MathNode("mpadded",[s]);return i>=0?o.setAttribute("height",ut(i)):(o.setAttribute("height",ut(i)),o.setAttribute("depth",ut(-i))),o.setAttribute("voffset",ut(i)),o}});nB=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],zve=(t,e)=>{var r=e.havingSize(t.size);return tF(t.body,r,e)};vt({type:"sizing",names:nB,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:r,funcName:n,parser:i}=t,a=i.parseExpression(!1,r);return{type:"sizing",mode:i.mode,size:nB.indexOf(n)+1,body:a}},htmlBuilder:zve,mathmlBuilder:(t,e)=>{var r=e.havingSize(t.size),n=fs(t.body,r),i=new rt.MathNode("mstyle",n);return i.setAttribute("mathsize",ut(r.sizeMultiplier)),i}});vt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,r)=>{var{parser:n}=t,i=!1,a=!1,s=r[0]&&hr(r[0],"ordgroup");if(s)for(var o="",l=0;l{var r=Be.makeSpan([],[Ar(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return r;if(t.smashHeight&&(r.height=0,r.children))for(var n=0;n{var r=new rt.MathNode("mpadded",[hn(t.body,e)]);return t.smashHeight&&r.setAttribute("height","0px"),t.smashDepth&&r.setAttribute("depth","0px"),r}});vt({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,r){var{parser:n}=t,i=r[0],a=e[0];return{type:"sqrt",mode:n.mode,body:a,index:i}},htmlBuilder(t,e){var r=Ar(t.body,e.havingCrampedStyle());r.height===0&&(r.height=e.fontMetrics().xHeight),r=Be.wrapFragment(r,e);var n=e.fontMetrics(),i=n.defaultRuleThickness,a=i;e.style.idr.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var d=l.height-r.height-s-u;r.style.paddingLeft=ut(h);var p=Be.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]},e);if(t.index){var g=e.havingStyle(Xt.SCRIPTSCRIPT),m=Ar(t.index,g,e),y=.6*(p.height-p.depth),x=Be.makeVList({positionType:"shift",positionData:-y,children:[{type:"elem",elem:m}]},e),b=Be.makeSpan(["root"],[x]);return Be.makeSpan(["mord","sqrt"],[b,p],e)}else return Be.makeSpan(["mord","sqrt"],[p],e)},mathmlBuilder(t,e){var{body:r,index:n}=t;return n?new rt.MathNode("mroot",[hn(r,e),hn(n,e)]):new rt.MathNode("msqrt",[hn(r,e)])}});iB={display:Xt.DISPLAY,text:Xt.TEXT,script:Xt.SCRIPT,scriptscript:Xt.SCRIPTSCRIPT};vt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:r,funcName:n,parser:i}=t,a=i.parseExpression(!0,r),s=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:s,body:a}},htmlBuilder(t,e){var r=iB[t.style],n=e.havingStyle(r).withFont("");return tF(t.body,n,e)},mathmlBuilder(t,e){var r=iB[t.style],n=e.havingStyle(r),i=fs(t.body,n),a=new rt.MathNode("mstyle",i),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=s[t.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});$ve=function(e,r){var n=e.base;if(n)if(n.type==="op"){var i=n.limits&&(r.style.size===Xt.DISPLAY.size||n.alwaysHandleSupSub);return i?K0:null}else if(n.type==="operatorname"){var a=n.alwaysHandleSupSub&&(r.style.size===Xt.DISPLAY.size||n.limits);return a?eF:null}else{if(n.type==="accent")return qt.isCharacterBox(n.base)?yS:null;if(n.type==="horizBrace"){var s=!e.sub;return s===n.isOver?ZB:null}else return null}else return null};Pf({type:"supsub",htmlBuilder(t,e){var r=$ve(t,e);if(r)return r(t,e);var{base:n,sup:i,sub:a}=t,s=Ar(n,e),o,l,u=e.fontMetrics(),h=0,f=0,d=n&&qt.isCharacterBox(n);if(i){var p=e.havingStyle(e.style.sup());o=Ar(i,p,e),d||(h=s.height-p.fontMetrics().supDrop*p.sizeMultiplier/e.sizeMultiplier)}if(a){var g=e.havingStyle(e.style.sub());l=Ar(a,g,e),d||(f=s.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}var m;e.style===Xt.DISPLAY?m=u.sup1:e.style.cramped?m=u.sup3:m=u.sup2;var y=e.sizeMultiplier,x=ut(.5/u.ptPerEm/y),b=null;if(l){var w=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(s instanceof hs||w)&&(b=ut(-s.italic))}var _;if(o&&l){h=Math.max(h,m,o.depth+.25*u.xHeight),f=Math.max(f,u.sub2);var k=u.defaultRuleThickness,E=4*k;if(h-o.depth-(l.height-f)0&&(h+=L,f-=L)}var S=[{type:"elem",elem:l,shift:f,marginRight:x,marginLeft:b},{type:"elem",elem:o,shift:-h,marginRight:x}];_=Be.makeVList({positionType:"individualShift",children:S},e)}else if(l){f=Math.max(f,u.sub1,l.height-.8*u.xHeight);var C=[{type:"elem",elem:l,marginLeft:b,marginRight:x}];_=Be.makeVList({positionType:"shift",positionData:f,children:C},e)}else if(o)h=Math.max(h,m,o.depth+.25*u.xHeight),_=Be.makeVList({positionType:"shift",positionData:-h,children:[{type:"elem",elem:o,marginRight:x}]},e);else throw new Error("supsub must have either sup or sub.");var M=iS(s,"right")||"mord";return Be.makeSpan([M],[s,Be.makeSpan(["msupsub"],[_])],e)},mathmlBuilder(t,e){var r=!1,n,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(r=!0,n=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var a=[hn(t.base,e)];t.sub&&a.push(hn(t.sub,e)),t.sup&&a.push(hn(t.sup,e));var s;if(r)s=n?"mover":"munder";else if(t.sub)if(t.sup){var u=t.base;u&&u.type==="op"&&u.limits&&e.style===Xt.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(e.style===Xt.DISPLAY||u.limits)?s="munderover":s="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Xt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Xt.DISPLAY)?s="munder":s="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===Xt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===Xt.DISPLAY)?s="mover":s="msup"}return new rt.MathNode(s,a)}});Pf({type:"atom",htmlBuilder(t,e){return Be.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var r=new rt.MathNode("mo",[yo(t.text,t.mode)]);if(t.family==="bin"){var n=mS(t,e);n==="bold-italic"&&r.setAttribute("mathvariant",n)}else t.family==="punct"?r.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&r.setAttribute("stretchy","false");return r}});rF={mi:"italic",mn:"normal",mtext:"normal"};Pf({type:"mathord",htmlBuilder(t,e){return Be.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var r=new rt.MathNode("mi",[yo(t.text,t.mode,e)]),n=mS(t,e)||"italic";return n!==rF[r.type]&&r.setAttribute("mathvariant",n),r}});Pf({type:"textord",htmlBuilder(t,e){return Be.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var r=yo(t.text,t.mode,e),n=mS(t,e)||"normal",i;return t.mode==="text"?i=new rt.MathNode("mtext",[r]):/[0-9]/.test(t.text)?i=new rt.MathNode("mn",[r]):t.text==="\\prime"?i=new rt.MathNode("mo",[r]):i=new rt.MathNode("mi",[r]),n!==rF[i.type]&&i.setAttribute("mathvariant",n),i}});ZE={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},QE={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Pf({type:"spacing",htmlBuilder(t,e){if(QE.hasOwnProperty(t.text)){var r=QE[t.text].className||"";if(t.mode==="text"){var n=Be.makeOrd(t,e,"textord");return n.classes.push(r),n}else return Be.makeSpan(["mspace",r],[Be.mathsym(t.text,t.mode,e)],e)}else{if(ZE.hasOwnProperty(t.text))return Be.makeSpan(["mspace",ZE[t.text]],[],e);throw new nt('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var r;if(QE.hasOwnProperty(t.text))r=new rt.MathNode("mtext",[new rt.TextNode("\xA0")]);else{if(ZE.hasOwnProperty(t.text))return new rt.MathNode("mspace");throw new nt('Unknown type of space "'+t.text+'"')}return r}});aB=()=>{var t=new rt.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Pf({type:"tag",mathmlBuilder(t,e){var r=new rt.MathNode("mtable",[new rt.MathNode("mtr",[aB(),new rt.MathNode("mtd",[ch(t.body,e)]),aB(),new rt.MathNode("mtd",[ch(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});sB={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},oB={"\\textbf":"textbf","\\textmd":"textmd"},Gve={"\\textit":"textit","\\textup":"textup"},lB=(t,e)=>{var r=t.font;if(r){if(sB[r])return e.withTextFontFamily(sB[r]);if(oB[r])return e.withTextFontWeight(oB[r]);if(r==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Gve[r])};vt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:r,funcName:n}=t,i=e[0];return{type:"text",mode:r.mode,body:si(i),font:n}},htmlBuilder(t,e){var r=lB(t,e),n=Ti(t.body,r,!0);return Be.makeSpan(["mord","text"],n,r)},mathmlBuilder(t,e){var r=lB(t,e);return ch(t.body,r)}});vt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:r}=t;return{type:"underline",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Ar(t.body,e),n=Be.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,a=Be.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:i},{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r}]},e);return Be.makeSpan(["mord","underline"],[a],e)},mathmlBuilder(t,e){var r=new rt.MathNode("mo",[new rt.TextNode("\u203E")]);r.setAttribute("stretchy","true");var n=new rt.MathNode("munder",[hn(t.body,e),r]);return n.setAttribute("accentunder","true"),n}});vt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:r}=t;return{type:"vcenter",mode:r.mode,body:e[0]}},htmlBuilder(t,e){var r=Ar(t.body,e),n=e.fontMetrics().axisHeight,i=.5*(r.height-n-(r.depth+n));return Be.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:r}]},e)},mathmlBuilder(t,e){return new rt.MathNode("mpadded",[hn(t.body,e)],["vcenter"])}});vt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,r){throw new nt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var r=cB(t),n=[],i=e.havingStyle(e.style.text()),a=0;at.body.replace(/ /g,t.star?"\u2423":"\xA0"),oh=SB,nF=`[ \r ]`,Uve="\\\\[a-zA-Z@]+",Vve="\\\\[^\uD800-\uDFFF]",Wve="("+Uve+")"+nF+"*",Hve=`\\\\( |[ \r ]+ ?)[ \r ]*`,cS="[\u0300-\u036F]",qve=new RegExp(cS+"+$"),Yve="("+nF+"+)|"+(Hve+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(cS+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(cS+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Wve)+("|"+Vve+")"),_b=class{constructor(e,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=r,this.tokenRegex=new RegExp(Yve,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,r){this.catcodes[e]=r}lex(){var e=this.input,r=this.tokenRegex.lastIndex;if(r===e.length)return new vo("EOF",new Gs(this,r,r));var n=this.tokenRegex.exec(e);if(n===null||n.index!==r)throw new nt("Unexpected character: '"+e[r]+"'",new vo(e[r],new Gs(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=e.indexOf(` `,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new vo(i,new Gs(this,r,this.tokenRegex.lastIndex))}},uS=class{constructor(e,r){e===void 0&&(e={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new nt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var r in e)e.hasOwnProperty(r)&&(e[r]==null?delete this.current[r]:this.current[r]=e[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i0&&(this.undefStack[this.undefStack.length-1][e]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(e)&&(a[e]=this.current[e])}r==null?delete this.current[e]:this.current[e]=r}},Xve=qB;le("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});le("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});le("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});le("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});le("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var r=t.future();return e[0].length===1&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});le("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");le("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});uB={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};le("\\char",function(t){var e=t.popToken(),r,n="";if(e.text==="'")r=8,e=t.popToken();else if(e.text==='"')r=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")n=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new nt("\\char` missing argument");n=e.text.charCodeAt(0)}else r=10;if(r){if(n=uB[e.text],n==null||n>=r)throw new nt("Invalid base-"+r+" digit "+e.text);for(var i;(i=uB[t.future().text])!=null&&i{var n=t.consumeArg().tokens;if(n.length!==1)throw new nt("\\newcommand's first argument must be a macro name");var i=n[0].text,a=t.isDefined(i);if(a&&!e)throw new nt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!r)throw new nt("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var s=0;if(n=t.consumeArg().tokens,n.length===1&&n[0].text==="["){for(var o="",l=t.expandNextToken();l.text!=="]"&&l.text!=="EOF";)o+=l.text,l=t.expandNextToken();if(!o.match(/^\s*[0-9]+\s*$/))throw new nt("Invalid number of arguments: "+o);s=parseInt(o),n=t.consumeArg().tokens}return t.macros.set(i,{tokens:n,numArgs:s}),""};le("\\newcommand",t=>CS(t,!1,!0));le("\\renewcommand",t=>CS(t,!0,!1));le("\\providecommand",t=>CS(t,!0,!0));le("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(r=>r.text).join("")),""});le("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(r=>r.text).join("")),""});le("\\show",t=>{var e=t.popToken(),r=e.text;return console.log(e,t.macros.get(r),oh[r],wn.math[r],wn.text[r]),""});le("\\bgroup","{");le("\\egroup","}");le("~","\\nobreakspace");le("\\lq","`");le("\\rq","'");le("\\aa","\\r a");le("\\AA","\\r A");le("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");le("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");le("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");le("\u212C","\\mathscr{B}");le("\u2130","\\mathscr{E}");le("\u2131","\\mathscr{F}");le("\u210B","\\mathscr{H}");le("\u2110","\\mathscr{I}");le("\u2112","\\mathscr{L}");le("\u2133","\\mathscr{M}");le("\u211B","\\mathscr{R}");le("\u212D","\\mathfrak{C}");le("\u210C","\\mathfrak{H}");le("\u2128","\\mathfrak{Z}");le("\\Bbbk","\\Bbb{k}");le("\xB7","\\cdotp");le("\\llap","\\mathllap{\\textrm{#1}}");le("\\rlap","\\mathrlap{\\textrm{#1}}");le("\\clap","\\mathclap{\\textrm{#1}}");le("\\mathstrut","\\vphantom{(}");le("\\underbar","\\underline{\\text{#1}}");le("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');le("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");le("\\ne","\\neq");le("\u2260","\\neq");le("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");le("\u2209","\\notin");le("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");le("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");le("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");le("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");le("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");le("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");le("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");le("\u27C2","\\perp");le("\u203C","\\mathclose{!\\mkern-0.8mu!}");le("\u220C","\\notni");le("\u231C","\\ulcorner");le("\u231D","\\urcorner");le("\u231E","\\llcorner");le("\u231F","\\lrcorner");le("\xA9","\\copyright");le("\xAE","\\textregistered");le("\uFE0F","\\textregistered");le("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');le("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');le("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');le("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');le("\\vdots","\\mathord{\\varvdots\\rule{0pt}{15pt}}");le("\u22EE","\\vdots");le("\\varGamma","\\mathit{\\Gamma}");le("\\varDelta","\\mathit{\\Delta}");le("\\varTheta","\\mathit{\\Theta}");le("\\varLambda","\\mathit{\\Lambda}");le("\\varXi","\\mathit{\\Xi}");le("\\varPi","\\mathit{\\Pi}");le("\\varSigma","\\mathit{\\Sigma}");le("\\varUpsilon","\\mathit{\\Upsilon}");le("\\varPhi","\\mathit{\\Phi}");le("\\varPsi","\\mathit{\\Psi}");le("\\varOmega","\\mathit{\\Omega}");le("\\substack","\\begin{subarray}{c}#1\\end{subarray}");le("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");le("\\boxed","\\fbox{$\\displaystyle{#1}$}");le("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");le("\\implies","\\DOTSB\\;\\Longrightarrow\\;");le("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");hB={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};le("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in hB?e=hB[r]:(r.slice(0,4)==="\\not"||r in wn.math&&qt.contains(["bin","rel"],wn.math[r].group))&&(e="\\dotsb"),e});AS={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};le("\\dotso",function(t){var e=t.future().text;return e in AS?"\\ldots\\,":"\\ldots"});le("\\dotsc",function(t){var e=t.future().text;return e in AS&&e!==","?"\\ldots\\,":"\\ldots"});le("\\cdots",function(t){var e=t.future().text;return e in AS?"\\@cdots\\,":"\\@cdots"});le("\\dotsb","\\cdots");le("\\dotsm","\\cdots");le("\\dotsi","\\!\\cdots");le("\\dotsx","\\ldots\\,");le("\\DOTSI","\\relax");le("\\DOTSB","\\relax");le("\\DOTSX","\\relax");le("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");le("\\,","\\tmspace+{3mu}{.1667em}");le("\\thinspace","\\,");le("\\>","\\mskip{4mu}");le("\\:","\\tmspace+{4mu}{.2222em}");le("\\medspace","\\:");le("\\;","\\tmspace+{5mu}{.2777em}");le("\\thickspace","\\;");le("\\!","\\tmspace-{3mu}{.1667em}");le("\\negthinspace","\\!");le("\\negmedspace","\\tmspace-{4mu}{.2222em}");le("\\negthickspace","\\tmspace-{5mu}{.277em}");le("\\enspace","\\kern.5em ");le("\\enskip","\\hskip.5em\\relax");le("\\quad","\\hskip1em\\relax");le("\\qquad","\\hskip2em\\relax");le("\\tag","\\@ifstar\\tag@literal\\tag@paren");le("\\tag@paren","\\tag@literal{({#1})}");le("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new nt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});le("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");le("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");le("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");le("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");le("\\newline","\\\\\\relax");le("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");iF=ut(jl["Main-Regular"][84][1]-.7*jl["Main-Regular"][65][1]);le("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+iF+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");le("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+iF+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");le("\\hspace","\\@ifstar\\@hspacer\\@hspace");le("\\@hspace","\\hskip #1\\relax");le("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");le("\\ordinarycolon",":");le("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");le("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');le("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');le("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');le("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');le("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');le("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');le("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');le("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');le("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');le("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');le("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');le("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');le("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');le("\u2237","\\dblcolon");le("\u2239","\\eqcolon");le("\u2254","\\coloneqq");le("\u2255","\\eqqcolon");le("\u2A74","\\Coloneqq");le("\\ratio","\\vcentcolon");le("\\coloncolon","\\dblcolon");le("\\colonequals","\\coloneqq");le("\\coloncolonequals","\\Coloneqq");le("\\equalscolon","\\eqqcolon");le("\\equalscoloncolon","\\Eqqcolon");le("\\colonminus","\\coloneq");le("\\coloncolonminus","\\Coloneq");le("\\minuscolon","\\eqcolon");le("\\minuscoloncolon","\\Eqcolon");le("\\coloncolonapprox","\\Colonapprox");le("\\coloncolonsim","\\Colonsim");le("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");le("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");le("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");le("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");le("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");le("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");le("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");le("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");le("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");le("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");le("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");le("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");le("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");le("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");le("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");le("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");le("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");le("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");le("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");le("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");le("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");le("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");le("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");le("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");le("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");le("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");le("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");le("\\imath","\\html@mathml{\\@imath}{\u0131}");le("\\jmath","\\html@mathml{\\@jmath}{\u0237}");le("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");le("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");le("\u27E6","\\llbracket");le("\u27E7","\\rrbracket");le("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");le("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");le("\u2983","\\lBrace");le("\u2984","\\rBrace");le("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");le("\u29B5","\\minuso");le("\\darr","\\downarrow");le("\\dArr","\\Downarrow");le("\\Darr","\\Downarrow");le("\\lang","\\langle");le("\\rang","\\rangle");le("\\uarr","\\uparrow");le("\\uArr","\\Uparrow");le("\\Uarr","\\Uparrow");le("\\N","\\mathbb{N}");le("\\R","\\mathbb{R}");le("\\Z","\\mathbb{Z}");le("\\alef","\\aleph");le("\\alefsym","\\aleph");le("\\Alpha","\\mathrm{A}");le("\\Beta","\\mathrm{B}");le("\\bull","\\bullet");le("\\Chi","\\mathrm{X}");le("\\clubs","\\clubsuit");le("\\cnums","\\mathbb{C}");le("\\Complex","\\mathbb{C}");le("\\Dagger","\\ddagger");le("\\diamonds","\\diamondsuit");le("\\empty","\\emptyset");le("\\Epsilon","\\mathrm{E}");le("\\Eta","\\mathrm{H}");le("\\exist","\\exists");le("\\harr","\\leftrightarrow");le("\\hArr","\\Leftrightarrow");le("\\Harr","\\Leftrightarrow");le("\\hearts","\\heartsuit");le("\\image","\\Im");le("\\infin","\\infty");le("\\Iota","\\mathrm{I}");le("\\isin","\\in");le("\\Kappa","\\mathrm{K}");le("\\larr","\\leftarrow");le("\\lArr","\\Leftarrow");le("\\Larr","\\Leftarrow");le("\\lrarr","\\leftrightarrow");le("\\lrArr","\\Leftrightarrow");le("\\Lrarr","\\Leftrightarrow");le("\\Mu","\\mathrm{M}");le("\\natnums","\\mathbb{N}");le("\\Nu","\\mathrm{N}");le("\\Omicron","\\mathrm{O}");le("\\plusmn","\\pm");le("\\rarr","\\rightarrow");le("\\rArr","\\Rightarrow");le("\\Rarr","\\Rightarrow");le("\\real","\\Re");le("\\reals","\\mathbb{R}");le("\\Reals","\\mathbb{R}");le("\\Rho","\\mathrm{P}");le("\\sdot","\\cdot");le("\\sect","\\S");le("\\spades","\\spadesuit");le("\\sub","\\subset");le("\\sube","\\subseteq");le("\\supe","\\supseteq");le("\\Tau","\\mathrm{T}");le("\\thetasym","\\vartheta");le("\\weierp","\\wp");le("\\Zeta","\\mathrm{Z}");le("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");le("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");le("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");le("\\bra","\\mathinner{\\langle{#1}|}");le("\\ket","\\mathinner{|{#1}\\rangle}");le("\\braket","\\mathinner{\\langle{#1}\\rangle}");le("\\Bra","\\left\\langle#1\\right|");le("\\Ket","\\left|#1\\right\\rangle");aF=t=>e=>{var r=e.consumeArg().tokens,n=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.consumeArg().tokens,s=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var l=f=>d=>{t&&(d.macros.set("|",s),i.length&&d.macros.set("\\|",o));var p=f;if(!f&&i.length){var g=d.future();g.text==="|"&&(d.popToken(),p=!0)}return{tokens:p?i:n,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var u=e.consumeArg().tokens,h=e.expandTokens([...a,...u,...r]);return e.macros.endGroup(),{tokens:h.reverse(),numArgs:0}};le("\\bra@ket",aF(!1));le("\\bra@set",aF(!0));le("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");le("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");le("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");le("\\angln","{\\angl n}");le("\\blue","\\textcolor{##6495ed}{#1}");le("\\orange","\\textcolor{##ffa500}{#1}");le("\\pink","\\textcolor{##ff00af}{#1}");le("\\red","\\textcolor{##df0030}{#1}");le("\\green","\\textcolor{##28ae7b}{#1}");le("\\gray","\\textcolor{gray}{#1}");le("\\purple","\\textcolor{##9d38bd}{#1}");le("\\blueA","\\textcolor{##ccfaff}{#1}");le("\\blueB","\\textcolor{##80f6ff}{#1}");le("\\blueC","\\textcolor{##63d9ea}{#1}");le("\\blueD","\\textcolor{##11accd}{#1}");le("\\blueE","\\textcolor{##0c7f99}{#1}");le("\\tealA","\\textcolor{##94fff5}{#1}");le("\\tealB","\\textcolor{##26edd5}{#1}");le("\\tealC","\\textcolor{##01d1c1}{#1}");le("\\tealD","\\textcolor{##01a995}{#1}");le("\\tealE","\\textcolor{##208170}{#1}");le("\\greenA","\\textcolor{##b6ffb0}{#1}");le("\\greenB","\\textcolor{##8af281}{#1}");le("\\greenC","\\textcolor{##74cf70}{#1}");le("\\greenD","\\textcolor{##1fab54}{#1}");le("\\greenE","\\textcolor{##0d923f}{#1}");le("\\goldA","\\textcolor{##ffd0a9}{#1}");le("\\goldB","\\textcolor{##ffbb71}{#1}");le("\\goldC","\\textcolor{##ff9c39}{#1}");le("\\goldD","\\textcolor{##e07d10}{#1}");le("\\goldE","\\textcolor{##a75a05}{#1}");le("\\redA","\\textcolor{##fca9a9}{#1}");le("\\redB","\\textcolor{##ff8482}{#1}");le("\\redC","\\textcolor{##f9685d}{#1}");le("\\redD","\\textcolor{##e84d39}{#1}");le("\\redE","\\textcolor{##bc2612}{#1}");le("\\maroonA","\\textcolor{##ffbde0}{#1}");le("\\maroonB","\\textcolor{##ff92c6}{#1}");le("\\maroonC","\\textcolor{##ed5fa6}{#1}");le("\\maroonD","\\textcolor{##ca337c}{#1}");le("\\maroonE","\\textcolor{##9e034e}{#1}");le("\\purpleA","\\textcolor{##ddd7ff}{#1}");le("\\purpleB","\\textcolor{##c6b9fc}{#1}");le("\\purpleC","\\textcolor{##aa87ff}{#1}");le("\\purpleD","\\textcolor{##7854ab}{#1}");le("\\purpleE","\\textcolor{##543b78}{#1}");le("\\mintA","\\textcolor{##f5f9e8}{#1}");le("\\mintB","\\textcolor{##edf2df}{#1}");le("\\mintC","\\textcolor{##e0e5cc}{#1}");le("\\grayA","\\textcolor{##f6f7f7}{#1}");le("\\grayB","\\textcolor{##f0f1f2}{#1}");le("\\grayC","\\textcolor{##e3e5e6}{#1}");le("\\grayD","\\textcolor{##d6d8da}{#1}");le("\\grayE","\\textcolor{##babec2}{#1}");le("\\grayF","\\textcolor{##888d93}{#1}");le("\\grayG","\\textcolor{##626569}{#1}");le("\\grayH","\\textcolor{##3b3e40}{#1}");le("\\grayI","\\textcolor{##21242c}{#1}");le("\\kaBlue","\\textcolor{##314453}{#1}");le("\\kaGreen","\\textcolor{##71B307}{#1}");sF={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},hS=class{constructor(e,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(e),this.macros=new uS(Xve,r.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new _b(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var r,n,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new vo("EOF",n.loc)),this.pushTokens(i),r.range(n,"")}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var r=[],n=e&&e.length>0;n||this.consumeSpaces();var i=this.future(),a,s=0,o=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new nt("Extra }",a)}else if(a.text==="EOF")throw new nt("Unexpected end of input in a macro argument, expected '"+(e&&n?e[o]:"}")+"'",a);if(e&&n)if((s===0||s===1&&e[o]==="{")&&a.text===e[o]){if(++o,o===e.length){r.splice(-o,o);break}}else o=0}while(s!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(e,r){if(r){if(r.length!==e+1)throw new nt("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;ithis.settings.maxExpand)throw new nt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||e&&i.unexpandable){if(e&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new nt("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,s=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var o=a.length-1;o>=0;--o){var l=a[o];if(l.text==="#"){if(o===0)throw new nt("Incomplete placeholder at end of macro body",l);if(l=a[--o],l.text==="#")a.splice(o+1,1);else if(/^[1-9]$/.test(l.text))a.splice(o,2,...s[+l.text-1]);else throw new nt("Not a valid argument number",l)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new vo(e)]):void 0}expandTokens(e){var r=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(e){var r=this.expandMacro(e);return r&&r.map(n=>n.text).join("")}_getExpansion(e){var r=this.macros.get(e);if(r==null)return r;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var s=i.replace(/##/g,"");s.indexOf("#"+(a+1))!==-1;)++a;for(var o=new _b(i,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var h={tokens:l,numArgs:a};return h}return i}isDefined(e){return this.macros.has(e)||oh.hasOwnProperty(e)||wn.math.hasOwnProperty(e)||wn.text.hasOwnProperty(e)||sF.hasOwnProperty(e)}isExpandable(e){var r=this.macros.get(e);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:oh.hasOwnProperty(e)&&!oh[e].primitive}},fB=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,xb=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),JE={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},dB={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},Lb=class t{constructor(e,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new hS(e,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(e,r){if(r===void 0&&(r=!0),this.fetch().text!==e)throw new nt("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var r=this.nextToken;this.consume(),this.gullet.pushToken(new vo("}")),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(e,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(t.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||e&&oh[i.text]&&oh[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(e){for(var r=-1,n,i=0;i=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',e);var o=wn[this.mode][r].group,l=Gs.range(e),u;if(z1e.hasOwnProperty(o)){var h=o;u={type:"atom",mode:this.mode,family:h,loc:l,text:r}}else u={type:o,mode:this.mode,loc:l,text:r};s=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(gB(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),e)),s={type:"textord",mode:"text",loc:Gs.range(e),text:r};else return null;if(this.consume(),a)for(var f=0;f{e.tagName==="A"&&e.hasAttribute("target")&&e.setAttribute(t,e.getAttribute("target")??"")}),Q0.default.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&e.hasAttribute(t)&&(e.setAttribute("target",e.getAttribute(t)??""),e.removeAttribute(t),e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener"))})}var mF,Q0,gF,v,MS,nu,re,Fb,xo,DS,J0,Jve,OS,Bf,F1,PS,vF,yF,RS,Hn,zb,$b,Wa,eye,tye,rye,nye,iye,z1,aye,sye,oye,lye,ec,hh,xF,bF,cye,sr,B1,uye,Ff,ds,wF,Z0,P1,Gb,kF,TF,EF,BS,FS,Or,SF,CF,$1,hye,hF,fye,AF,zf,dye,pye,LF,fF,yr,gye,mye,vye,yye,RF,xye,Wr,bye,wye,iu,NS,kye,Tye,dF,IS,Ei,ep,fh,Xe,Eye,Sye,Hr,il,Pb,Cye,Aye,NF,Ub,zS,$S,GS,US,xr,Tr,_r,Lr,Rr,tn,qr,pF,_ye,pe,VS,Vb,WS,HS,Lye,Bb,G1,Wb,Rye,or=F(()=>{mF=Gi(nb(),1);go();go();go();go();go();go();Q0=Gi(GE(),1),gF=Object.defineProperty,v=(t,e)=>gF(t,"name",{value:e,configurable:!0}),MS=(t,e)=>{for(var r in e)gF(t,r,{get:e[r],enumerable:!0})},nu={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},re={trace:v((...t)=>{},"trace"),debug:v((...t)=>{},"debug"),info:v((...t)=>{},"info"),warn:v((...t)=>{},"warn"),error:v((...t)=>{},"error"),fatal:v((...t)=>{},"fatal")},Fb=v(function(t="fatal"){let e=nu.fatal;typeof t=="string"?t.toLowerCase()in nu&&(e=nu[t]):typeof t=="number"&&(e=t),re.trace=()=>{},re.debug=()=>{},re.info=()=>{},re.warn=()=>{},re.error=()=>{},re.fatal=()=>{},e<=nu.fatal&&(re.fatal=console.error?console.error.bind(console,xo("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",xo("FATAL"))),e<=nu.error&&(re.error=console.error?console.error.bind(console,xo("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",xo("ERROR"))),e<=nu.warn&&(re.warn=console.warn?console.warn.bind(console,xo("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",xo("WARN"))),e<=nu.info&&(re.info=console.info?console.info.bind(console,xo("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",xo("INFO"))),e<=nu.debug&&(re.debug=console.debug?console.debug.bind(console,xo("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",xo("DEBUG"))),e<=nu.trace&&(re.trace=console.debug?console.debug.bind(console,xo("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",xo("TRACE")))},"setLogLevel"),xo=v(t=>`%c${(0,mF.default)().format("ss.SSS")} : ${t} : `,"format"),DS=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,J0=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Jve=/\s*%%.*\n/gm,OS=class extends Error{static{v(this,"UnknownDiagramError")}constructor(t){super(t),this.name="UnknownDiagramError"}},Bf={},F1=v(function(t,e){t=t.replace(DS,"").replace(J0,"").replace(Jve,` `);for(let[r,{detector:n}]of Object.entries(Bf))if(n(t,e))return r;throw new OS(`No diagram type detected matching given configuration for text: ${t}`)},"detectType"),PS=v((...t)=>{for(let{id:e,detector:r,loader:n}of t)vF(e,r,n)},"registerLazyLoadedDiagrams"),vF=v((t,e,r)=>{Bf[t]&&re.warn(`Detector with key ${t} already exists. Overwriting.`),Bf[t]={detector:e,loader:r},re.debug(`Detector with key ${t} added${r?" with loader":""}`)},"addDetector"),yF=v(t=>Bf[t].loader,"getDiagramLoader"),RS=v((t,e,{depth:r=2,clobber:n=!1}={})=>{let i={depth:r,clobber:n};return Array.isArray(e)&&!Array.isArray(t)?(e.forEach(a=>RS(t,a,i)),t):Array.isArray(e)&&Array.isArray(t)?(e.forEach(a=>{t.includes(a)||t.push(a)}),t):t===void 0||r<=0?t!=null&&typeof t=="object"&&typeof e=="object"?Object.assign(t,e):e:(e!==void 0&&typeof t=="object"&&typeof e=="object"&&Object.keys(e).forEach(a=>{typeof e[a]=="object"&&(t[a]===void 0||typeof t[a]=="object")?(t[a]===void 0&&(t[a]=Array.isArray(e[a])?[]:{}),t[a]=RS(t[a],e[a],{depth:r-1,clobber:n})):(n||typeof t[a]!="object"&&typeof e[a]!="object")&&(t[a]=e[a])}),t)},"assignWithDepth"),Hn=RS,zb="#ffffff",$b="#f2f2f2",Wa=v((t,e)=>e?Me(t,{s:-40,l:10}):Me(t,{s:-40,l:-10}),"mkBorder"),eye=class{static{v(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||Me(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||Me(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Wa(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Wa(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Wa(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Wa(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||ct(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||ct(this.tertiaryColor),this.lineColor=this.lineColor||ct(this.background),this.arrowheadColor=this.arrowheadColor||ct(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Lt(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Lt(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||ct(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||kt(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Me(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||Me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Me(this.primaryColor,{h:330}),this.darkMode)for(let e=0;e{this[r]=t[r]}),this.updateColors(),e.forEach(r=>{this[r]=t[r]})}},tye=v(t=>{let e=new eye;return e.calculate(t),e},"getThemeVariables"),rye=class{static{v(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=kt(this.primaryColor,16),this.tertiaryColor=Me(this.primaryColor,{h:-160}),this.primaryBorderColor=ct(this.background),this.secondaryBorderColor=Wa(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wa(this.tertiaryColor,this.darkMode),this.primaryTextColor=ct(this.primaryColor),this.secondaryTextColor=ct(this.secondaryColor),this.tertiaryTextColor=ct(this.tertiaryColor),this.lineColor=ct(this.background),this.textColor=ct(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=kt(ct("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=$s(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.sectionBkgColor=Lt("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Lt(this.sectionBkgColor,10),this.taskBorderColor=$s(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=$s(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd"}updateColors(){this.secondBkg=kt(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=kt(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=kt(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=this.darkTextColor,this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=Me(this.primaryColor,{h:64}),this.fillType3=Me(this.secondaryColor,{h:64}),this.fillType4=Me(this.primaryColor,{h:-64}),this.fillType5=Me(this.secondaryColor,{h:-64}),this.fillType6=Me(this.primaryColor,{h:128}),this.fillType7=Me(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Me(this.primaryColor,{h:330});for(let t=0;t{this[r]=t[r]}),this.updateColors(),e.forEach(r=>{this[r]=t[r]})}},nye=v(t=>{let e=new rye;return e.calculate(t),e},"getThemeVariables"),iye=class{static{v(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=Me(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=Me(this.primaryColor,{h:-160}),this.primaryBorderColor=Wa(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wa(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wa(this.tertiaryColor,this.darkMode),this.primaryTextColor=ct(this.primaryColor),this.secondaryTextColor=ct(this.secondaryColor),this.tertiaryTextColor=ct(this.tertiaryColor),this.lineColor=ct(this.background),this.textColor=ct(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.sectionBkgColor=$s(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Lt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Lt(this.tertiaryColor,40);for(let t=0;t{this[r]=t[r]}),this.updateColors(),e.forEach(r=>{this[r]=t[r]})}},z1=v(t=>{let e=new iye;return e.calculate(t),e},"getThemeVariables"),aye=class{static{v(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=kt("#cde498",10),this.primaryBorderColor=Wa(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wa(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wa(this.tertiaryColor,this.darkMode),this.primaryTextColor=ct(this.primaryColor),this.secondaryTextColor=ct(this.secondaryColor),this.tertiaryTextColor=ct(this.primaryColor),this.lineColor=ct(this.background),this.textColor=ct(this.background),this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.actorBorder=Lt(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||Me(this.primaryColor,{h:30}),this.cScale4=this.cScale4||Me(this.primaryColor,{h:60}),this.cScale5=this.cScale5||Me(this.primaryColor,{h:90}),this.cScale6=this.cScale6||Me(this.primaryColor,{h:120}),this.cScale7=this.cScale7||Me(this.primaryColor,{h:150}),this.cScale8=this.cScale8||Me(this.primaryColor,{h:210}),this.cScale9=this.cScale9||Me(this.primaryColor,{h:270}),this.cScale10=this.cScale10||Me(this.primaryColor,{h:300}),this.cScale11=this.cScale11||Me(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Lt(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Lt(this.tertiaryColor,40);for(let t=0;t{this[r]=t[r]}),this.updateColors(),e.forEach(r=>{this[r]=t[r]})}},sye=v(t=>{let e=new aye;return e.calculate(t),e},"getThemeVariables"),oye=class{static{v(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=kt(this.contrast,55),this.background="#ffffff",this.tertiaryColor=Me(this.primaryColor,{h:-160}),this.primaryBorderColor=Wa(this.primaryColor,this.darkMode),this.secondaryBorderColor=Wa(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Wa(this.tertiaryColor,this.darkMode),this.primaryTextColor=ct(this.primaryColor),this.secondaryTextColor=ct(this.secondaryColor),this.tertiaryTextColor=ct(this.tertiaryColor),this.lineColor=ct(this.background),this.textColor=ct(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222"}updateColors(){this.secondBkg=kt(this.contrast,55),this.border2=this.contrast,this.actorBorder=kt(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t{this[r]=t[r]}),this.updateColors(),e.forEach(r=>{this[r]=t[r]})}},lye=v(t=>{let e=new oye;return e.calculate(t),e},"getThemeVariables"),ec={base:{getThemeVariables:tye},dark:{getThemeVariables:nye},default:{getThemeVariables:z1},forest:{getThemeVariables:sye},neutral:{getThemeVariables:lye}},hh={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:!0,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"]},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:""},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},xF={...hh,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF"},themeCSS:void 0,themeVariables:ec.default.getThemeVariables(),sequence:{...hh.sequence,messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:v(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:v(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1},gantt:{...hh.gantt,tickInterval:void 0,useWidth:void 0},c4:{...hh.c4,useWidth:void 0,personFont:v(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),external_personFont:v(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:v(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:v(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:v(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:v(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:v(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:v(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:v(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:v(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:v(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:v(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:v(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:v(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:v(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:v(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:v(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:v(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:v(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:v(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:v(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:v(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...hh.pie,useWidth:984},xyChart:{...hh.xyChart,useWidth:void 0},requirement:{...hh.requirement,useWidth:void 0},packet:{...hh.packet}},bF=v((t,e="")=>Object.keys(t).reduce((r,n)=>Array.isArray(t[n])?r:typeof t[n]=="object"&&t[n]!==null?[...r,e+n,...bF(t[n],"")]:[...r,e+n],[]),"keyify"),cye=new Set(bF(xF,"")),sr=xF,B1=v(t=>{if(re.debug("sanitizeDirective called with",t),!(typeof t!="object"||t==null)){if(Array.isArray(t)){t.forEach(e=>B1(e));return}for(let e of Object.keys(t)){if(re.debug("Checking key",e),e.startsWith("__")||e.includes("proto")||e.includes("constr")||!cye.has(e)||t[e]==null){re.debug("sanitize deleting key: ",e),delete t[e];continue}if(typeof t[e]=="object"){re.debug("sanitizing object",e),B1(t[e]);continue}let r=["themeCSS","fontFamily","altFontFamily"];for(let n of r)e.includes(n)&&(re.debug("sanitizing css option",e),t[e]=uye(t[e]))}if(t.themeVariables)for(let e of Object.keys(t.themeVariables)){let r=t.themeVariables[e];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(t.themeVariables[e]="")}re.debug("After sanitization",t)}},"sanitizeDirective"),uye=v(t=>{let e=0,r=0;for(let n of t){if(e{let r=Hn({},t),n={};for(let i of e)SF(i),n=Hn(n,i);if(r=Hn(r,n),n.theme&&n.theme in ec){let i=Hn({},wF),a=Hn(i.themeVariables||{},n.themeVariables);r.theme&&r.theme in ec&&(r.themeVariables=ec[r.theme].getThemeVariables(a))}return P1=r,AF(P1),P1},"updateCurrentConfig"),kF=v(t=>(ds=Hn({},Ff),ds=Hn(ds,t),t.theme&&ec[t.theme]&&(ds.themeVariables=ec[t.theme].getThemeVariables(t.themeVariables)),Gb(ds,Z0),ds),"setSiteConfig"),TF=v(t=>{wF=Hn({},t)},"saveConfigFromInitialize"),EF=v(t=>(ds=Hn(ds,t),Gb(ds,Z0),ds),"updateSiteConfig"),BS=v(()=>Hn({},ds),"getSiteConfig"),FS=v(t=>(AF(t),Hn(P1,t),Or()),"setConfig"),Or=v(()=>Hn({},P1),"getConfig"),SF=v(t=>{t&&(["secure",...ds.secure??[]].forEach(e=>{Object.hasOwn(t,e)&&(re.debug(`Denied attempt to modify a secure key ${e}`,t[e]),delete t[e])}),Object.keys(t).forEach(e=>{e.startsWith("__")&&delete t[e]}),Object.keys(t).forEach(e=>{typeof t[e]=="string"&&(t[e].includes("<")||t[e].includes(">")||t[e].includes("url(data:"))&&delete t[e],typeof t[e]=="object"&&SF(t[e])}))},"sanitize"),CF=v(t=>{B1(t),t.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables={...t.themeVariables,fontFamily:t.fontFamily}),Z0.push(t),Gb(ds,Z0)},"addDirective"),$1=v((t=ds)=>{Z0=[],Gb(t,Z0)},"reset"),hye={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."},hF={},fye=v(t=>{hF[t]||(re.warn(hye[t]),hF[t]=!0)},"issueWarning"),AF=v(t=>{t&&(t.lazyLoadedDiagrams||t.loadExternalDiagramsAtStartup)&&fye("LAZY_LOAD_DEPRECATED")},"checkConfig"),zf=//gi,dye=v(t=>t?RF(t).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),pye=(()=>{let t=!1;return()=>{t||(_F(),t=!0)}})();v(_F,"setupDompurifyHooks");LF=v(t=>(pye(),Q0.default.sanitize(t)),"removeScript"),fF=v((t,e)=>{if(e.flowchart?.htmlLabels!==!1){let r=e.securityLevel;r==="antiscript"||r==="strict"?t=LF(t):r!=="loose"&&(t=RF(t),t=t.replace(//g,">"),t=t.replace(/=/g,"="),t=yye(t))}return t},"sanitizeMore"),yr=v((t,e)=>t&&(e.dompurifyConfig?t=Q0.default.sanitize(fF(t,e),e.dompurifyConfig).toString():t=Q0.default.sanitize(fF(t,e),{FORBID_TAGS:["style"]}).toString(),t),"sanitizeText"),gye=v((t,e)=>typeof t=="string"?yr(t,e):t.flat().map(r=>yr(r,e)),"sanitizeTextOrArray"),mye=v(t=>zf.test(t),"hasBreaks"),vye=v(t=>t.split(zf),"splitBreaks"),yye=v(t=>t.replace(/#br#/g,"
"),"placeholderToBreak"),RF=v(t=>t.replace(zf,"#br#"),"breakToPlaceholder"),xye=v(t=>{let e="";return t&&(e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,e=e.replaceAll(/\(/g,"\\("),e=e.replaceAll(/\)/g,"\\)")),e},"getUrl"),Wr=v(t=>!(t===!1||["false","null","0"].includes(String(t).trim().toLowerCase())),"evaluate"),bye=v(function(...t){let e=t.filter(r=>!isNaN(r));return Math.max(...e)},"getMax"),wye=v(function(...t){let e=t.filter(r=>!isNaN(r));return Math.min(...e)},"getMin"),iu=v(function(t){let e=t.split(/(,)/),r=[];for(let n=0;n0&&n+1Math.max(0,t.split(e).length-1),"countOccurrence"),kye=v((t,e)=>{let r=NS(t,"~"),n=NS(e,"~");return r===1&&n===1},"shouldCombineSets"),Tye=v(t=>{let e=NS(t,"~"),r=!1;if(e<=1)return t;e%2!==0&&t.startsWith("~")&&(t=t.substring(1),r=!0);let n=[...t],i=n.indexOf("~"),a=n.lastIndexOf("~");for(;i!==-1&&a!==-1&&i!==a;)n[i]="<",n[a]=">",i=n.indexOf("~"),a=n.lastIndexOf("~");return r&&n.unshift("~"),n.join("")},"processSet"),dF=v(()=>window.MathMLElement!==void 0,"isMathMLSupported"),IS=/\$\$(.*)\$\$/g,Ei=v(t=>(t.match(IS)?.length??0)>0,"hasKatex"),ep=v(async(t,e)=>{t=await fh(t,e);let r=document.createElement("div");r.innerHTML=t,r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);let i={width:r.clientWidth,height:r.clientHeight};return r.remove(),i},"calculateMathMLDimensions"),fh=v(async(t,e)=>{if(!Ei(t))return t;if(!(dF()||e.legacyMathML||e.forceLegacyMathML))return t.replace(IS,"MathML is unsupported in this environment.");let{default:r}=await Promise.resolve().then(()=>(uF(),cF)),n=e.forceLegacyMathML||!dF()&&e.legacyMathML?"htmlAndMathml":"mathml";return t.split(zf).map(i=>Ei(i)?`
${i}
`:`
${i}
`).join("").replace(IS,(i,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:n}).replace(/\n/g," ").replace(//g,""))},"renderKatex"),Xe={getRows:dye,sanitizeText:yr,sanitizeTextOrArray:gye,hasBreaks:mye,splitBreaks:vye,lineBreakRegex:zf,removeScript:LF,getUrl:xye,evaluate:Wr,getMax:bye,getMin:wye},Eye=v(function(t,e){for(let r of e)t.attr(r[0],r[1])},"d3Attrs"),Sye=v(function(t,e,r){let n=new Map;return r?(n.set("width","100%"),n.set("style",`max-width: ${e}px;`)):(n.set("height",t),n.set("width",e)),n},"calculateSvgSizeAttrs"),Hr=v(function(t,e,r,n){let i=Sye(e,r,n);Eye(t,i)},"configureSvgSize"),il=v(function(t,e,r,n){let i=e.node().getBBox(),a=i.width,s=i.height;re.info(`SVG bounds: ${a}x${s}`,i);let o=0,l=0;re.info(`Graph bounds: ${o}x${l}`,t),o=a+r*2,l=s+r*2,re.info(`Calculated bounds: ${o}x${l}`),Hr(e,l,o,n);let u=`${i.x-r} ${i.y-r} ${i.width+2*r} ${i.height+2*r}`;e.attr("viewBox",u)},"setupGraphViewbox"),Pb={},Cye=v((t,e,r)=>{let n="";return t in Pb&&Pb[t]?n=Pb[t](r):re.warn(`No theme found for ${t}`),` & { font-family: ${r.fontFamily}; font-size: ${r.fontSize}; fill: ${r.textColor} } /* Classes common for multiple diagrams */ & .error-icon { fill: ${r.errorBkgColor}; } & .error-text { fill: ${r.errorTextColor}; stroke: ${r.errorTextColor}; } & .edge-thickness-normal { stroke-width: 1px; } & .edge-thickness-thick { stroke-width: 3.5px } & .edge-pattern-solid { stroke-dasharray: 0; } & .edge-thickness-invisible { stroke-width: 0; fill: none; } & .edge-pattern-dashed{ stroke-dasharray: 3; } .edge-pattern-dotted { stroke-dasharray: 2; } & .marker { fill: ${r.lineColor}; stroke: ${r.lineColor}; } & .marker.cross { stroke: ${r.lineColor}; } & svg { font-family: ${r.fontFamily}; font-size: ${r.fontSize}; } & p { margin: 0 } ${n} ${e} `},"getStyles"),Aye=v((t,e)=>{e!==void 0&&(Pb[t]=e)},"addStylesForDiagram"),NF=Cye,Ub={};MS(Ub,{clear:()=>xr,getAccDescription:()=>Rr,getAccTitle:()=>_r,getDiagramTitle:()=>qr,setAccDescription:()=>Lr,setAccTitle:()=>Tr,setDiagramTitle:()=>tn});zS="",$S="",GS="",US=v(t=>yr(t,Or()),"sanitizeText"),xr=v(()=>{zS="",GS="",$S=""},"clear"),Tr=v(t=>{zS=US(t).replace(/^\s+/g,"")},"setAccTitle"),_r=v(()=>zS,"getAccTitle"),Lr=v(t=>{GS=US(t).replace(/\n\s+/g,` `)},"setAccDescription"),Rr=v(()=>GS,"getAccDescription"),tn=v(t=>{$S=US(t)},"setDiagramTitle"),qr=v(()=>$S,"getDiagramTitle"),pF=re,_ye=Fb,pe=Or,VS=FS,Vb=Ff,WS=v(t=>yr(t,pe()),"sanitizeText"),HS=il,Lye=v(()=>Ub,"getCommonDb"),Bb={},G1=v((t,e,r)=>{Bb[t]&&pF.warn(`Diagram with id ${t} already registered. Overwriting.`),Bb[t]=e,r&&vF(t,r),Aye(t,e.styles),e.injectUtils?.(pF,_ye,pe,WS,HS,Lye(),()=>{})},"registerDiagram"),Wb=v(t=>{if(t in Bb)return Bb[t];throw new Rye(t)},"getDiagram"),Rye=class extends Error{static{v(this,"DiagramNotFoundError")}constructor(t){super(`Diagram ${t} not found.`)}}});function lC(t){return typeof t>"u"||t===null}function DF(t){return typeof t=="object"&&t!==null}function OF(t){return Array.isArray(t)?t:lC(t)?[]:[t]}function PF(t,e){var r,n,i,a;if(e)for(a=Object.keys(e),r=0,n=a.length;ro&&(a=" ... ",e=n-o+a.length),r-n>o&&(s=" ...",r=n+o-s.length),{str:a+t.slice(e,r).replace(/\t/g,"\u2192")+s,pos:n-e+a.length}}function qb(t,e){return Si.repeat(" ",e-t.length)+t}function zF(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),typeof e.indent!="number"&&(e.indent=1),typeof e.linesBefore!="number"&&(e.linesBefore=3),typeof e.linesAfter!="number"&&(e.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],a,s=-1;a=r.exec(t.buffer);)i.push(a.index),n.push(a.index+a[0].length),t.position<=a.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var o="",l,u,h=Math.min(t.line+e.linesAfter,i.length).toString().length,f=e.maxLength-(e.indent+h+3);for(l=1;l<=e.linesBefore&&!(s-l<0);l++)u=Hb(t.buffer,n[s-l],i[s-l],t.position-(n[s]-n[s-l]),f),o=Si.repeat(" ",e.indent)+qb((t.line-l+1).toString(),h)+" | "+u.str+` `+o;for(u=Hb(t.buffer,n[s],i[s],t.position,f),o+=Si.repeat(" ",e.indent)+qb((t.line+1).toString(),h)+" | "+u.str+` `,o+=Si.repeat("-",e.indent+h+3+u.pos)+`^ `,l=1;l<=e.linesAfter&&!(s+l>=i.length);l++)u=Hb(t.buffer,n[s+l],i[s+l],t.position-(n[s]-n[s+l]),f),o+=Si.repeat(" ",e.indent)+qb((t.line+l+1).toString(),h)+" | "+u.str+` `;return o.replace(/\n$/,"")}function $F(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(n){e[String(n)]=r})}),e}function GF(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(Fye.indexOf(r)===-1)throw new ps('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=$F(e.styleAliases||null),zye.indexOf(this.kind)===-1)throw new ps('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}function YS(t,e){var r=[];return t[e].forEach(function(n){var i=r.length;r.forEach(function(a,s){a.tag===n.tag&&a.kind===n.kind&&a.multi===n.multi&&(i=s)}),r[i]=n}),r}function UF(){var t={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,r;function n(i){i.multi?(t.multi[i.kind].push(i),t.multi.fallback.push(i)):t[i.kind][i.tag]=t.fallback[i.tag]=i}for(v(n,"collectType"),e=0,r=arguments.length;e=0&&(e=e.slice(1)),e===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:r*parseFloat(e,10)}function nz(t,e){var r;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Si.isNegativeZero(t))return"-0.0";return r=t.toString(10),jye.test(r)?r.replace("e",".e"):r}function iz(t){return Object.prototype.toString.call(t)==="[object Number]"&&(t%1!==0||Si.isNegativeZero(t))}function lz(t){return t===null?!1:sz.exec(t)!==null||oz.exec(t)!==null}function cz(t){var e,r,n,i,a,s,o,l=0,u=null,h,f,d;if(e=sz.exec(t),e===null&&(e=oz.exec(t)),e===null)throw new Error("Date resolve error");if(r=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(r,n,i));if(a=+e[4],s=+e[5],o=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(h=+e[10],f=+(e[11]||0),u=(h*60+f)*6e4,e[9]==="-"&&(u=-u)),d=new Date(Date.UTC(r,n,i,a,s,o,l)),u&&d.setTime(d.getTime()-u),d}function uz(t){return t.toISOString()}function hz(t){return t==="<<"||t===null}function fz(t){if(t===null)return!1;var e,r,n=0,i=t.length,a=uC;for(r=0;r64)){if(e<0)return!1;n+=6}return n%8===0}function dz(t){var e,r,n=t.replace(/[\r\n=]/g,""),i=n.length,a=uC,s=0,o=[];for(e=0;e>16&255),o.push(s>>8&255),o.push(s&255)),s=s<<6|a.indexOf(n.charAt(e));return r=i%4*6,r===0?(o.push(s>>16&255),o.push(s>>8&255),o.push(s&255)):r===18?(o.push(s>>10&255),o.push(s>>2&255)):r===12&&o.push(s>>4&255),new Uint8Array(o)}function pz(t){var e="",r=0,n,i,a=t.length,s=uC;for(n=0;n>18&63],e+=s[r>>12&63],e+=s[r>>6&63],e+=s[r&63]),r=(r<<8)+t[n];return i=a%3,i===0?(e+=s[r>>18&63],e+=s[r>>12&63],e+=s[r>>6&63],e+=s[r&63]):i===2?(e+=s[r>>10&63],e+=s[r>>4&63],e+=s[r<<2&63],e+=s[64]):i===1&&(e+=s[r>>2&63],e+=s[r<<4&63],e+=s[64],e+=s[64]),e}function gz(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function mz(t){if(t===null)return!0;var e=[],r,n,i,a,s,o=t;for(r=0,n=o.length;r>10)+55296,(t-65536&1023)+56320)}function Mz(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||kz,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function hC(t,e){var r={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return r.snippet=Bye(r),new ps(e,r)}function zt(t,e){throw hC(t,e)}function U1(t,e){t.onWarning&&t.onWarning.call(null,hC(t,e))}function au(t,e,r,n){var i,a,s,o;if(e1&&(t.result+=Si.repeat(` `,e-1))}function Dz(t,e,r){var n,i,a,s,o,l,u,h,f=t.kind,d=t.result,p;if(p=t.input.charCodeAt(t.position),Ha(p)||Gf(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=t.input.charCodeAt(t.position+1),Ha(i)||r&&Gf(i)))return!1;for(t.kind="scalar",t.result="",a=s=t.position,o=!1;p!==0;){if(p===58){if(i=t.input.charCodeAt(t.position+1),Ha(i)||r&&Gf(i))break}else if(p===35){if(n=t.input.charCodeAt(t.position-1),Ha(n))break}else{if(t.position===t.lineStart&&q1(t)||r&&Gf(p))break;if(al(p))if(l=t.line,u=t.lineStart,h=t.lineIndent,oi(t,!1,-1),t.lineIndent>=e){o=!0,p=t.input.charCodeAt(t.position);continue}else{t.position=s,t.line=l,t.lineStart=u,t.lineIndent=h;break}}o&&(au(t,a,s,!1),e4(t,t.line-l),a=s=t.position,o=!1),dh(p)||(s=t.position+1),p=t.input.charCodeAt(++t.position)}return au(t,a,s,!1),t.result?!0:(t.kind=f,t.result=d,!1)}function Oz(t,e){var r,n,i;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,n=i=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(au(t,n,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)n=t.position,t.position++,i=t.position;else return!0;else al(r)?(au(t,n,i,!0),e4(t,oi(t,!1,e)),n=i=t.position):t.position===t.lineStart&&q1(t)?zt(t,"unexpected end of the document within a single quoted scalar"):(t.position++,i=t.position);zt(t,"unexpected end of the stream within a single quoted scalar")}function Pz(t,e){var r,n,i,a,s,o;if(o=t.input.charCodeAt(t.position),o!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=n=t.position;(o=t.input.charCodeAt(t.position))!==0;){if(o===34)return au(t,r,t.position,!0),t.position++,!0;if(o===92){if(au(t,r,t.position,!0),o=t.input.charCodeAt(++t.position),al(o))oi(t,!1,e);else if(o<256&&Nz[o])t.result+=Iz[o],t.position++;else if((s=_z(o))>0){for(i=s,a=0;i>0;i--)o=t.input.charCodeAt(++t.position),(s=Az(o))>=0?a=(a<<4)+s:zt(t,"expected hexadecimal character");t.result+=Rz(a),t.position++}else zt(t,"unknown escape sequence");r=n=t.position}else al(o)?(au(t,r,n,!0),e4(t,oi(t,!1,e)),r=n=t.position):t.position===t.lineStart&&q1(t)?zt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}zt(t,"unexpected end of the stream within a double quoted scalar")}function Bz(t,e){var r=!0,n,i,a,s=t.tag,o,l=t.anchor,u,h,f,d,p,g=Object.create(null),m,y,x,b;if(b=t.input.charCodeAt(t.position),b===91)h=93,p=!1,o=[];else if(b===123)h=125,p=!0,o={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=o),b=t.input.charCodeAt(++t.position);b!==0;){if(oi(t,!0,e),b=t.input.charCodeAt(t.position),b===h)return t.position++,t.tag=s,t.anchor=l,t.kind=p?"mapping":"sequence",t.result=o,!0;r?b===44&&zt(t,"expected the node content, but found ','"):zt(t,"missed comma between flow collection entries"),y=m=x=null,f=d=!1,b===63&&(u=t.input.charCodeAt(t.position+1),Ha(u)&&(f=d=!0,t.position++,oi(t,!0,e))),n=t.line,i=t.lineStart,a=t.position,Vf(t,e,Xb,!1,!0),y=t.tag,m=t.result,oi(t,!0,e),b=t.input.charCodeAt(t.position),(d||t.line===n)&&b===58&&(f=!0,b=t.input.charCodeAt(++t.position),oi(t,!0,e),Vf(t,e,Xb,!1,!0),x=t.result),p?Uf(t,o,g,y,m,x,n,i,a):f?o.push(Uf(t,null,g,y,m,x,n,i,a)):o.push(m),oi(t,!0,e),b=t.input.charCodeAt(t.position),b===44?(r=!0,b=t.input.charCodeAt(++t.position)):r=!1}zt(t,"unexpected end of the stream within a flow collection")}function Fz(t,e){var r,n,i=qS,a=!1,s=!1,o=e,l=0,u=!1,h,f;if(f=t.input.charCodeAt(t.position),f===124)n=!1;else if(f===62)n=!0;else return!1;for(t.kind="scalar",t.result="";f!==0;)if(f=t.input.charCodeAt(++t.position),f===43||f===45)qS===i?i=f===43?IF:l2e:zt(t,"repeat of a chomping mode identifier");else if((h=Lz(f))>=0)h===0?zt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?zt(t,"repeat of an indentation width identifier"):(o=e+h-1,s=!0);else break;if(dh(f)){do f=t.input.charCodeAt(++t.position);while(dh(f));if(f===35)do f=t.input.charCodeAt(++t.position);while(!al(f)&&f!==0)}for(;f!==0;){for(Jb(t),t.lineIndent=0,f=t.input.charCodeAt(t.position);(!s||t.lineIndento&&(o=t.lineIndent),al(f)){l++;continue}if(t.lineIndente)&&l!==0)zt(t,"bad indentation of a sequence entry");else if(t.lineIndente)&&(y&&(s=t.line,o=t.lineStart,l=t.position),Vf(t,e,jb,!0,i)&&(y?g=t.result:m=t.result),y||(Uf(t,f,d,p,g,m,s,o,l),p=g=m=null),oi(t,!0,-1),b=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&b!==0)zt(t,"bad indentation of a mapping entry");else if(t.lineIndente?l=1:t.lineIndent===e?l=0:t.lineIndente?l=1:t.lineIndent===e?l=0:t.lineIndent tag; it should be "scalar", not "'+t.kind+'"'),f=0,d=t.implicitTypes.length;f"),t.result!==null&&g.kind!==t.kind&&zt(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+g.kind+'", not "'+t.kind+'"'),g.resolve(t.result,t.tag)?(t.result=g.construct(t.result,t.tag),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):zt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return t.listener!==null&&t.listener("close",t),t.tag!==null||t.anchor!==null||h}function Vz(t){var e=t.position,r,n,i,a=!1,s;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);(s=t.input.charCodeAt(t.position))!==0&&(oi(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||s!==37));){for(a=!0,s=t.input.charCodeAt(++t.position),r=t.position;s!==0&&!Ha(s);)s=t.input.charCodeAt(++t.position);for(n=t.input.slice(r,t.position),i=[],n.length<1&&zt(t,"directive name must not be less than one character in length");s!==0;){for(;dh(s);)s=t.input.charCodeAt(++t.position);if(s===35){do s=t.input.charCodeAt(++t.position);while(s!==0&&!al(s));break}if(al(s))break;for(r=t.position;s!==0&&!Ha(s);)s=t.input.charCodeAt(++t.position);i.push(t.input.slice(r,t.position))}s!==0&&Jb(t),ph.call(MF,n)?MF[n](t,n,i):U1(t,'unknown document directive "'+n+'"')}if(oi(t,!0,-1),t.lineIndent===0&&t.input.charCodeAt(t.position)===45&&t.input.charCodeAt(t.position+1)===45&&t.input.charCodeAt(t.position+2)===45?(t.position+=3,oi(t,!0,-1)):a&&zt(t,"directives end mark is expected"),Vf(t,t.lineIndent-1,jb,!1,!0),oi(t,!0,-1),t.checkLineBreaks&&u2e.test(t.input.slice(e,t.position))&&U1(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&q1(t)){t.input.charCodeAt(t.position)===46&&(t.position+=3,oi(t,!0,-1));return}if(t.position"u"&&(r=e,e=null);var n=fC(t,r);if(typeof e!="function")return n;for(var i=0,a=n.length;i=55296&&r<=56319&&e+1=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function pC(t){var e=/^\n* /;return e.test(t)}function c$(t,e,r,n,i,a,s,o){var l,u=0,h=null,f=!1,d=!1,p=n!==-1,g=-1,m=i$(rp(t,0))&&a$(rp(t,t.length-1));if(e||s)for(l=0;l=65536?l+=2:l++){if(u=rp(t,l),!ip(u))return tp;m=m&&tC(u,h,o),h=u}else{for(l=0;l=65536?l+=2:l++){if(u=rp(t,l),u===V1)f=!0,p&&(d=d||l-g-1>n&&t[g+1]!==" ",g=l);else if(!ip(u))return tp;m=m&&tC(u,h,o),h=u}d=d||p&&l-g-1>n&&t[g+1]!==" "}return!f&&!d?m&&!s&&!i(t)?s$:a===W1?tp:rC:r>9&&pC(t)?tp:s?a===W1?tp:rC:d?l$:o$}function u$(t,e,r,n,i){t.dump=function(){if(e.length===0)return t.quotingType===W1?'""':"''";if(!t.noCompatMode&&(R2e.indexOf(e)!==-1||N2e.test(e)))return t.quotingType===W1?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,r),s=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),o=n||t.flowLevel>-1&&r>=t.flowLevel;function l(u){return n$(t,u)}switch(v(l,"testAmbiguity"),c$(e,o,t.indent,s,l,t.quotingType,t.forceQuotes&&!n,i)){case s$:return e;case rC:return"'"+e.replace(/'/g,"''")+"'";case o$:return"|"+nC(e,t.indent)+iC(JS(e,a));case l$:return">"+nC(e,t.indent)+iC(JS(h$(e,s),a));case tp:return'"'+f$(e)+'"';default:throw new ps("impossible error: invalid scalar style")}}()}function nC(t,e){var r=pC(t)?String(e):"",n=t[t.length-1]===` `,i=n&&(t[t.length-2]===` `||t===` `),a=i?"+":n?"":"-";return r+a+` `}function iC(t){return t[t.length-1]===` `?t.slice(0,-1):t}function h$(t,e){for(var r=/(\n+)([^\n]*)/g,n=function(){var u=t.indexOf(` `);return u=u!==-1?u:t.length,r.lastIndex=u,aC(t.slice(0,u),e)}(),i=t[0]===` `||t[0]===" ",a,s;s=r.exec(t);){var o=s[1],l=s[2];a=l[0]===" ",n+=o+(!i&&!a&&l!==""?` `:"")+aC(l,e),i=a}return n}function aC(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,n,i=0,a,s=0,o=0,l="";n=r.exec(t);)o=n.index,o-i>e&&(a=s>i?s:o,l+=` `+t.slice(i,a),i=a+1),s=o;return l+=` `,t.length-i>e&&s>i?l+=t.slice(i,s)+` `+t.slice(s+1):l+=t.slice(i),l.slice(1)}function f$(t){for(var e="",r=0,n,i=0;i=65536?i+=2:i++)r=rp(t,i),n=Sa[r],!n&&ip(r)?(e+=t[i],r>=65536&&(e+=t[i+1])):e+=n||t$(r);return e}function d$(t,e,r){var n="",i=t.tag,a,s,o;for(a=0,s=r.length;a"u"&&tc(t,e,null,!1,!1))&&(n!==""&&(n+=","+(t.condenseFlow?"":" ")),n+=t.dump);t.tag=i,t.dump="["+n+"]"}function sC(t,e,r,n){var i="",a=t.tag,s,o,l;for(s=0,o=r.length;s"u"&&tc(t,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Zb(t,e)),t.dump&&V1===t.dump.charCodeAt(0)?i+="-":i+="- ",i+=t.dump);t.tag=a,t.dump=i||"[]"}function p$(t,e,r){var n="",i=t.tag,a=Object.keys(r),s,o,l,u,h;for(s=0,o=a.length;s1024&&(h+="? "),h+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),tc(t,e,u,!1,!1)&&(h+=t.dump,n+=h));t.tag=i,t.dump="{"+n+"}"}function g$(t,e,r,n){var i="",a=t.tag,s=Object.keys(r),o,l,u,h,f,d;if(t.sortKeys===!0)s.sort();else if(typeof t.sortKeys=="function")s.sort(t.sortKeys);else if(t.sortKeys)throw new ps("sortKeys must be a boolean or a function");for(o=0,l=s.length;o1024,f&&(t.dump&&V1===t.dump.charCodeAt(0)?d+="?":d+="? "),d+=t.dump,f&&(d+=Zb(t,e)),tc(t,e+1,h,!0,f)&&(t.dump&&V1===t.dump.charCodeAt(0)?d+=":":d+=": ",d+=t.dump,i+=d));t.tag=a,t.dump=i||"{}"}function oC(t,e,r){var n,i,a,s,o,l;for(i=r?t.explicitTypes:t.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+l+'" style');t.dump=n}return!0}return!1}function tc(t,e,r,n,i,a,s){t.tag=null,t.dump=r,oC(t,r,!1)||oC(t,r,!0);var o=Yz.call(t.dump),l=n,u;n&&(n=t.flowLevel<0||t.flowLevel>e);var h=o==="[object Object]"||o==="[object Array]",f,d;if(h&&(f=t.duplicates.indexOf(r),d=f!==-1),(t.tag!==null&&t.tag!=="?"||d||t.indent!==2&&e>0)&&(i=!1),d&&t.usedDuplicates[f])t.dump="*ref_"+f;else{if(h&&d&&!t.usedDuplicates[f]&&(t.usedDuplicates[f]=!0),o==="[object Object]")n&&Object.keys(t.dump).length!==0?(g$(t,e,t.dump,i),d&&(t.dump="&ref_"+f+t.dump)):(p$(t,e,t.dump),d&&(t.dump="&ref_"+f+" "+t.dump));else if(o==="[object Array]")n&&t.dump.length!==0?(t.noArrayIndent&&!s&&e>0?sC(t,e-1,t.dump,i):sC(t,e,t.dump,i),d&&(t.dump="&ref_"+f+t.dump)):(d$(t,e,t.dump),d&&(t.dump="&ref_"+f+" "+t.dump));else if(o==="[object String]")t.tag!=="?"&&u$(t,t.dump,e,a,l);else{if(o==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new ps("unacceptable kind of an object to dump "+o)}t.tag!==null&&t.tag!=="?"&&(u=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",t.dump=u+" "+t.dump)}return!0}function m$(t,e){var r=[],n=[],i,a;for(Qb(t,r,n),i=0,a=n.length;i{or();v(lC,"isNothing");v(DF,"isObject");v(OF,"toArray");v(PF,"extend");v(BF,"repeat");v(FF,"isNegativeZero");Nye=lC,Iye=DF,Mye=OF,Dye=BF,Oye=FF,Pye=PF,Si={isNothing:Nye,isObject:Iye,toArray:Mye,repeat:Dye,isNegativeZero:Oye,extend:Pye};v(cC,"formatError");v(np,"YAMLException$1");np.prototype=Object.create(Error.prototype);np.prototype.constructor=np;np.prototype.toString=v(function(e){return this.name+": "+cC(this,e)},"toString");ps=np;v(Hb,"getLine");v(qb,"padStart");v(zF,"makeSnippet");Bye=zF,Fye=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],zye=["scalar","sequence","mapping"];v($F,"compileStyleAliases");v(GF,"Type$1");Ea=GF;v(YS,"compileList");v(UF,"compileMap");v(Yb,"Schema$1");Yb.prototype.extend=v(function(e){var r=[],n=[];if(e instanceof Ea)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(r=r.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new ps("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof Ea))throw new ps("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new ps("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new ps("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(a){if(!(a instanceof Ea))throw new ps("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(Yb.prototype);return i.implicit=(this.implicit||[]).concat(r),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=YS(i,"implicit"),i.compiledExplicit=YS(i,"explicit"),i.compiledTypeMap=UF(i.compiledImplicit,i.compiledExplicit),i},"extend");$ye=Yb,Gye=new Ea("tag:yaml.org,2002:str",{kind:"scalar",construct:v(function(t){return t!==null?t:""},"construct")}),Uye=new Ea("tag:yaml.org,2002:seq",{kind:"sequence",construct:v(function(t){return t!==null?t:[]},"construct")}),Vye=new Ea("tag:yaml.org,2002:map",{kind:"mapping",construct:v(function(t){return t!==null?t:{}},"construct")}),Wye=new $ye({explicit:[Gye,Uye,Vye]});v(VF,"resolveYamlNull");v(WF,"constructYamlNull");v(HF,"isNull");Hye=new Ea("tag:yaml.org,2002:null",{kind:"scalar",resolve:VF,construct:WF,predicate:HF,represent:{canonical:v(function(){return"~"},"canonical"),lowercase:v(function(){return"null"},"lowercase"),uppercase:v(function(){return"NULL"},"uppercase"),camelcase:v(function(){return"Null"},"camelcase"),empty:v(function(){return""},"empty")},defaultStyle:"lowercase"});v(qF,"resolveYamlBoolean");v(YF,"constructYamlBoolean");v(XF,"isBoolean");qye=new Ea("tag:yaml.org,2002:bool",{kind:"scalar",resolve:qF,construct:YF,predicate:XF,represent:{lowercase:v(function(t){return t?"true":"false"},"lowercase"),uppercase:v(function(t){return t?"TRUE":"FALSE"},"uppercase"),camelcase:v(function(t){return t?"True":"False"},"camelcase")},defaultStyle:"lowercase"});v(jF,"isHexCode");v(KF,"isOctCode");v(ZF,"isDecCode");v(QF,"resolveYamlInteger");v(JF,"constructYamlInteger");v(ez,"isInteger");Yye=new Ea("tag:yaml.org,2002:int",{kind:"scalar",resolve:QF,construct:JF,predicate:ez,represent:{binary:v(function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},"binary"),octal:v(function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},"octal"),decimal:v(function(t){return t.toString(10)},"decimal"),hexadecimal:v(function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Xye=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");v(tz,"resolveYamlFloat");v(rz,"constructYamlFloat");jye=/^[-+]?[0-9]+e/;v(nz,"representYamlFloat");v(iz,"isFloat");Kye=new Ea("tag:yaml.org,2002:float",{kind:"scalar",resolve:tz,construct:rz,predicate:iz,represent:nz,defaultStyle:"lowercase"}),az=Wye.extend({implicit:[Hye,qye,Yye,Kye]}),Zye=az,sz=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),oz=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");v(lz,"resolveYamlTimestamp");v(cz,"constructYamlTimestamp");v(uz,"representYamlTimestamp");Qye=new Ea("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:lz,construct:cz,instanceOf:Date,represent:uz});v(hz,"resolveYamlMerge");Jye=new Ea("tag:yaml.org,2002:merge",{kind:"scalar",resolve:hz}),uC=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`;v(fz,"resolveYamlBinary");v(dz,"constructYamlBinary");v(pz,"representYamlBinary");v(gz,"isBinary");e2e=new Ea("tag:yaml.org,2002:binary",{kind:"scalar",resolve:fz,construct:dz,predicate:gz,represent:pz}),t2e=Object.prototype.hasOwnProperty,r2e=Object.prototype.toString;v(mz,"resolveYamlOmap");v(vz,"constructYamlOmap");n2e=new Ea("tag:yaml.org,2002:omap",{kind:"sequence",resolve:mz,construct:vz}),i2e=Object.prototype.toString;v(yz,"resolveYamlPairs");v(xz,"constructYamlPairs");a2e=new Ea("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:yz,construct:xz}),s2e=Object.prototype.hasOwnProperty;v(bz,"resolveYamlSet");v(wz,"constructYamlSet");o2e=new Ea("tag:yaml.org,2002:set",{kind:"mapping",resolve:bz,construct:wz}),kz=Zye.extend({implicit:[Qye,Jye],explicit:[e2e,n2e,a2e,o2e]}),ph=Object.prototype.hasOwnProperty,Xb=1,Tz=2,Ez=3,jb=4,qS=1,l2e=2,IF=3,c2e=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u2e=/[\x85\u2028\u2029]/,h2e=/[,\[\]\{\}]/,Sz=/^(?:!|!!|![a-z\-]+!)$/i,Cz=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;v(XS,"_class");v(al,"is_EOL");v(dh,"is_WHITE_SPACE");v(Ha,"is_WS_OR_EOL");v(Gf,"is_FLOW_INDICATOR");v(Az,"fromHexCode");v(_z,"escapedHexLen");v(Lz,"fromDecimalCode");v(jS,"simpleEscapeSequence");v(Rz,"charFromCodepoint");Nz=new Array(256),Iz=new Array(256);for($f=0;$f<256;$f++)Nz[$f]=jS($f)?1:0,Iz[$f]=jS($f);v(Mz,"State$1");v(hC,"generateError");v(zt,"throwError");v(U1,"throwWarning");MF={YAML:v(function(e,r,n){var i,a,s;e.version!==null&&zt(e,"duplication of %YAML directive"),n.length!==1&&zt(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&zt(e,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&zt(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=s<2,s!==1&&s!==2&&U1(e,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:v(function(e,r,n){var i,a;n.length!==2&&zt(e,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],Sz.test(i)||zt(e,"ill-formed tag handle (first argument) of the TAG directive"),ph.call(e.tagMap,i)&&zt(e,'there is a previously declared suffix for "'+i+'" tag handle'),Cz.test(a)||zt(e,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{zt(e,"tag prefix is malformed: "+a)}e.tagMap[i]=a},"handleTagDirective")};v(au,"captureSegment");v(KS,"mergeMappings");v(Uf,"storeMappingPair");v(Jb,"readLineBreak");v(oi,"skipSeparationSpace");v(q1,"testDocumentSeparator");v(e4,"writeFoldedLines");v(Dz,"readPlainScalar");v(Oz,"readSingleQuotedScalar");v(Pz,"readDoubleQuotedScalar");v(Bz,"readFlowCollection");v(Fz,"readBlockScalar");v(ZS,"readBlockSequence");v(zz,"readBlockMapping");v($z,"readTagProperty");v(Gz,"readAnchorProperty");v(Uz,"readAlias");v(Vf,"composeNode");v(Vz,"readDocument");v(fC,"loadDocuments");v(Wz,"loadAll$1");v(Hz,"load$1");f2e=Wz,d2e=Hz,qz={loadAll:f2e,load:d2e},Yz=Object.prototype.toString,Xz=Object.prototype.hasOwnProperty,dC=65279,p2e=9,V1=10,g2e=13,m2e=32,v2e=33,y2e=34,QS=35,x2e=37,b2e=38,w2e=39,k2e=42,jz=44,T2e=45,Kb=58,E2e=61,S2e=62,C2e=63,A2e=64,Kz=91,Zz=93,_2e=96,Qz=123,L2e=124,Jz=125,Sa={};Sa[0]="\\0";Sa[7]="\\a";Sa[8]="\\b";Sa[9]="\\t";Sa[10]="\\n";Sa[11]="\\v";Sa[12]="\\f";Sa[13]="\\r";Sa[27]="\\e";Sa[34]='\\"';Sa[92]="\\\\";Sa[133]="\\N";Sa[160]="\\_";Sa[8232]="\\L";Sa[8233]="\\P";R2e=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],N2e=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;v(e$,"compileStyleMap");v(t$,"encodeHex");I2e=1,W1=2;v(r$,"State");v(JS,"indentString");v(Zb,"generateNextLine");v(n$,"testImplicitResolving");v(H1,"isWhitespace");v(ip,"isPrintable");v(eC,"isNsCharOrWhitespace");v(tC,"isPlainSafe");v(i$,"isPlainSafeFirst");v(a$,"isPlainSafeLast");v(rp,"codePointAt");v(pC,"needIndentIndicator");s$=1,rC=2,o$=3,l$=4,tp=5;v(c$,"chooseScalarStyle");v(u$,"writeScalar");v(nC,"blockHeader");v(iC,"dropEndingNewline");v(h$,"foldString");v(aC,"foldLine");v(f$,"escapeString");v(d$,"writeFlowSequence");v(sC,"writeBlockSequence");v(p$,"writeFlowMapping");v(g$,"writeBlockMapping");v(oC,"detectType");v(tc,"writeNode");v(m$,"getDuplicateReferences");v(Qb,"inspectNode");v(v$,"dump$1");M2e=v$,D2e={dump:M2e};v(t4,"renamed");ap=az,sp=qz.load,Nrt=qz.loadAll,Irt=D2e.dump,Mrt=t4("safeLoad","load"),Drt=t4("safeLoadAll","loadAll"),Ort=t4("safeDump","dump");});var O2e,op,gC,y$,n4=F(()=>{O2e=Object.freeze({left:0,top:0,width:16,height:16}),op=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),gC=Object.freeze({...O2e,...op}),y$=Object.freeze({...gC,body:"",hidden:!1})});var P2e,x$,b$=F(()=>{n4();P2e=Object.freeze({width:null,height:null}),x$=Object.freeze({...P2e,...op})});var i4,mC,a4,w$=F(()=>{i4=/^[a-z0-9]+(-[a-z0-9]+)*$/,mC=(t,e,r,n="")=>{let i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;n=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let o=i.pop(),l=i.pop(),u={provider:i.length>0?i[0]:n,prefix:l,name:o};return e&&!a4(u)?null:u}let a=i[0],s=a.split("-");if(s.length>1){let o={provider:n,prefix:s.shift(),name:s.join("-")};return e&&!a4(o)?null:o}if(r&&n===""){let o={provider:n,prefix:"",name:a};return e&&!a4(o,r)?null:o}return null},a4=(t,e)=>t?!!((t.provider===""||t.provider.match(i4))&&(e&&t.prefix===""||t.prefix.match(i4))&&t.name.match(i4)):!1});function k$(t,e){let r={};!t.hFlip!=!e.hFlip&&(r.hFlip=!0),!t.vFlip!=!e.vFlip&&(r.vFlip=!0);let n=((t.rotate||0)+(e.rotate||0))%4;return n&&(r.rotate=n),r}var T$=F(()=>{});function vC(t,e){let r=k$(t,e);for(let n in y$)n in op?n in t&&!(n in r)&&(r[n]=op[n]):n in e?r[n]=e[n]:n in t&&(r[n]=t[n]);return r}var E$=F(()=>{n4();T$()});function S$(t,e){let r=t.icons,n=t.aliases||Object.create(null),i=Object.create(null);function a(s){if(r[s])return i[s]=[];if(!(s in i)){i[s]=null;let o=n[s]&&n[s].parent,l=o&&a(o);l&&(i[s]=[o].concat(l))}return i[s]}return(e||Object.keys(r).concat(Object.keys(n))).forEach(a),i}var C$=F(()=>{});function A$(t,e,r){let n=t.icons,i=t.aliases||Object.create(null),a={};function s(o){a=vC(n[o]||i[o],a)}return s(e),r.forEach(s),vC(t,a)}function yC(t,e){if(t.icons[e])return A$(t,e,[]);let r=S$(t,[e])[e];return r?A$(t,e,r):null}var _$=F(()=>{E$();C$()});function xC(t,e,r){if(e===1)return t;if(r=r||100,typeof t=="number")return Math.ceil(t*e*r)/r;if(typeof t!="string")return t;let n=t.split(B2e);if(n===null||!n.length)return t;let i=[],a=n.shift(),s=F2e.test(a);for(;;){if(s){let o=parseFloat(a);isNaN(o)?i.push(a):i.push(Math.ceil(o*e*r)/r)}else i.push(a);if(a=n.shift(),a===void 0)return i.join("");s=!s}}var B2e,F2e,L$=F(()=>{B2e=/(-?[0-9.]*[0-9]+[0-9.]*)/g,F2e=/^-?[0-9.]*[0-9]+[0-9.]*$/g});function z2e(t,e="defs"){let r="",n=t.indexOf("<"+e);for(;n>=0;){let i=t.indexOf(">",n),a=t.indexOf("",a);if(s===-1)break;r+=t.slice(i+1,a).trim(),t=t.slice(0,n).trim()+t.slice(s+1)}return{defs:r,content:t}}function $2e(t,e){return t?""+t+""+e:e}function R$(t,e,r){let n=z2e(t);return $2e(n.defs,e+n.content+r)}var N$=F(()=>{});function bC(t,e){let r={...gC,...t},n={...x$,...e},i={left:r.left,top:r.top,width:r.width,height:r.height},a=r.body;[r,n].forEach(m=>{let y=[],x=m.hFlip,b=m.vFlip,w=m.rotate;x?b?w+=2:(y.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),y.push("scale(-1 1)"),i.top=i.left=0):b&&(y.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),y.push("scale(1 -1)"),i.top=i.left=0);let _;switch(w<0&&(w-=Math.floor(w/4)*4),w=w%4,w){case 1:_=i.height/2+i.top,y.unshift("rotate(90 "+_.toString()+" "+_.toString()+")");break;case 2:y.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:_=i.width/2+i.left,y.unshift("rotate(-90 "+_.toString()+" "+_.toString()+")");break}w%2===1&&(i.left!==i.top&&(_=i.left,i.left=i.top,i.top=_),i.width!==i.height&&(_=i.width,i.width=i.height,i.height=_)),y.length&&(a=R$(a,'',""))});let s=n.width,o=n.height,l=i.width,u=i.height,h,f;s===null?(f=o===null?"1em":o==="auto"?u:o,h=xC(f,l/u)):(h=s==="auto"?l:s,f=o===null?xC(h,u/l):o==="auto"?u:o);let d={},p=(m,y)=>{G2e(y)||(d[m]=y.toString())};p("width",h),p("height",f);let g=[i.left,i.top,l,u];return d.viewBox=g.join(" "),{attributes:d,viewBox:g,body:a}}var G2e,I$=F(()=>{n4();b$();L$();N$();G2e=t=>t==="unset"||t==="undefined"||t==="none"});function wC(t,e=V2e){let r=[],n;for(;n=U2e.exec(t);)r.push(n[1]);if(!r.length)return t;let i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(a=>{let s=typeof e=="function"?e(a):e+(W2e++).toString(),o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}var U2e,V2e,W2e,M$=F(()=>{U2e=/\sid="(\S+)"/g,V2e="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),W2e=0});function kC(t,e){let r=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let n in e)r+=" "+n+'="'+e[n]+'"';return'"+t+""}var D$=F(()=>{});var P$=di((int,O$)=>{var lp=1e3,cp=lp*60,up=cp*60,Wf=up*24,H2e=Wf*7,q2e=Wf*365.25;O$.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Y2e(t);if(r==="number"&&isFinite(t))return e.long?j2e(t):X2e(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Y2e(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*q2e;case"weeks":case"week":case"w":return r*H2e;case"days":case"day":case"d":return r*Wf;case"hours":case"hour":case"hrs":case"hr":case"h":return r*up;case"minutes":case"minute":case"mins":case"min":case"m":return r*cp;case"seconds":case"second":case"secs":case"sec":case"s":return r*lp;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function X2e(t){var e=Math.abs(t);return e>=Wf?Math.round(t/Wf)+"d":e>=up?Math.round(t/up)+"h":e>=cp?Math.round(t/cp)+"m":e>=lp?Math.round(t/lp)+"s":t+"ms"}function j2e(t){var e=Math.abs(t);return e>=Wf?s4(t,e,Wf,"day"):e>=up?s4(t,e,up,"hour"):e>=cp?s4(t,e,cp,"minute"):e>=lp?s4(t,e,lp,"second"):t+" ms"}function s4(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var F$=di((ant,B$)=>{function K2e(t){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=i,r.enabled=s,r.humanize=P$(),r.destroy=u,Object.keys(t).forEach(h=>{r[h]=t[h]}),r.names=[],r.skips=[],r.formatters={};function e(h){let f=0;for(let d=0;d{if(E==="%%")return"%";_++;let S=r.formatters[L];if(typeof S=="function"){let C=y[_];E=S.call(x,C),y.splice(_,1),_--}return E}),r.formatArgs.call(x,y),(x.log||r.log).apply(x,y)}return m.namespace=h,m.useColors=r.useColors(),m.color=r.selectColor(h),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(p!==r.namespaces&&(p=r.namespaces,g=r.enabled(h)),g),set:y=>{d=y}}),typeof r.init=="function"&&r.init(m),m}function n(h,f){let d=r(this.namespace+(typeof f>"u"?":":f)+h);return d.log=this.log,d}function i(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let f,d=(typeof h=="string"?h:"").split(/[\s,]+/),p=d.length;for(f=0;f"-"+f)].join(",");return r.enable(""),h}function s(h){if(h[h.length-1]==="*")return!0;let f,d;for(f=0,d=r.skips.length;f{Vs.formatArgs=Q2e;Vs.save=J2e;Vs.load=exe;Vs.useColors=Z2e;Vs.storage=txe();Vs.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Vs.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Z2e(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Q2e(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+o4.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}Vs.log=console.debug||console.log||(()=>{});function J2e(t){try{t?Vs.storage.setItem("debug",t):Vs.storage.removeItem("debug")}catch{}}function exe(){let t;try{t=Vs.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function txe(){try{return localStorage}catch{}}o4.exports=F$()(Vs);var{formatters:rxe}=o4.exports;rxe.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var snt,$$=F(()=>{w$();_$();I$();M$();D$();snt=Gi(z$(),1)});var EC,TC,G$,l4,nxe,su,sl=F(()=>{or();$$();EC={body:'?',height:80,width:80},TC=new Map,G$=new Map,l4=v(t=>{for(let e of t){if(!e.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(re.debug("Registering icon pack:",e.name),"loader"in e)G$.set(e.name,e.loader);else if("icons"in e)TC.set(e.name,e.icons);else throw re.error("Invalid icon loader:",e),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),nxe=v(async(t,e)=>{let r=mC(t,!0,e!==void 0);if(!r)throw new Error(`Invalid icon name: ${t}`);let n=r.prefix||e;if(!n)throw new Error(`Icon name must contain a prefix: ${t}`);let i=TC.get(n);if(!i){let s=G$.get(n);if(!s)throw new Error(`Icon set not found: ${r.prefix}`);try{i={...await s(),prefix:n},TC.set(n,i)}catch(o){throw re.error(o),new Error(`Failed to load icon set: ${r.prefix}`)}}let a=yC(i,r.name);if(!a)throw new Error(`Icon not found: ${t}`);return a},"getRegisteredIconData"),su=v(async(t,e)=>{let r;try{r=await nxe(t,e?.fallbackPrefix)}catch(a){re.error(a),r=EC}let n=bC(r,e);return kC(wC(n.body),n.attributes)},"getIconSVG")});var ou,bo=F(()=>{or();ou=v(({flowchart:t})=>{let e=t?.subGraphTitleMargin?.top??0,r=t?.subGraphTitleMargin?.bottom??0,n=e+r;return{subGraphTitleTopMargin:e,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:n}},"getSubGraphTitleMargins")});var U$=di(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.BLANK_URL=Ui.relativeFirstCharacters=Ui.whitespaceEscapeCharsRegex=Ui.urlSchemeRegex=Ui.ctrlCharactersRegex=Ui.htmlCtrlEntityRegex=Ui.htmlEntitiesRegex=Ui.invalidProtocolRegex=void 0;Ui.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;Ui.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;Ui.htmlCtrlEntityRegex=/&(newline|tab);/gi;Ui.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;Ui.urlSchemeRegex=/^.+(:|:)/gim;Ui.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;Ui.relativeFirstCharacters=[".","/"];Ui.BLANK_URL="about:blank"});var hp=di(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});c4.sanitizeUrl=void 0;var Ca=U$();function ixe(t){return Ca.relativeFirstCharacters.indexOf(t[0])>-1}function axe(t){var e=t.replace(Ca.ctrlCharactersRegex,"");return e.replace(Ca.htmlEntitiesRegex,function(r,n){return String.fromCharCode(n)})}function sxe(t){return URL.canParse(t)}function V$(t){try{return decodeURIComponent(t)}catch{return t}}function oxe(t){if(!t)return Ca.BLANK_URL;var e,r=V$(t.trim());do r=axe(r).replace(Ca.htmlCtrlEntityRegex,"").replace(Ca.ctrlCharactersRegex,"").replace(Ca.whitespaceEscapeCharsRegex,"").trim(),r=V$(r),e=r.match(Ca.ctrlCharactersRegex)||r.match(Ca.htmlEntitiesRegex)||r.match(Ca.htmlCtrlEntityRegex)||r.match(Ca.whitespaceEscapeCharsRegex);while(e&&e.length>0);var n=r;if(!n)return Ca.BLANK_URL;if(ixe(n))return n;var i=n.trimStart(),a=i.match(Ca.urlSchemeRegex);if(!a)return n;var s=a[0].toLowerCase().trim();if(Ca.invalidProtocolRegex.test(s))return Ca.BLANK_URL;var o=i.replace(/\\/g,"/");if(s==="mailto:"||s.includes("://"))return o;if(s==="http:"||s==="https:"){if(!sxe(o))return Ca.BLANK_URL;var l=new URL(o);return l.protocol=l.protocol.toLowerCase(),l.hostname=l.hostname.toLowerCase(),l.toString()}return o}c4.sanitizeUrl=oxe});function Hf(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}var SC=F(()=>{});function CC(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}var W$=F(()=>{});function qf(t){let e,r,n;t.length!==2?(e=Hf,r=(o,l)=>Hf(t(o),l),n=(o,l)=>t(o)-l):(e=t===Hf||t===CC?t:lxe,r=t,n=t);function i(o,l,u=0,h=o.length){if(u>>1;r(o[f],l)<0?u=f+1:h=f}while(u>>1;r(o[f],l)<=0?u=f+1:h=f}while(uu&&n(o[f-1],l)>-n(o[f],l)?f-1:f}return{left:i,center:s,right:a}}function lxe(){return 0}var AC=F(()=>{SC();W$()});function _C(t){return t===null?NaN:+t}var H$=F(()=>{});var q$,Y$,cxe,uxe,LC,X$=F(()=>{SC();AC();H$();q$=qf(Hf),Y$=q$.right,cxe=q$.left,uxe=qf(_C).center,LC=Y$});function j$({_intern:t,_key:e},r){let n=e(r);return t.has(n)?t.get(n):r}function hxe({_intern:t,_key:e},r){let n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function fxe({_intern:t,_key:e},r){let n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function dxe(t){return t!==null&&typeof t=="object"?t.valueOf():t}var fp,K$=F(()=>{fp=class extends Map{constructor(e,r=dxe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(let[n,i]of e)this.set(n,i)}get(e){return super.get(j$(this,e))}has(e){return super.has(j$(this,e))}set(e,r){return super.set(hxe(this,e),r)}delete(e){return super.delete(fxe(this,e))}}});function u4(t,e,r){let n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),s=a>=pxe?10:a>=gxe?5:a>=mxe?2:1,o,l,u;return i<0?(u=Math.pow(10,-i)/s,o=Math.round(t*u),l=Math.round(e*u),o/ue&&--l,u=-u):(u=Math.pow(10,i)*s,o=Math.round(t/u),l=Math.round(e/u),o*ue&&--l),l0))return[];if(t===e)return[t];let n=e=i))return[];let o=a-i+1,l=new Array(o);if(n)if(s<0)for(let u=0;u{pxe=Math.sqrt(50),gxe=Math.sqrt(10),mxe=Math.sqrt(2)});function f4(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r=i)&&(r=i)}return r}var Q$=F(()=>{});function d4(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var J$=F(()=>{});function p4(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++n{});var gh=F(()=>{X$();AC();Q$();J$();eG();Z$();K$()});function tG(t){return t}var rG=F(()=>{});function vxe(t){return"translate("+t+",0)"}function yxe(t){return"translate(0,"+t+")"}function xxe(t){return e=>+t(e)}function bxe(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function wxe(){return!this.__axis}function iG(t,e){var r=[],n=null,i=null,a=6,s=6,o=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=t===m4||t===g4?-1:1,h=t===g4||t===RC?"x":"y",f=t===m4||t===NC?vxe:yxe;function d(p){var g=n??(e.ticks?e.ticks.apply(e,r):e.domain()),m=i??(e.tickFormat?e.tickFormat.apply(e,r):tG),y=Math.max(a,0)+o,x=e.range(),b=+x[0]+l,w=+x[x.length-1]+l,_=(e.bandwidth?bxe:xxe)(e.copy(),l),k=p.selection?p.selection():p,E=k.selectAll(".domain").data([null]),L=k.selectAll(".tick").data(g,e).order(),S=L.exit(),C=L.enter().append("g").attr("class","tick"),M=L.select("line"),R=L.select("text");E=E.merge(E.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),L=L.merge(C),M=M.merge(C.append("line").attr("stroke","currentColor").attr(h+"2",u*a)),R=R.merge(C.append("text").attr("fill","currentColor").attr(h,u*y).attr("dy",t===m4?"0em":t===NC?"0.71em":"0.32em")),p!==k&&(E=E.transition(p),L=L.transition(p),M=M.transition(p),R=R.transition(p),S=S.transition(p).attr("opacity",nG).attr("transform",function(T){return isFinite(T=_(T))?f(T+l):this.getAttribute("transform")}),C.attr("opacity",nG).attr("transform",function(T){var I=this.parentNode.__axis;return f((I&&isFinite(I=I(T))?I:_(T))+l)})),S.remove(),E.attr("d",t===g4||t===RC?s?"M"+u*s+","+b+"H"+l+"V"+w+"H"+u*s:"M"+l+","+b+"V"+w:s?"M"+b+","+u*s+"V"+l+"H"+w+"V"+u*s:"M"+b+","+l+"H"+w),L.attr("opacity",1).attr("transform",function(T){return f(_(T)+l)}),M.attr(h+"2",u*a),R.attr(h,u*y).text(m),k.filter(wxe).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===RC?"start":t===g4?"end":"middle"),k.each(function(){this.__axis=_})}return d.scale=function(p){return arguments.length?(e=p,d):e},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),d):r.slice()},d.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),d):n&&n.slice()},d.tickFormat=function(p){return arguments.length?(i=p,d):i},d.tickSize=function(p){return arguments.length?(a=s=+p,d):a},d.tickSizeInner=function(p){return arguments.length?(a=+p,d):a},d.tickSizeOuter=function(p){return arguments.length?(s=+p,d):s},d.tickPadding=function(p){return arguments.length?(o=+p,d):o},d.offset=function(p){return arguments.length?(l=+p,d):l},d}function IC(t){return iG(m4,t)}function MC(t){return iG(NC,t)}var m4,RC,NC,g4,nG,aG=F(()=>{rG();m4=1,RC=2,NC=3,g4=4,nG=1e-6});var sG=F(()=>{aG()});function lG(){for(var t=0,e=arguments.length,r={},n;t=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}function Exe(t,e){for(var r=0,n=t.length,i;r{kxe={value:()=>{}};v4.prototype=lG.prototype={constructor:v4,on:function(t,e){var r=this._,n=Txe(t+"",r),i,a=-1,s=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n{cG()});var y4,PC,BC=F(()=>{y4="http://www.w3.org/1999/xhtml",PC={svg:"http://www.w3.org/2000/svg",xhtml:y4,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function lu(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),PC.hasOwnProperty(e)?{space:PC[e],local:t}:t}var x4=F(()=>{BC()});function Sxe(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===y4&&e.documentElement.namespaceURI===y4?e.createElement(t):e.createElementNS(r,t)}}function Cxe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function b4(t){var e=lu(t);return(e.local?Cxe:Sxe)(e)}var FC=F(()=>{x4();BC()});function Axe(){}function Yf(t){return t==null?Axe:function(){return this.querySelector(t)}}var w4=F(()=>{});function uG(t){typeof t!="function"&&(t=Yf(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i{ol();w4()});function zC(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}var fG=F(()=>{});function _xe(){return[]}function X1(t){return t==null?_xe:function(){return this.querySelectorAll(t)}}var $C=F(()=>{});function Lxe(t){return function(){return zC(t.apply(this,arguments))}}function dG(t){typeof t=="function"?t=Lxe(t):t=X1(t);for(var e=this._groups,r=e.length,n=[],i=[],a=0;a{ol();fG();$C()});function j1(t){return function(){return this.matches(t)}}function k4(t){return function(e){return e.matches(t)}}var K1=F(()=>{});function Nxe(t){return function(){return Rxe.call(this.children,t)}}function Ixe(){return this.firstElementChild}function gG(t){return this.select(t==null?Ixe:Nxe(typeof t=="function"?t:k4(t)))}var Rxe,mG=F(()=>{K1();Rxe=Array.prototype.find});function Dxe(){return Array.from(this.children)}function Oxe(t){return function(){return Mxe.call(this.children,t)}}function vG(t){return this.selectAll(t==null?Dxe:Oxe(typeof t=="function"?t:k4(t)))}var Mxe,yG=F(()=>{K1();Mxe=Array.prototype.filter});function xG(t){typeof t!="function"&&(t=j1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i{ol();K1()});function T4(t){return new Array(t.length)}var GC=F(()=>{});function wG(){return new Zn(this._enter||this._groups.map(T4),this._parents)}function Z1(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}var UC=F(()=>{GC();ol();Z1.prototype={constructor:Z1,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}}});function kG(t){return function(){return t}}var TG=F(()=>{});function Pxe(t,e,r,n,i,a){for(var s=0,o,l=e.length,u=a.length;s=w&&(w=b+1);!(k=y[w])&&++w{ol();UC();TG()});function CG(){return new Zn(this._exit||this._groups.map(T4),this._parents)}var AG=F(()=>{GC();ol()});function _G(t,e,r){var n=this.enter(),i=this,a=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}var LG=F(()=>{});function RG(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,i=r.length,a=n.length,s=Math.min(i,a),o=new Array(i),l=0;l{ol()});function IG(){for(var t=this._groups,e=-1,r=t.length;++e=0;)(s=n[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}var MG=F(()=>{});function DG(t){t||(t=$xe);function e(f,d){return f&&d?t(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;ae?1:t>=e?0:NaN}var OG=F(()=>{ol()});function PG(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}var BG=F(()=>{});function FG(){return Array.from(this)}var zG=F(()=>{});function $G(){for(var t=this._groups,e=0,r=t.length;e{});function UG(){let t=0;for(let e of this)++t;return t}var VG=F(()=>{});function WG(){return!this.node()}var HG=F(()=>{});function qG(t){for(var e=this._groups,r=0,n=e.length;r{});function Gxe(t){return function(){this.removeAttribute(t)}}function Uxe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Vxe(t,e){return function(){this.setAttribute(t,e)}}function Wxe(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Hxe(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function qxe(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function XG(t,e){var r=lu(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?Uxe:Gxe:typeof e=="function"?r.local?qxe:Hxe:r.local?Wxe:Vxe)(r,e))}var jG=F(()=>{x4()});function E4(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}var VC=F(()=>{});function Yxe(t){return function(){this.style.removeProperty(t)}}function Xxe(t,e,r){return function(){this.style.setProperty(t,e,r)}}function jxe(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function KG(t,e,r){return arguments.length>1?this.each((e==null?Yxe:typeof e=="function"?jxe:Xxe)(t,e,r??"")):mh(this.node(),t)}function mh(t,e){return t.style.getPropertyValue(e)||E4(t).getComputedStyle(t,null).getPropertyValue(e)}var WC=F(()=>{VC()});function Kxe(t){return function(){delete this[t]}}function Zxe(t,e){return function(){this[t]=e}}function Qxe(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function ZG(t,e){return arguments.length>1?this.each((e==null?Kxe:typeof e=="function"?Qxe:Zxe)(t,e)):this.node()[t]}var QG=F(()=>{});function JG(t){return t.trim().split(/^|\s+/)}function HC(t){return t.classList||new eU(t)}function eU(t){this._node=t,this._names=JG(t.getAttribute("class")||"")}function tU(t,e){for(var r=HC(t),n=-1,i=e.length;++n{eU.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}}});function rbe(){this.textContent=""}function nbe(t){return function(){this.textContent=t}}function ibe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function aU(t){return arguments.length?this.each(t==null?rbe:(typeof t=="function"?ibe:nbe)(t)):this.node().textContent}var sU=F(()=>{});function abe(){this.innerHTML=""}function sbe(t){return function(){this.innerHTML=t}}function obe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function oU(t){return arguments.length?this.each(t==null?abe:(typeof t=="function"?obe:sbe)(t)):this.node().innerHTML}var lU=F(()=>{});function lbe(){this.nextSibling&&this.parentNode.appendChild(this)}function cU(){return this.each(lbe)}var uU=F(()=>{});function cbe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function hU(){return this.each(cbe)}var fU=F(()=>{});function dU(t){var e=typeof t=="function"?t:b4(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}var pU=F(()=>{FC()});function ube(){return null}function gU(t,e){var r=typeof t=="function"?t:b4(t),n=e==null?ube:typeof e=="function"?e:Yf(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}var mU=F(()=>{FC();w4()});function hbe(){var t=this.parentNode;t&&t.removeChild(this)}function vU(){return this.each(hbe)}var yU=F(()=>{});function fbe(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function dbe(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function xU(t){return this.select(t?dbe:fbe)}var bU=F(()=>{});function wU(t){return arguments.length?this.property("__data__",t):this.node().__data__}var kU=F(()=>{});function pbe(t){return function(e){t.call(this,e,this.__data__)}}function gbe(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function mbe(t){return function(){var e=this.__on;if(e){for(var r=0,n=-1,i=e.length,a;r{});function SU(t,e,r){var n=E4(t),i=n.CustomEvent;typeof i=="function"?i=new i(e,r):(i=n.document.createEvent("Event"),r?(i.initEvent(e,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ybe(t,e){return function(){return SU(this,t,e)}}function xbe(t,e){return function(){return SU(this,t,e.apply(this,arguments))}}function CU(t,e){return this.each((typeof e=="function"?xbe:ybe)(t,e))}var AU=F(()=>{VC()});function*_U(){for(var t=this._groups,e=0,r=t.length;e{});function Zn(t,e){this._groups=t,this._parents=e}function RU(){return new Zn([[document.documentElement]],qC)}function bbe(){return this}var qC,cu,ol=F(()=>{hG();pG();mG();yG();bG();SG();UC();AG();LG();NG();MG();OG();BG();zG();GG();VG();HG();YG();jG();WC();QG();iU();sU();lU();uU();fU();pU();mU();yU();bU();kU();EU();AU();LU();qC=[null];Zn.prototype=RU.prototype={constructor:Zn,select:uG,selectAll:dG,selectChild:gG,selectChildren:vG,filter:xG,data:EG,enter:wG,exit:CG,join:_G,merge:RG,selection:bbe,order:IG,sort:DG,call:PG,nodes:FG,node:$G,size:UG,empty:WG,each:qG,attr:XG,style:KG,property:ZG,classed:nU,text:aU,html:oU,raise:cU,lower:hU,append:dU,insert:gU,remove:vU,clone:xU,datum:wU,on:TU,dispatch:CU,[Symbol.iterator]:_U};cu=RU});function Ve(t){return typeof t=="string"?new Zn([[document.querySelector(t)]],[document.documentElement]):new Zn([[t]],qC)}var NU=F(()=>{ol()});var ll=F(()=>{K1();x4();NU();ol();w4();$C();WC()});var IU=F(()=>{});function Xf(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function pp(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}var YC=F(()=>{});function vh(){}function DU(){return this.rgb().formatHex()}function _be(){return this.rgb().formatHex8()}function Lbe(){return GU(this).formatHsl()}function OU(){return this.rgb().formatRgb()}function ul(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=wbe.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?PU(e):r===3?new ra(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?S4(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?S4(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=kbe.exec(t))?new ra(e[1],e[2],e[3],1):(e=Tbe.exec(t))?new ra(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Ebe.exec(t))?S4(e[1],e[2],e[3],e[4]):(e=Sbe.exec(t))?S4(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Cbe.exec(t))?zU(e[1],e[2]/100,e[3]/100,1):(e=Abe.exec(t))?zU(e[1],e[2]/100,e[3]/100,e[4]):MU.hasOwnProperty(t)?PU(MU[t]):t==="transparent"?new ra(NaN,NaN,NaN,0):null}function PU(t){return new ra(t>>16&255,t>>8&255,t&255,1)}function S4(t,e,r,n){return n<=0&&(t=e=r=NaN),new ra(t,e,r,n)}function jC(t){return t instanceof vh||(t=ul(t)),t?(t=t.rgb(),new ra(t.r,t.g,t.b,t.opacity)):new ra}function mp(t,e,r,n){return arguments.length===1?jC(t):new ra(t,e,r,n??1)}function ra(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function BU(){return`#${jf(this.r)}${jf(this.g)}${jf(this.b)}`}function Rbe(){return`#${jf(this.r)}${jf(this.g)}${jf(this.b)}${jf((isNaN(this.opacity)?1:this.opacity)*255)}`}function FU(){let t=_4(this.opacity);return`${t===1?"rgb(":"rgba("}${Kf(this.r)}, ${Kf(this.g)}, ${Kf(this.b)}${t===1?")":`, ${t})`}`}function _4(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Kf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function jf(t){return t=Kf(t),(t<16?"0":"")+t.toString(16)}function zU(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new cl(t,e,r,n)}function GU(t){if(t instanceof cl)return new cl(t.h,t.s,t.l,t.opacity);if(t instanceof vh||(t=ul(t)),!t)return new cl;if(t instanceof cl)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),s=NaN,o=a-i,l=(a+i)/2;return o?(e===a?s=(r-n)/o+(r0&&l<1?0:s,new cl(s,o,l,t.opacity)}function UU(t,e,r,n){return arguments.length===1?GU(t):new cl(t,e,r,n??1)}function cl(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function $U(t){return t=(t||0)%360,t<0?t+360:t}function C4(t){return Math.max(0,Math.min(1,t||0))}function XC(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}var Q1,A4,gp,J1,rc,wbe,kbe,Tbe,Ebe,Sbe,Cbe,Abe,MU,KC=F(()=>{YC();Q1=.7,A4=1/Q1,gp="\\s*([+-]?\\d+)\\s*",J1="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wbe=/^#([0-9a-f]{3,8})$/,kbe=new RegExp(`^rgb\\(${gp},${gp},${gp}\\)$`),Tbe=new RegExp(`^rgb\\(${rc},${rc},${rc}\\)$`),Ebe=new RegExp(`^rgba\\(${gp},${gp},${gp},${J1}\\)$`),Sbe=new RegExp(`^rgba\\(${rc},${rc},${rc},${J1}\\)$`),Cbe=new RegExp(`^hsl\\(${J1},${rc},${rc}\\)$`),Abe=new RegExp(`^hsla\\(${J1},${rc},${rc},${J1}\\)$`),MU={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Xf(vh,ul,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:DU,formatHex:DU,formatHex8:_be,formatHsl:Lbe,formatRgb:OU,toString:OU});Xf(ra,mp,pp(vh,{brighter(t){return t=t==null?A4:Math.pow(A4,t),new ra(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Q1:Math.pow(Q1,t),new ra(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ra(Kf(this.r),Kf(this.g),Kf(this.b),_4(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:BU,formatHex:BU,formatHex8:Rbe,formatRgb:FU,toString:FU}));Xf(cl,UU,pp(vh,{brighter(t){return t=t==null?A4:Math.pow(A4,t),new cl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Q1:Math.pow(Q1,t),new cl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new ra(XC(t>=240?t-240:t+120,i,n),XC(t,i,n),XC(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new cl($U(this.h),C4(this.s),C4(this.l),_4(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=_4(this.opacity);return`${t===1?"hsl(":"hsla("}${$U(this.h)}, ${C4(this.s)*100}%, ${C4(this.l)*100}%${t===1?")":`, ${t})`}`}}))});var VU,WU,HU=F(()=>{VU=Math.PI/180,WU=180/Math.PI});function ZU(t){if(t instanceof nc)return new nc(t.l,t.a,t.b,t.opacity);if(t instanceof uu)return QU(t);t instanceof ra||(t=jC(t));var e=e7(t.r),r=e7(t.g),n=e7(t.b),i=ZC((.2225045*e+.7168786*r+.0606169*n)/YU),a,s;return e===r&&r===n?a=s=i:(a=ZC((.4360747*e+.3850649*r+.1430804*n)/qU),s=ZC((.0139322*e+.0971045*r+.7141733*n)/XU)),new nc(116*i-16,500*(a-i),200*(i-s),t.opacity)}function t7(t,e,r,n){return arguments.length===1?ZU(t):new nc(t,e,r,n??1)}function nc(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function ZC(t){return t>Nbe?Math.pow(t,1/3):t/KU+jU}function QC(t){return t>vp?t*t*t:KU*(t-jU)}function JC(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function e7(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ibe(t){if(t instanceof uu)return new uu(t.h,t.c,t.l,t.opacity);if(t instanceof nc||(t=ZU(t)),t.a===0&&t.b===0)return new uu(NaN,0{YC();KC();HU();L4=18,qU=.96422,YU=1,XU=.82521,jU=4/29,vp=6/29,KU=3*vp*vp,Nbe=vp*vp*vp;Xf(nc,t7,pp(vh,{brighter(t){return new nc(this.l+L4*(t??1),this.a,this.b,this.opacity)},darker(t){return new nc(this.l-L4*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return e=qU*QC(e),t=YU*QC(t),r=XU*QC(r),new ra(JC(3.1338561*e-1.6168667*t-.4906146*r),JC(-.9787684*e+1.9161415*t+.033454*r),JC(.0719453*e-.2289914*t+1.4052427*r),this.opacity)}}));Xf(uu,ev,pp(vh,{brighter(t){return new uu(this.h,this.c,this.l+L4*(t??1),this.opacity)},darker(t){return new uu(this.h,this.c,this.l-L4*(t??1),this.opacity)},rgb(){return QU(this).rgb()}}))});var yp=F(()=>{KC();JU()});function r7(t,e,r,n,i){var a=t*t,s=a*t;return((1-3*t+3*a-s)*e+(4-6*a+3*s)*r+(1+3*t+3*a-3*s)*n+s*i)/6}function eV(t){var e=t.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),i=t[n],a=t[n+1],s=n>0?t[n-1]:2*i-a,o=n{});function tV(t){var e=t.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*e),i=t[(n+e-1)%e],a=t[n%e],s=t[(n+1)%e],o=t[(n+2)%e];return r7((r-n/e)*e,i,a,s,o)}}var rV=F(()=>{n7()});var xp,i7=F(()=>{xp=t=>()=>t});function nV(t,e){return function(r){return t+r*e}}function Mbe(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function iV(t,e){var r=e-t;return r?nV(t,r>180||r<-180?r-360*Math.round(r/360):r):xp(isNaN(t)?e:t)}function aV(t){return(t=+t)==1?hu:function(e,r){return r-e?Mbe(e,r,t):xp(isNaN(e)?r:e)}}function hu(t,e){var r=e-t;return r?nV(t,r):xp(isNaN(t)?e:t)}var a7=F(()=>{i7()});function sV(t){return function(e){var r=e.length,n=new Array(r),i=new Array(r),a=new Array(r),s,o;for(s=0;s{yp();n7();rV();a7();Zf=function t(e){var r=aV(e);function n(i,a){var s=r((i=mp(i)).r,(a=mp(a)).r),o=r(i.g,a.g),l=r(i.b,a.b),u=hu(i.opacity,a.opacity);return function(h){return i.r=s(h),i.g=o(h),i.b=l(h),i.opacity=u(h),i+""}}return n.gamma=t,n}(1);Dbe=sV(eV),Obe=sV(tV)});function oV(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(a){for(i=0;i{});function uV(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),a=new Array(r),s;for(s=0;s{R4()});function fV(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}var dV=F(()=>{});function na(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var tv=F(()=>{});function pV(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=Qf(t[i],e[i]):n[i]=e[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var gV=F(()=>{R4()});function Pbe(t){return function(){return t}}function Bbe(t){return function(e){return t(e)+""}}function rv(t,e){var r=l7.lastIndex=o7.lastIndex=0,n,i,a,s=-1,o=[],l=[];for(t=t+"",e=e+"";(n=l7.exec(t))&&(i=o7.exec(e));)(a=i.index)>r&&(a=e.slice(r,a),o[s]?o[s]+=a:o[++s]=a),(n=n[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,l.push({i:s,x:na(n,i)})),r=o7.lastIndex;return r{tv();l7=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,o7=new RegExp(l7.source,"g")});function Qf(t,e){var r=typeof e,n;return e==null||r==="boolean"?xp(e):(r==="number"?na:r==="string"?(n=ul(e))?(e=n,Zf):rv:e instanceof ul?Zf:e instanceof Date?fV:lV(e)?oV:Array.isArray(e)?uV:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?pV:na)(t,e)}var R4=F(()=>{yp();s7();hV();dV();tv();gV();c7();i7();cV()});function u7(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}var mV=F(()=>{});function h7(t,e,r,n,i,a){var s,o,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,l/=o),t*n{vV=180/Math.PI,N4={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}});function xV(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?N4:h7(e.a,e.b,e.c,e.d,e.e,e.f)}function bV(t){return t==null?N4:(I4||(I4=document.createElementNS("http://www.w3.org/2000/svg","g")),I4.setAttribute("transform",t),(t=I4.transform.baseVal.consolidate())?(t=t.matrix,h7(t.a,t.b,t.c,t.d,t.e,t.f)):N4)}var I4,wV=F(()=>{yV()});function kV(t,e,r,n){function i(u){return u.length?u.pop()+" ":""}function a(u,h,f,d,p,g){if(u!==f||h!==d){var m=p.push("translate(",null,e,null,r);g.push({i:m-4,x:na(u,f)},{i:m-2,x:na(h,d)})}else(f||d)&&p.push("translate("+f+e+d+r)}function s(u,h,f,d){u!==h?(u-h>180?h+=360:h-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:na(u,h)})):h&&f.push(i(f)+"rotate("+h+n)}function o(u,h,f,d){u!==h?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:na(u,h)}):h&&f.push(i(f)+"skewX("+h+n)}function l(u,h,f,d,p,g){if(u!==f||h!==d){var m=p.push(i(p)+"scale(",null,",",null,")");g.push({i:m-4,x:na(u,f)},{i:m-2,x:na(h,d)})}else(f!==1||d!==1)&&p.push(i(p)+"scale("+f+","+d+")")}return function(u,h){var f=[],d=[];return u=t(u),h=t(h),a(u.translateX,u.translateY,h.translateX,h.translateY,f,d),s(u.rotate,h.rotate,f,d),o(u.skewX,h.skewX,f,d),l(u.scaleX,u.scaleY,h.scaleX,h.scaleY,f,d),u=h=null,function(p){for(var g=-1,m=d.length,y;++g{tv();wV();f7=kV(xV,"px, ","px)","deg)"),d7=kV(bV,", ",")",")")});function EV(t){return function(e,r){var n=t((e=ev(e)).h,(r=ev(r)).h),i=hu(e.c,r.c),a=hu(e.l,r.l),s=hu(e.opacity,r.opacity);return function(o){return e.h=n(o),e.c=i(o),e.l=a(o),e.opacity=s(o),e+""}}}var p7,Fbe,SV=F(()=>{yp();a7();p7=EV(iV),Fbe=EV(hu)});var bp=F(()=>{R4();tv();mV();c7();TV();s7();SV()});function lv(){return Jf||(_V(zbe),Jf=sv.now()+O4)}function zbe(){Jf=0}function ov(){this._call=this._time=this._next=null}function P4(t,e,r){var n=new ov;return n.restart(t,e,r),n}function LV(){lv(),++wp;for(var t=M4,e;t;)(e=Jf-t._time)>=0&&t._call.call(void 0,e),t=t._next;--wp}function CV(){Jf=(D4=sv.now())+O4,wp=iv=0;try{LV()}finally{wp=0,Gbe(),Jf=0}}function $be(){var t=sv.now(),e=t-D4;e>AV&&(O4-=e,D4=t)}function Gbe(){for(var t,e=M4,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:M4=r);av=t,g7(n)}function g7(t){if(!wp){iv&&(iv=clearTimeout(iv));var e=t-Jf;e>24?(t<1/0&&(iv=setTimeout(CV,t-sv.now()-O4)),nv&&(nv=clearInterval(nv))):(nv||(D4=sv.now(),nv=setInterval($be,AV)),wp=1,_V(CV))}}var wp,iv,nv,AV,M4,av,D4,Jf,O4,sv,_V,m7=F(()=>{wp=0,iv=0,nv=0,AV=1e3,D4=0,Jf=0,O4=0,sv=typeof performance=="object"&&performance.now?performance:Date,_V=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};ov.prototype=P4.prototype={constructor:ov,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?lv():+r)+(e==null?0:+e),!this._next&&av!==this&&(av?av._next=this:M4=this,av=this),this._call=t,this._time=r,g7()},stop:function(){this._call&&(this._call=null,this._time=1/0,g7())}}});function B4(t,e,r){var n=new ov;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}var RV=F(()=>{m7()});var F4=F(()=>{m7();RV()});function yh(t,e,r,n,i,a){var s=t.__transition;if(!s)t.__transition={};else if(r in s)return;Wbe(t,r,{name:e,index:n,group:i,on:Ube,tween:Vbe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:MV})}function uv(t,e){var r=Ci(t,e);if(r.state>MV)throw new Error("too late; already scheduled");return r}function ia(t,e){var r=Ci(t,e);if(r.state>z4)throw new Error("too late; already running");return r}function Ci(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function Wbe(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=P4(a,0,r.time);function a(u){r.state=NV,r.timer.restart(s,r.delay,r.time),r.delay<=u&&s(u-r.delay)}function s(u){var h,f,d,p;if(r.state!==NV)return l();for(h in n)if(p=n[h],p.name===r.name){if(p.state===z4)return B4(s);p.state===IV?(p.state=cv,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[h]):+h{OC();F4();Ube=DC("start","end","cancel","interrupt"),Vbe=[],MV=0,NV=1,$4=2,z4=3,IV=4,G4=5,cv=6});function U4(t,e){var r=t.__transition,n,i,a=!0,s;if(r){e=e==null?null:e+"";for(s in r){if((n=r[s]).name!==e){a=!1;continue}i=n.state>$4&&n.state{gs()});function OV(t){return this.each(function(){U4(this,t)})}var PV=F(()=>{DV()});function Hbe(t,e){var r,n;return function(){var i=ia(this,t),a=i.tween;if(a!==r){n=r=a;for(var s=0,o=n.length;s{gs()});function V4(t,e){var r;return(typeof e=="number"?na:e instanceof ul?Zf:(r=ul(e))?(e=r,Zf):rv)(t,e)}var v7=F(()=>{yp();bp()});function Ybe(t){return function(){this.removeAttribute(t)}}function Xbe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function jbe(t,e,r){var n,i=r+"",a;return function(){var s=this.getAttribute(t);return s===i?null:s===n?a:a=e(n=s,r)}}function Kbe(t,e,r){var n,i=r+"",a;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===n?a:a=e(n=s,r)}}function Zbe(t,e,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=e(n=s,o)))}}function Qbe(t,e,r){var n,i,a;return function(){var s,o=r(this),l;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),l=o+"",s===l?null:s===n&&l===i?a:(i=l,a=e(n=s,o)))}}function FV(t,e){var r=lu(t),n=r==="transform"?d7:V4;return this.attrTween(t,typeof e=="function"?(r.local?Qbe:Zbe)(r,n,kp(this,"attr."+t,e)):e==null?(r.local?Xbe:Ybe)(r):(r.local?Kbe:jbe)(r,n,e))}var zV=F(()=>{bp();ll();hv();v7()});function Jbe(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function e4e(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function t4e(t,e){var r,n;function i(){var a=e.apply(this,arguments);return a!==n&&(r=(n=a)&&e4e(t,a)),r}return i._value=e,i}function r4e(t,e){var r,n;function i(){var a=e.apply(this,arguments);return a!==n&&(r=(n=a)&&Jbe(t,a)),r}return i._value=e,i}function $V(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;var n=lu(t);return this.tween(r,(n.local?t4e:r4e)(n,e))}var GV=F(()=>{ll()});function n4e(t,e){return function(){uv(this,t).delay=+e.apply(this,arguments)}}function i4e(t,e){return e=+e,function(){uv(this,t).delay=e}}function UV(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?n4e:i4e)(e,t)):Ci(this.node(),e).delay}var VV=F(()=>{gs()});function a4e(t,e){return function(){ia(this,t).duration=+e.apply(this,arguments)}}function s4e(t,e){return e=+e,function(){ia(this,t).duration=e}}function WV(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?a4e:s4e)(e,t)):Ci(this.node(),e).duration}var HV=F(()=>{gs()});function o4e(t,e){if(typeof e!="function")throw new Error;return function(){ia(this,t).ease=e}}function qV(t){var e=this._id;return arguments.length?this.each(o4e(e,t)):Ci(this.node(),e).ease}var YV=F(()=>{gs()});function l4e(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;ia(this,t).ease=r}}function XV(t){if(typeof t!="function")throw new Error;return this.each(l4e(this._id,t))}var jV=F(()=>{gs()});function KV(t){typeof t!="function"&&(t=j1(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i{ll();ed()});function QV(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,i=r.length,a=Math.min(n,i),s=new Array(n),o=0;o{ed()});function c4e(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function u4e(t,e,r){var n,i,a=c4e(e)?uv:ia;return function(){var s=a(this,t),o=s.on;o!==n&&(i=(n=o).copy()).on(e,r),s.on=i}}function eW(t,e){var r=this._id;return arguments.length<2?Ci(this.node(),r).on.on(t):this.each(u4e(r,t,e))}var tW=F(()=>{gs()});function h4e(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function rW(){return this.on("end.remove",h4e(this._id))}var nW=F(()=>{});function iW(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Yf(t));for(var n=this._groups,i=n.length,a=new Array(i),s=0;s{ll();ed();gs()});function sW(t){var e=this._name,r=this._id;typeof t!="function"&&(t=X1(t));for(var n=this._groups,i=n.length,a=[],s=[],o=0;o{ll();ed();gs()});function lW(){return new f4e(this._groups,this._parents)}var f4e,cW=F(()=>{ll();f4e=cu.prototype.constructor});function d4e(t,e){var r,n,i;return function(){var a=mh(this,t),s=(this.style.removeProperty(t),mh(this,t));return a===s?null:a===r&&s===n?i:i=e(r=a,n=s)}}function uW(t){return function(){this.style.removeProperty(t)}}function p4e(t,e,r){var n,i=r+"",a;return function(){var s=mh(this,t);return s===i?null:s===n?a:a=e(n=s,r)}}function g4e(t,e,r){var n,i,a;return function(){var s=mh(this,t),o=r(this),l=o+"";return o==null&&(l=o=(this.style.removeProperty(t),mh(this,t))),s===l?null:s===n&&l===i?a:(i=l,a=e(n=s,o))}}function m4e(t,e){var r,n,i,a="style."+e,s="end."+a,o;return function(){var l=ia(this,t),u=l.on,h=l.value[a]==null?o||(o=uW(e)):void 0;(u!==r||i!==h)&&(n=(r=u).copy()).on(s,i=h),l.on=n}}function hW(t,e,r){var n=(t+="")=="transform"?f7:V4;return e==null?this.styleTween(t,d4e(t,n)).on("end.style."+t,uW(t)):typeof e=="function"?this.styleTween(t,g4e(t,n,kp(this,"style."+t,e))).each(m4e(this._id,t)):this.styleTween(t,p4e(t,n,e),r).on("end.style."+t,null)}var fW=F(()=>{bp();ll();gs();hv();v7()});function v4e(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function y4e(t,e,r){var n,i;function a(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&v4e(t,s,r)),n}return a._value=e,a}function dW(t,e,r){var n="style."+(t+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,y4e(t,e,r??""))}var pW=F(()=>{});function x4e(t){return function(){this.textContent=t}}function b4e(t){return function(){var e=t(this);this.textContent=e??""}}function gW(t){return this.tween("text",typeof t=="function"?b4e(kp(this,"text",t)):x4e(t==null?"":t+""))}var mW=F(()=>{hv()});function w4e(t){return function(e){this.textContent=t.call(this,e)}}function k4e(t){var e,r;function n(){var i=t.apply(this,arguments);return i!==r&&(e=(r=i)&&w4e(i)),e}return n._value=t,n}function vW(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,k4e(t))}var yW=F(()=>{});function xW(){for(var t=this._name,e=this._id,r=W4(),n=this._groups,i=n.length,a=0;a{ed();gs()});function wW(){var t,e,r=this,n=r._id,i=r.size();return new Promise(function(a,s){var o={value:s},l={value:function(){--i===0&&a()}};r.each(function(){var u=ia(this,n),h=u.on;h!==t&&(e=(t=h).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(l)),u.on=e}),i===0&&a()})}var kW=F(()=>{gs()});function qa(t,e,r,n){this._groups=t,this._parents=e,this._name=r,this._id=n}function TW(t){return cu().transition(t)}function W4(){return++T4e}var T4e,fu,ed=F(()=>{ll();zV();GV();VV();HV();YV();jV();ZV();JV();tW();nW();aW();oW();cW();fW();pW();mW();yW();bW();hv();kW();T4e=0;fu=cu.prototype;qa.prototype=TW.prototype={constructor:qa,select:iW,selectAll:sW,selectChild:fu.selectChild,selectChildren:fu.selectChildren,filter:KV,merge:QV,selection:lW,transition:xW,call:fu.call,nodes:fu.nodes,node:fu.node,size:fu.size,empty:fu.empty,each:fu.each,on:eW,attr:FV,attrTween:$V,style:hW,styleTween:dW,text:gW,textTween:vW,remove:rW,tween:BV,delay:UV,duration:WV,ease:qV,easeVarying:XV,end:wW,[Symbol.iterator]:fu[Symbol.iterator]}});function H4(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var EW=F(()=>{});var y7=F(()=>{EW()});function S4e(t,e){for(var r;!(r=t.__transition)||!(r=r[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return r}function SW(t){var e,r;t instanceof qa?(e=t._id,t=t._name):(e=W4(),(r=E4e).time=lv(),t=t==null?null:t+"");for(var n=this._groups,i=n.length,a=0;a{ed();gs();y7();F4();E4e={time:null,delay:0,duration:250,ease:H4}});var AW=F(()=>{ll();PV();CW();cu.prototype.interrupt=OV;cu.prototype.transition=SW});var q4=F(()=>{AW()});var _W=F(()=>{});var LW=F(()=>{});var RW=F(()=>{});function NW(t){return[+t[0],+t[1]]}function C4e(t){return[NW(t[0]),NW(t[1])]}function x7(t){return{type:t}}var kct,Tct,Ect,Sct,Cct,Act,IW=F(()=>{q4();_W();LW();RW();({abs:kct,max:Tct,min:Ect}=Math);Sct={name:"x",handles:["w","e"].map(x7),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Cct={name:"y",handles:["n","s"].map(x7),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Act={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(x7),input:function(t){return t==null?null:C4e(t)},output:function(t){return t}}});var MW=F(()=>{IW()});function DW(t){this._+=t[0];for(let e=1,r=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return DW;let r=10**e;return function(n){this._+=n[0];for(let i=1,a=n.length;i{b7=Math.PI,w7=2*b7,td=1e-6,A4e=w7-td;rd=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?DW:_4e(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,a,s){this._append`C${+e},${+r},${+n},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(e,r,n,i,a){if(e=+e,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=n-e,u=i-r,h=s-e,f=o-r,d=h*h+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(d>td)if(!(Math.abs(f*l-u*h)>td)||!a)this._append`L${this._x1=e},${this._y1=r}`;else{let p=n-s,g=i-o,m=l*l+u*u,y=p*p+g*g,x=Math.sqrt(m),b=Math.sqrt(d),w=a*Math.tan((b7-Math.acos((m+d-y)/(2*x*b)))/2),_=w/b,k=w/x;Math.abs(_-1)>td&&this._append`L${e+_*h},${r+_*f}`,this._append`A${a},${a},0,0,${+(f*p>h*g)},${this._x1=e+k*l},${this._y1=r+k*u}`}}arc(e,r,n,i,a,s){if(e=+e,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(i),l=n*Math.sin(i),u=e+o,h=r+l,f=1^s,d=s?i-a:a-i;this._x1===null?this._append`M${u},${h}`:(Math.abs(this._x1-u)>td||Math.abs(this._y1-h)>td)&&this._append`L${u},${h}`,n&&(d<0&&(d=d%w7+w7),d>A4e?this._append`A${n},${n},0,1,${f},${e-o},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=h}`:d>td&&this._append`A${n},${n},0,${+(d>=b7)},${f},${this._x1=e+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};OW.prototype=rd.prototype});var k7=F(()=>{PW()});var BW=F(()=>{});var FW=F(()=>{});var zW=F(()=>{});var $W=F(()=>{});var GW=F(()=>{});var UW=F(()=>{});var VW=F(()=>{});function WW(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function nd(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}var fv=F(()=>{});function ic(t){return t=nd(Math.abs(t)),t?t[1]:NaN}var dv=F(()=>{fv()});function HW(t,e){return function(r,n){for(var i=r.length,a=[],s=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),a.push(r.substring(i-=o,i+o)),!((l+=o+1)>n));)o=t[s=(s+1)%t.length];return a.reverse().join(e)}}var qW=F(()=>{});function YW(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var XW=F(()=>{});function xh(t){if(!(e=L4e.exec(t)))throw new Error("invalid format: "+t);var e;return new Y4({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Y4(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}var L4e,T7=F(()=>{L4e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;xh.prototype=Y4.prototype;Y4.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function jW(t){e:for(var e=t.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var KW=F(()=>{});function ZW(t,e){var r=nd(t,e);if(!r)return t+"";var n=r[0],i=r[1],a=i-(E7=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+nd(t,Math.max(0,e+a-1))[0]}var E7,S7=F(()=>{fv()});function C7(t,e){var r=nd(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var QW=F(()=>{fv()});var A7,JW=F(()=>{fv();S7();QW();A7={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:WW,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>C7(t*100,e),r:C7,s:ZW,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)}});function _7(t){return t}var eH=F(()=>{});function nH(t){var e=t.grouping===void 0||t.thousands===void 0?_7:HW(tH.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?_7:YW(tH.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"\u2212":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=xh(f);var d=f.fill,p=f.align,g=f.sign,m=f.symbol,y=f.zero,x=f.width,b=f.comma,w=f.precision,_=f.trim,k=f.type;k==="n"?(b=!0,k="g"):A7[k]||(w===void 0&&(w=12),_=!0,k="g"),(y||d==="0"&&p==="=")&&(y=!0,d="0",p="=");var E=m==="$"?r:m==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():"",L=m==="$"?n:/[%p]/.test(k)?s:"",S=A7[k],C=/[defgprs%]/.test(k);w=w===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function M(R){var T=E,I=L,A,D,N;if(k==="c")I=S(R)+I,R="";else{R=+R;var O=R<0||1/R<0;if(R=isNaN(R)?l:S(Math.abs(R),w),_&&(R=jW(R)),O&&+R==0&&g!=="+"&&(O=!1),T=(O?g==="("?g:o:g==="-"||g==="("?"":g)+T,I=(k==="s"?rH[8+E7/3]:"")+I+(O&&g==="("?")":""),C){for(A=-1,D=R.length;++AN||N>57){I=(N===46?i+R.slice(A+1):R.slice(A))+I,R=R.slice(0,A);break}}}b&&!y&&(R=e(R,1/0));var B=T.length+R.length+I.length,P=B>1)+T+R+I+P.slice(B);break;default:R=P+T+R+I;break}return a(R)}return M.toString=function(){return f+""},M}function h(f,d){var p=u((f=xh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(ic(d)/3)))*3,m=Math.pow(10,-g),y=rH[8+g/3];return function(x){return p(m*x)+y}}return{format:u,formatPrefix:h}}var tH,rH,iH=F(()=>{dv();qW();XW();T7();KW();JW();S7();eH();tH=Array.prototype.map,rH=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"]});function L7(t){return X4=nH(t),j4=X4.format,K4=X4.formatPrefix,X4}var X4,j4,K4,aH=F(()=>{iH();L7({thousands:",",grouping:[3],currency:["$",""]})});function R7(t){return Math.max(0,-ic(Math.abs(t)))}var sH=F(()=>{dv()});function N7(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ic(e)/3)))*3-ic(Math.abs(t)))}var oH=F(()=>{dv()});function I7(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ic(e)-ic(t))+1}var lH=F(()=>{dv()});var M7=F(()=>{aH();T7();sH();oH();lH()});var cH=F(()=>{});var uH=F(()=>{});var hH=F(()=>{});var fH=F(()=>{});function bh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}var pv=F(()=>{});function du(){var t=new fp,e=[],r=[],n=D7;function i(a){let s=t.get(a);if(s===void 0){if(n!==D7)return n;t.set(a,s=e.push(a)-1)}return r[s%r.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new fp;for(let s of a)t.has(s)||t.set(s,e.push(s)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return du(e,r).unknown(n)},bh.apply(i,arguments),i}var D7,O7=F(()=>{gh();pv();D7=Symbol("implicit")});function Tp(){var t=du().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,s,o=!1,l=0,u=0,h=.5;delete t.unknown;function f(){var d=e().length,p=i{gh();pv();O7()});function P7(t){return function(){return t}}var pH=F(()=>{});function B7(t){return+t}var gH=F(()=>{});function Ep(t){return t}function F7(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:P7(isNaN(e)?NaN:.5)}function R4e(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function N4e(t,e,r){var n=t[0],i=t[1],a=e[0],s=e[1];return i2?I4e:N4e,l=u=null,f}function f(d){return d==null||isNaN(d=+d)?a:(l||(l=o(t.map(n),e,r)))(n(s(d)))}return f.invert=function(d){return s(i((u||(u=o(e,t.map(n),na)))(d)))},f.domain=function(d){return arguments.length?(t=Array.from(d,B7),h()):t.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),h()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),r=u7,h()},f.clamp=function(d){return arguments.length?(s=d?!0:Ep,h()):s!==Ep},f.interpolate=function(d){return arguments.length?(r=d,h()):r},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,p){return n=d,i=p,h()}}function gv(){return M4e()(Ep,Ep)}var mH,z7=F(()=>{gh();bp();pH();gH();mH=[0,1]});function $7(t,e,r,n){var i=dp(t,e,r),a;switch(n=xh(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=N7(i,s))&&(n.precision=a),K4(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=I7(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=R7(i))&&(n.precision=a-(n.type==="%")*2);break}}return j4(n)}var vH=F(()=>{gh();M7()});function D4e(t){var e=t.domain;return t.ticks=function(r){var n=e();return h4(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return $7(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,s=n[i],o=n[a],l,u,h=10;for(o0;){if(u=Y1(s,o,r),u===l)return n[i]=s,n[a]=o,e(n);if(u>0)s=Math.floor(s/u)*u,o=Math.ceil(o/u)*u;else if(u<0)s=Math.ceil(s*u)/u,o=Math.floor(o*u)/u;else break;l=u}return t},t}function hl(){var t=gv();return t.copy=function(){return Z4(t,hl())},bh.apply(t,arguments),D4e(t)}var yH=F(()=>{gh();z7();pv();vH()});function G7(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return a{});function fn(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{let s=i(a),o=i.ceil(a);return a-s(e(a=new Date(+a),s==null?1:Math.floor(s)),a),i.range=(a,s,o)=>{let l=[];if(a=i.ceil(a),o=o==null?1:Math.floor(o),!(a0))return l;let u;do l.push(u=new Date(+a)),e(a,o),t(a);while(ufn(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;e(s,-1),!a(s););else for(;--o>=0;)for(;e(s,1),!a(s););}),r&&(i.count=(a,s)=>(U7.setTime(+a),V7.setTime(+s),t(U7),t(V7),Math.floor(r(U7,V7))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var U7,V7,pu=F(()=>{U7=new Date,V7=new Date});var ac,bH,W7=F(()=>{pu();ac=fn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);ac.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?fn(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):ac);bH=ac.range});var Ws,wH,H7=F(()=>{pu();Ws=fn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),wH=Ws.range});var gu,O4e,Q4,P4e,q7=F(()=>{pu();gu=fn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),O4e=gu.range,Q4=fn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),P4e=Q4.range});var mu,B4e,J4,F4e,Y7=F(()=>{pu();mu=fn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),B4e=mu.range,J4=fn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),F4e=J4.range});var wo,z4e,vv,$4e,e3,G4e,X7=F(()=>{pu();wo=fn(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),z4e=wo.range,vv=fn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),$4e=vv.range,e3=fn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),G4e=e3.range});function sd(t){return fn(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}function od(t){return fn(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/6048e5)}var fl,wh,t3,r3,oc,n3,i3,TH,U4e,V4e,W4e,H4e,q4e,Y4e,ld,Sp,EH,SH,kh,CH,AH,_H,X4e,j4e,K4e,Z4e,Q4e,J4e,j7=F(()=>{pu();fl=sd(0),wh=sd(1),t3=sd(2),r3=sd(3),oc=sd(4),n3=sd(5),i3=sd(6),TH=fl.range,U4e=wh.range,V4e=t3.range,W4e=r3.range,H4e=oc.range,q4e=n3.range,Y4e=i3.range;ld=od(0),Sp=od(1),EH=od(2),SH=od(3),kh=od(4),CH=od(5),AH=od(6),_H=ld.range,X4e=Sp.range,j4e=EH.range,K4e=SH.range,Z4e=kh.range,Q4e=CH.range,J4e=AH.range});var vu,e3e,a3,t3e,K7=F(()=>{pu();vu=fn(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),e3e=vu.range,a3=fn(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),t3e=a3.range});var Hs,r3e,dl,n3e,Z7=F(()=>{pu();Hs=fn(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Hs.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:fn(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});r3e=Hs.range,dl=fn(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());dl.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:fn(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});n3e=dl.range});function RH(t,e,r,n,i,a){let s=[[Ws,1,1e3],[Ws,5,5*1e3],[Ws,15,15*1e3],[Ws,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function o(u,h,f){let d=hy).right(s,d);if(p===s.length)return t.every(dp(u/31536e6,h/31536e6,f));if(p===0)return ac.every(Math.max(dp(u,h,f),1));let[g,m]=s[d/s[p-1][2]{gh();W7();H7();q7();Y7();X7();j7();K7();Z7();[a3e,s3e]=RH(dl,a3,ld,e3,J4,Q4),[Q7,J7]=RH(Hs,vu,fl,wo,mu,gu)});var s3=F(()=>{W7();H7();q7();Y7();X7();j7();K7();Z7();NH()});function e8(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function t8(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function yv(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function r8(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,s=t.shortDays,o=t.months,l=t.shortMonths,u=xv(i),h=bv(i),f=xv(a),d=bv(a),p=xv(s),g=bv(s),m=xv(o),y=bv(o),x=xv(l),b=bv(l),w={a:O,A:B,b:P,B:$,c:null,d:BH,e:BH,f:L3e,g:z3e,G:G3e,H:C3e,I:A3e,j:_3e,L:UH,m:R3e,M:N3e,p:z,q:H,Q:$H,s:GH,S:I3e,u:M3e,U:D3e,V:O3e,w:P3e,W:B3e,x:null,X:null,y:F3e,Y:$3e,Z:U3e,"%":zH},_={a:J,A:X,b:oe,B:K,c:null,d:FH,e:FH,f:q3e,g:r5e,G:i5e,H:V3e,I:W3e,j:H3e,L:WH,m:Y3e,M:X3e,p:ee,q:Q,Q:$H,s:GH,S:j3e,u:K3e,U:Z3e,V:Q3e,w:J3e,W:e5e,x:null,X:null,y:t5e,Y:n5e,Z:a5e,"%":zH},k={a:M,A:R,b:T,B:I,c:A,d:OH,e:OH,f:k3e,g:DH,G:MH,H:PH,I:PH,j:y3e,L:w3e,m:v3e,M:x3e,p:C,q:m3e,Q:E3e,s:S3e,S:b3e,u:h3e,U:f3e,V:d3e,w:u3e,W:p3e,x:D,X:N,y:DH,Y:MH,Z:g3e,"%":T3e};w.x=E(r,w),w.X=E(n,w),w.c=E(e,w),_.x=E(r,_),_.X=E(n,_),_.c=E(e,_);function E(W,Y){return function(Z){var se=[],ce=-1,ue=0,te=W.length,Ne,ae,we;for(Z instanceof Date||(Z=new Date(+Z));++ce53)return null;"w"in se||(se.w=1),"Z"in se?(ue=t8(yv(se.y,0,1)),te=ue.getUTCDay(),ue=te>4||te===0?Sp.ceil(ue):Sp(ue),ue=vv.offset(ue,(se.V-1)*7),se.y=ue.getUTCFullYear(),se.m=ue.getUTCMonth(),se.d=ue.getUTCDate()+(se.w+6)%7):(ue=e8(yv(se.y,0,1)),te=ue.getDay(),ue=te>4||te===0?wh.ceil(ue):wh(ue),ue=wo.offset(ue,(se.V-1)*7),se.y=ue.getFullYear(),se.m=ue.getMonth(),se.d=ue.getDate()+(se.w+6)%7)}else("W"in se||"U"in se)&&("w"in se||(se.w="u"in se?se.u%7:"W"in se?1:0),te="Z"in se?t8(yv(se.y,0,1)).getUTCDay():e8(yv(se.y,0,1)).getDay(),se.m=0,se.d="W"in se?(se.w+6)%7+se.W*7-(te+5)%7:se.w+se.U*7-(te+6)%7);return"Z"in se?(se.H+=se.Z/100|0,se.M+=se.Z%100,t8(se)):e8(se)}}function S(W,Y,Z,se){for(var ce=0,ue=Y.length,te=Z.length,Ne,ae;ce=te)return-1;if(Ne=Y.charCodeAt(ce++),Ne===37){if(Ne=Y.charAt(ce++),ae=k[Ne in IH?Y.charAt(ce++):Ne],!ae||(se=ae(W,Z,se))<0)return-1}else if(Ne!=Z.charCodeAt(se++))return-1}return se}function C(W,Y,Z){var se=u.exec(Y.slice(Z));return se?(W.p=h.get(se[0].toLowerCase()),Z+se[0].length):-1}function M(W,Y,Z){var se=p.exec(Y.slice(Z));return se?(W.w=g.get(se[0].toLowerCase()),Z+se[0].length):-1}function R(W,Y,Z){var se=f.exec(Y.slice(Z));return se?(W.w=d.get(se[0].toLowerCase()),Z+se[0].length):-1}function T(W,Y,Z){var se=x.exec(Y.slice(Z));return se?(W.m=b.get(se[0].toLowerCase()),Z+se[0].length):-1}function I(W,Y,Z){var se=m.exec(Y.slice(Z));return se?(W.m=y.get(se[0].toLowerCase()),Z+se[0].length):-1}function A(W,Y,Z){return S(W,e,Y,Z)}function D(W,Y,Z){return S(W,r,Y,Z)}function N(W,Y,Z){return S(W,n,Y,Z)}function O(W){return s[W.getDay()]}function B(W){return a[W.getDay()]}function P(W){return l[W.getMonth()]}function $(W){return o[W.getMonth()]}function z(W){return i[+(W.getHours()>=12)]}function H(W){return 1+~~(W.getMonth()/3)}function J(W){return s[W.getUTCDay()]}function X(W){return a[W.getUTCDay()]}function oe(W){return l[W.getUTCMonth()]}function K(W){return o[W.getUTCMonth()]}function ee(W){return i[+(W.getUTCHours()>=12)]}function Q(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Y=E(W+="",w);return Y.toString=function(){return W},Y},parse:function(W){var Y=L(W+="",!1);return Y.toString=function(){return W},Y},utcFormat:function(W){var Y=E(W+="",_);return Y.toString=function(){return W},Y},utcParse:function(W){var Y=L(W+="",!0);return Y.toString=function(){return W},Y}}}function Pr(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a[e.toLowerCase(),r]))}function u3e(t,e,r){var n=Vi.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function h3e(t,e,r){var n=Vi.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function f3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function d3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function p3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function MH(t,e,r){var n=Vi.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function DH(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function g3e(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function m3e(t,e,r){var n=Vi.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function v3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function OH(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function y3e(t,e,r){var n=Vi.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function PH(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function x3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function b3e(t,e,r){var n=Vi.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function w3e(t,e,r){var n=Vi.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function k3e(t,e,r){var n=Vi.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function T3e(t,e,r){var n=o3e.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function E3e(t,e,r){var n=Vi.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function S3e(t,e,r){var n=Vi.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function BH(t,e){return Pr(t.getDate(),e,2)}function C3e(t,e){return Pr(t.getHours(),e,2)}function A3e(t,e){return Pr(t.getHours()%12||12,e,2)}function _3e(t,e){return Pr(1+wo.count(Hs(t),t),e,3)}function UH(t,e){return Pr(t.getMilliseconds(),e,3)}function L3e(t,e){return UH(t,e)+"000"}function R3e(t,e){return Pr(t.getMonth()+1,e,2)}function N3e(t,e){return Pr(t.getMinutes(),e,2)}function I3e(t,e){return Pr(t.getSeconds(),e,2)}function M3e(t){var e=t.getDay();return e===0?7:e}function D3e(t,e){return Pr(fl.count(Hs(t)-1,t),e,2)}function VH(t){var e=t.getDay();return e>=4||e===0?oc(t):oc.ceil(t)}function O3e(t,e){return t=VH(t),Pr(oc.count(Hs(t),t)+(Hs(t).getDay()===4),e,2)}function P3e(t){return t.getDay()}function B3e(t,e){return Pr(wh.count(Hs(t)-1,t),e,2)}function F3e(t,e){return Pr(t.getFullYear()%100,e,2)}function z3e(t,e){return t=VH(t),Pr(t.getFullYear()%100,e,2)}function $3e(t,e){return Pr(t.getFullYear()%1e4,e,4)}function G3e(t,e){var r=t.getDay();return t=r>=4||r===0?oc(t):oc.ceil(t),Pr(t.getFullYear()%1e4,e,4)}function U3e(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Pr(e/60|0,"0",2)+Pr(e%60,"0",2)}function FH(t,e){return Pr(t.getUTCDate(),e,2)}function V3e(t,e){return Pr(t.getUTCHours(),e,2)}function W3e(t,e){return Pr(t.getUTCHours()%12||12,e,2)}function H3e(t,e){return Pr(1+vv.count(dl(t),t),e,3)}function WH(t,e){return Pr(t.getUTCMilliseconds(),e,3)}function q3e(t,e){return WH(t,e)+"000"}function Y3e(t,e){return Pr(t.getUTCMonth()+1,e,2)}function X3e(t,e){return Pr(t.getUTCMinutes(),e,2)}function j3e(t,e){return Pr(t.getUTCSeconds(),e,2)}function K3e(t){var e=t.getUTCDay();return e===0?7:e}function Z3e(t,e){return Pr(ld.count(dl(t)-1,t),e,2)}function HH(t){var e=t.getUTCDay();return e>=4||e===0?kh(t):kh.ceil(t)}function Q3e(t,e){return t=HH(t),Pr(kh.count(dl(t),t)+(dl(t).getUTCDay()===4),e,2)}function J3e(t){return t.getUTCDay()}function e5e(t,e){return Pr(Sp.count(dl(t)-1,t),e,2)}function t5e(t,e){return Pr(t.getUTCFullYear()%100,e,2)}function r5e(t,e){return t=HH(t),Pr(t.getUTCFullYear()%100,e,2)}function n5e(t,e){return Pr(t.getUTCFullYear()%1e4,e,4)}function i5e(t,e){var r=t.getUTCDay();return t=r>=4||r===0?kh(t):kh.ceil(t),Pr(t.getUTCFullYear()%1e4,e,4)}function a5e(){return"+0000"}function zH(){return"%"}function $H(t){return+t}function GH(t){return Math.floor(+t/1e3)}var IH,Vi,o3e,l3e,qH=F(()=>{s3();IH={"-":"",_:" ",0:"0"},Vi=/^\s*\d+/,o3e=/^%/,l3e=/[\\^$*+?|[\]().{}]/g});function n8(t){return Cp=r8(t),cd=Cp.format,YH=Cp.parse,XH=Cp.utcFormat,jH=Cp.utcParse,Cp}var Cp,cd,YH,XH,jH,KH=F(()=>{qH();n8({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})});var i8=F(()=>{KH()});function s5e(t){return new Date(t)}function o5e(t){return t instanceof Date?+t:+new Date(+t)}function ZH(t,e,r,n,i,a,s,o,l,u){var h=gv(),f=h.invert,d=h.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),y=u("%I %p"),x=u("%a %d"),b=u("%b %d"),w=u("%B"),_=u("%Y");function k(E){return(l(E){s3();i8();z7();pv();xH()});var JH=F(()=>{dH();yH();O7();QH()});function eq(t){for(var e=t.length/6|0,r=new Array(e),n=0;n{});var a8,rq=F(()=>{tq();a8=eq("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")});var nq=F(()=>{rq()});function Dn(t){return function(){return t}}var l3=F(()=>{});function aq(t){return t>1?0:t<-1?Ap:Math.acos(t)}function o8(t){return t>=1?wv:t<=-1?-wv:Math.asin(t)}var s8,aa,Th,iq,c3,pl,ud,Wi,Ap,wv,_p,u3=F(()=>{s8=Math.abs,aa=Math.atan2,Th=Math.cos,iq=Math.max,c3=Math.min,pl=Math.sin,ud=Math.sqrt,Wi=1e-12,Ap=Math.PI,wv=Ap/2,_p=2*Ap});function h3(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new rd(e)}var l8=F(()=>{k7()});function l5e(t){return t.innerRadius}function c5e(t){return t.outerRadius}function u5e(t){return t.startAngle}function h5e(t){return t.endAngle}function f5e(t){return t&&t.padAngle}function d5e(t,e,r,n,i,a,s,o){var l=r-t,u=n-e,h=s-i,f=o-a,d=f*l-h*u;if(!(d*dA*A+D*D&&(S=M,C=R),{cx:S,cy:C,x01:-h,y01:-f,x11:S*(i/k-1),y11:C*(i/k-1)}}function lc(){var t=l5e,e=c5e,r=Dn(0),n=null,i=u5e,a=h5e,s=f5e,o=null,l=h3(u);function u(){var h,f,d=+t.apply(this,arguments),p=+e.apply(this,arguments),g=i.apply(this,arguments)-wv,m=a.apply(this,arguments)-wv,y=s8(m-g),x=m>g;if(o||(o=h=l()),pWi))o.moveTo(0,0);else if(y>_p-Wi)o.moveTo(p*Th(g),p*pl(g)),o.arc(0,0,p,g,m,!x),d>Wi&&(o.moveTo(d*Th(m),d*pl(m)),o.arc(0,0,d,m,g,x));else{var b=g,w=m,_=g,k=m,E=y,L=y,S=s.apply(this,arguments)/2,C=S>Wi&&(n?+n.apply(this,arguments):ud(d*d+p*p)),M=c3(s8(p-d)/2,+r.apply(this,arguments)),R=M,T=M,I,A;if(C>Wi){var D=o8(C/d*pl(S)),N=o8(C/p*pl(S));(E-=D*2)>Wi?(D*=x?1:-1,_+=D,k-=D):(E=0,_=k=(g+m)/2),(L-=N*2)>Wi?(N*=x?1:-1,b+=N,w-=N):(L=0,b=w=(g+m)/2)}var O=p*Th(b),B=p*pl(b),P=d*Th(k),$=d*pl(k);if(M>Wi){var z=p*Th(w),H=p*pl(w),J=d*Th(_),X=d*pl(_),oe;if(yWi?T>Wi?(I=f3(J,X,O,B,p,T,x),A=f3(z,H,P,$,p,T,x),o.moveTo(I.cx+I.x01,I.cy+I.y01),TWi)||!(E>Wi)?o.lineTo(P,$):R>Wi?(I=f3(P,$,z,H,d,-R,x),A=f3(O,B,J,X,d,-R,x),o.lineTo(I.cx+I.x01,I.cy+I.y01),R{l3();u3();l8()});function d3(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}var xft,c8=F(()=>{xft=Array.prototype.slice});function oq(t){this._context=t}function kv(t){return new oq(t)}var u8=F(()=>{oq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}}});function lq(t){return t[0]}function cq(t){return t[1]}var uq=F(()=>{});function ms(t,e){var r=Dn(!0),n=null,i=kv,a=null,s=h3(o);t=typeof t=="function"?t:t===void 0?lq:Dn(t),e=typeof e=="function"?e:e===void 0?cq:Dn(e);function o(l){var u,h=(l=d3(l)).length,f,d=!1,p;for(n==null&&(a=i(p=s())),u=0;u<=h;++u)!(u{c8();l3();u8();l8();uq()});function fq(t,e){return et?1:e>=t?0:NaN}var dq=F(()=>{});function pq(t){return t}var gq=F(()=>{});function h8(){var t=pq,e=fq,r=null,n=Dn(0),i=Dn(_p),a=Dn(0);function s(o){var l,u=(o=d3(o)).length,h,f,d=0,p=new Array(u),g=new Array(u),m=+n.apply(this,arguments),y=Math.min(_p,Math.max(-_p,i.apply(this,arguments)-m)),x,b=Math.min(Math.abs(y)/u,a.apply(this,arguments)),w=b*(y<0?-1:1),_;for(l=0;l0&&(d+=_);for(e!=null?p.sort(function(k,E){return e(g[k],g[E])}):r!=null&&p.sort(function(k,E){return r(o[k],o[E])}),l=0,f=d?(y-u*w)/d:0;l0?_*f:0)+w,g[h]={data:o[h],index:l,value:_,startAngle:m,endAngle:x,padAngle:b};return g}return s.value=function(o){return arguments.length?(t=typeof o=="function"?o:Dn(+o),s):t},s.sortValues=function(o){return arguments.length?(e=o,r=null,s):e},s.sort=function(o){return arguments.length?(r=o,e=null,s):r},s.startAngle=function(o){return arguments.length?(n=typeof o=="function"?o:Dn(+o),s):n},s.endAngle=function(o){return arguments.length?(i=typeof o=="function"?o:Dn(+o),s):i},s.padAngle=function(o){return arguments.length?(a=typeof o=="function"?o:Dn(+o),s):a},s}var mq=F(()=>{c8();l3();dq();gq();u3()});function f8(t){return new p3(t,!0)}function d8(t){return new p3(t,!1)}var p3,vq=F(()=>{p3=class{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}});function ko(){}var Tv=F(()=>{});function Lp(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function Ev(t){this._context=t}function gl(t){return new Ev(t)}var Sv=F(()=>{Ev.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Lp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Lp(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function yq(t){this._context=t}function p8(t){return new yq(t)}var xq=F(()=>{Tv();Sv();yq.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Lp(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function bq(t){this._context=t}function g8(t){return new bq(t)}var wq=F(()=>{Sv();bq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Lp(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function kq(t,e){this._basis=new Ev(t),this._beta=e}var m8,Tq=F(()=>{Sv();kq.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],a=t[r]-n,s=e[r]-i,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*t[o]+(1-this._beta)*(n+l*a),this._beta*e[o]+(1-this._beta)*(i+l*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};m8=function t(e){function r(n){return e===1?new Ev(n):new kq(n,e)}return r.beta=function(n){return t(+n)},r}(.85)});function Rp(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function g3(t,e){this._context=t,this._k=(1-e)/6}var v8,Cv=F(()=>{g3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Rp(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Rp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};v8=function t(e){function r(n){return new g3(n,e)}return r.tension=function(n){return t(+n)},r}(0)});function m3(t,e){this._context=t,this._k=(1-e)/6}var y8,x8=F(()=>{Tv();Cv();m3.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Rp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};y8=function t(e){function r(n){return new m3(n,e)}return r.tension=function(n){return t(+n)},r}(0)});function v3(t,e){this._context=t,this._k=(1-e)/6}var b8,w8=F(()=>{Cv();v3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Rp(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};b8=function t(e){function r(n){return new v3(n,e)}return r.tension=function(n){return t(+n)},r}(0)});function Av(t,e,r){var n=t._x1,i=t._y1,a=t._x2,s=t._y2;if(t._l01_a>Wi){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Wi){var u=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,h=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*u+t._x1*t._l23_2a-e*t._l12_2a)/h,s=(s*u+t._y1*t._l23_2a-r*t._l12_2a)/h}t._context.bezierCurveTo(n,i,a,s,t._x2,t._y2)}function Eq(t,e){this._context=t,this._alpha=e}var k8,y3=F(()=>{u3();Cv();Eq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Av(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};k8=function t(e){function r(n){return e?new Eq(n,e):new g3(n,0)}return r.alpha=function(n){return t(+n)},r}(.5)});function Sq(t,e){this._context=t,this._alpha=e}var T8,Cq=F(()=>{x8();Tv();y3();Sq.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Av(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};T8=function t(e){function r(n){return e?new Sq(n,e):new m3(n,0)}return r.alpha=function(n){return t(+n)},r}(.5)});function Aq(t,e){this._context=t,this._alpha=e}var E8,_q=F(()=>{w8();y3();Aq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Av(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};E8=function t(e){function r(n){return e?new Aq(n,e):new v3(n,0)}return r.alpha=function(n){return t(+n)},r}(.5)});function Lq(t){this._context=t}function S8(t){return new Lq(t)}var Rq=F(()=>{Tv();Lq.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}}});function Nq(t){return t<0?-1:1}function Iq(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),s=(r-t._y1)/(i||n<0&&-0),o=(a*i+s*n)/(n+i);return(Nq(a)+Nq(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function Mq(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function C8(t,e,r){var n=t._x0,i=t._y0,a=t._x1,s=t._y1,o=(a-n)/3;t._context.bezierCurveTo(n+o,i+o*e,a-o,s-o*r,a,s)}function x3(t){this._context=t}function Dq(t){this._context=new Oq(t)}function Oq(t){this._context=t}function A8(t){return new x3(t)}function _8(t){return new Dq(t)}var Pq=F(()=>{x3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:C8(this,this._t0,Mq(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,C8(this,Mq(this,r=Iq(this,t,e)),r);break;default:C8(this,this._t0,r=Iq(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};(Dq.prototype=Object.create(x3.prototype)).point=function(t,e){x3.prototype.point.call(this,e,t)};Oq.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}}});function Fq(t){this._context=t}function Bq(t){var e,r=t.length-1,n,i=new Array(r),a=new Array(r),s=new Array(r);for(i[0]=0,a[0]=2,s[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(s[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e{Fq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=Bq(t),i=Bq(e),a=0,s=1;s{b3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}}});var Gq=F(()=>{sq();hq();mq();xq();wq();Sv();vq();Tq();x8();w8();Cv();Cq();_q();y3();Rq();u8();Pq();zq();$q()});var Uq=F(()=>{});var Vq=F(()=>{});function Eh(t,e,r){this.k=t,this.x=e,this.y=r}function D8(t){for(;!t.__zoom;)if(!(t=t.parentNode))return M8;return t.__zoom}var M8,O8=F(()=>{Eh.prototype={constructor:Eh,scale:function(t){return t===1?this:new Eh(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Eh(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};M8=new Eh(1,0,0);D8.prototype=Eh.prototype});var Wq=F(()=>{});var Hq=F(()=>{q4();Uq();Vq();O8();Wq()});var qq=F(()=>{Hq();O8()});var lr=F(()=>{gh();sG();MW();BW();yp();FW();zW();OC();IU();$W();y7();GW();VW();M7();cH();uH();bp();k7();hH();UW();fH();JH();nq();ll();Gq();s3();i8();F4();q4();qq()});var p5e,w3,P8=F(()=>{p5e=typeof global=="object"&&global&&global.Object===Object&&global,w3=p5e});var g5e,m5e,Qn,To=F(()=>{P8();g5e=typeof self=="object"&&self&&self.Object===Object&&self,m5e=w3||g5e||Function("return this")(),Qn=m5e});var v5e,Hi,hd=F(()=>{To();v5e=Qn.Symbol,Hi=v5e});function b5e(t){var e=y5e.call(t,_v),r=t[_v];try{t[_v]=void 0;var n=!0}catch{}var i=x5e.call(t);return n&&(e?t[_v]=r:delete t[_v]),i}var Yq,y5e,x5e,_v,Xq,jq=F(()=>{hd();Yq=Object.prototype,y5e=Yq.hasOwnProperty,x5e=Yq.toString,_v=Hi?Hi.toStringTag:void 0;Xq=b5e});function T5e(t){return k5e.call(t)}var w5e,k5e,Kq,Zq=F(()=>{w5e=Object.prototype,k5e=w5e.toString;Kq=T5e});function C5e(t){return t==null?t===void 0?S5e:E5e:Qq&&Qq in Object(t)?Xq(t):Kq(t)}var E5e,S5e,Qq,sa,yu=F(()=>{hd();jq();Zq();E5e="[object Null]",S5e="[object Undefined]",Qq=Hi?Hi.toStringTag:void 0;sa=C5e});function A5e(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var dn,qs=F(()=>{dn=A5e});function I5e(t){if(!dn(t))return!1;var e=sa(t);return e==L5e||e==R5e||e==_5e||e==N5e}var _5e,L5e,R5e,N5e,gi,Lv=F(()=>{yu();qs();_5e="[object AsyncFunction]",L5e="[object Function]",R5e="[object GeneratorFunction]",N5e="[object Proxy]";gi=I5e});var M5e,k3,Jq=F(()=>{To();M5e=Qn["__core-js_shared__"],k3=M5e});function D5e(t){return!!eY&&eY in t}var eY,tY,rY=F(()=>{Jq();eY=function(){var t=/[^.]+$/.exec(k3&&k3.keys&&k3.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();tY=D5e});function B5e(t){if(t!=null){try{return P5e.call(t)}catch{}try{return t+""}catch{}}return""}var O5e,P5e,xu,B8=F(()=>{O5e=Function.prototype,P5e=O5e.toString;xu=B5e});function H5e(t){if(!dn(t)||tY(t))return!1;var e=gi(t)?W5e:z5e;return e.test(xu(t))}var F5e,z5e,$5e,G5e,U5e,V5e,W5e,nY,iY=F(()=>{Lv();rY();qs();B8();F5e=/[\\^$.*+?()[\]{}|]/g,z5e=/^\[object .+?Constructor\]$/,$5e=Function.prototype,G5e=Object.prototype,U5e=$5e.toString,V5e=G5e.hasOwnProperty,W5e=RegExp("^"+U5e.call(V5e).replace(F5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");nY=H5e});function q5e(t,e){return t?.[e]}var aY,sY=F(()=>{aY=q5e});function Y5e(t,e){var r=aY(t,e);return nY(r)?r:void 0}var vs,Sh=F(()=>{iY();sY();vs=Y5e});var X5e,bu,Rv=F(()=>{Sh();X5e=vs(Object,"create"),bu=X5e});function j5e(){this.__data__=bu?bu(null):{},this.size=0}var oY,lY=F(()=>{Rv();oY=j5e});function K5e(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var cY,uY=F(()=>{cY=K5e});function ewe(t){var e=this.__data__;if(bu){var r=e[t];return r===Z5e?void 0:r}return J5e.call(e,t)?e[t]:void 0}var Z5e,Q5e,J5e,hY,fY=F(()=>{Rv();Z5e="__lodash_hash_undefined__",Q5e=Object.prototype,J5e=Q5e.hasOwnProperty;hY=ewe});function nwe(t){var e=this.__data__;return bu?e[t]!==void 0:rwe.call(e,t)}var twe,rwe,dY,pY=F(()=>{Rv();twe=Object.prototype,rwe=twe.hasOwnProperty;dY=nwe});function awe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=bu&&e===void 0?iwe:e,this}var iwe,gY,mY=F(()=>{Rv();iwe="__lodash_hash_undefined__";gY=awe});function Np(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{lY();uY();fY();pY();mY();Np.prototype.clear=oY;Np.prototype.delete=cY;Np.prototype.get=hY;Np.prototype.has=dY;Np.prototype.set=gY;F8=Np});function swe(){this.__data__=[],this.size=0}var yY,xY=F(()=>{yY=swe});function owe(t,e){return t===e||t!==t&&e!==e}var Eo,fd=F(()=>{Eo=owe});function lwe(t,e){for(var r=t.length;r--;)if(Eo(t[r][0],e))return r;return-1}var Ch,Nv=F(()=>{fd();Ch=lwe});function hwe(t){var e=this.__data__,r=Ch(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():uwe.call(e,r,1),--this.size,!0}var cwe,uwe,bY,wY=F(()=>{Nv();cwe=Array.prototype,uwe=cwe.splice;bY=hwe});function fwe(t){var e=this.__data__,r=Ch(e,t);return r<0?void 0:e[r][1]}var kY,TY=F(()=>{Nv();kY=fwe});function dwe(t){return Ch(this.__data__,t)>-1}var EY,SY=F(()=>{Nv();EY=dwe});function pwe(t,e){var r=this.__data__,n=Ch(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var CY,AY=F(()=>{Nv();CY=pwe});function Ip(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{xY();wY();TY();SY();AY();Ip.prototype.clear=yY;Ip.prototype.delete=bY;Ip.prototype.get=kY;Ip.prototype.has=EY;Ip.prototype.set=CY;Ah=Ip});var gwe,_h,T3=F(()=>{Sh();To();gwe=vs(Qn,"Map"),_h=gwe});function mwe(){this.size=0,this.__data__={hash:new F8,map:new(_h||Ah),string:new F8}}var _Y,LY=F(()=>{vY();Iv();T3();_Y=mwe});function vwe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var RY,NY=F(()=>{RY=vwe});function ywe(t,e){var r=t.__data__;return RY(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Lh,Mv=F(()=>{NY();Lh=ywe});function xwe(t){var e=Lh(this,t).delete(t);return this.size-=e?1:0,e}var IY,MY=F(()=>{Mv();IY=xwe});function bwe(t){return Lh(this,t).get(t)}var DY,OY=F(()=>{Mv();DY=bwe});function wwe(t){return Lh(this,t).has(t)}var PY,BY=F(()=>{Mv();PY=wwe});function kwe(t,e){var r=Lh(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var FY,zY=F(()=>{Mv();FY=kwe});function Mp(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{LY();MY();OY();BY();zY();Mp.prototype.clear=_Y;Mp.prototype.delete=IY;Mp.prototype.get=DY;Mp.prototype.has=PY;Mp.prototype.set=FY;dd=Mp});function z8(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Twe);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var s=t.apply(this,n);return r.cache=a.set(i,s)||a,s};return r.cache=new(z8.Cache||dd),r}var Twe,Dp,$8=F(()=>{E3();Twe="Expected a function";z8.Cache=dd;Dp=z8});function Ewe(){this.__data__=new Ah,this.size=0}var $Y,GY=F(()=>{Iv();$Y=Ewe});function Swe(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var UY,VY=F(()=>{UY=Swe});function Cwe(t){return this.__data__.get(t)}var WY,HY=F(()=>{WY=Cwe});function Awe(t){return this.__data__.has(t)}var qY,YY=F(()=>{qY=Awe});function Lwe(t,e){var r=this.__data__;if(r instanceof Ah){var n=r.__data__;if(!_h||n.length<_we-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new dd(n)}return r.set(t,e),this.size=r.size,this}var _we,XY,jY=F(()=>{Iv();T3();E3();_we=200;XY=Lwe});function Op(t){var e=this.__data__=new Ah(t);this.size=e.size}var cc,Dv=F(()=>{Iv();GY();VY();HY();YY();jY();Op.prototype.clear=$Y;Op.prototype.delete=UY;Op.prototype.get=WY;Op.prototype.has=qY;Op.prototype.set=XY;cc=Op});var Rwe,Pp,G8=F(()=>{Sh();Rwe=function(){try{var t=vs(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Pp=Rwe});function Nwe(t,e,r){e=="__proto__"&&Pp?Pp(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var uc,Bp=F(()=>{G8();uc=Nwe});function Iwe(t,e,r){(r!==void 0&&!Eo(t[e],r)||r===void 0&&!(e in t))&&uc(t,e,r)}var Ov,U8=F(()=>{Bp();fd();Ov=Iwe});function Mwe(t){return function(e,r,n){for(var i=-1,a=Object(e),s=n(e),o=s.length;o--;){var l=s[t?o:++i];if(r(a[l],l,a)===!1)break}return e}}var KY,ZY=F(()=>{KY=Mwe});var Dwe,Fp,S3=F(()=>{ZY();Dwe=KY(),Fp=Dwe});function Pwe(t,e){if(e)return t.slice();var r=t.length,n=eX?eX(r):new t.constructor(r);return t.copy(n),n}var tX,QY,Owe,JY,eX,C3,V8=F(()=>{To();tX=typeof exports=="object"&&exports&&!exports.nodeType&&exports,QY=tX&&typeof module=="object"&&module&&!module.nodeType&&module,Owe=QY&&QY.exports===tX,JY=Owe?Qn.Buffer:void 0,eX=JY?JY.allocUnsafe:void 0;C3=Pwe});var Bwe,zp,W8=F(()=>{To();Bwe=Qn.Uint8Array,zp=Bwe});function Fwe(t){var e=new t.constructor(t.byteLength);return new zp(e).set(new zp(t)),e}var $p,A3=F(()=>{W8();$p=Fwe});function zwe(t,e){var r=e?$p(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var _3,H8=F(()=>{A3();_3=zwe});function $we(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r{L3=$we});var rX,Gwe,nX,iX=F(()=>{qs();rX=Object.create,Gwe=function(){function t(){}return function(e){if(!dn(e))return{};if(rX)return rX(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),nX=Gwe});function Uwe(t,e){return function(r){return t(e(r))}}var R3,Y8=F(()=>{R3=Uwe});var Vwe,Gp,N3=F(()=>{Y8();Vwe=R3(Object.getPrototypeOf,Object),Gp=Vwe});function Hwe(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Wwe;return t===r}var Wwe,hc,Up=F(()=>{Wwe=Object.prototype;hc=Hwe});function qwe(t){return typeof t.constructor=="function"&&!hc(t)?nX(Gp(t)):{}}var I3,X8=F(()=>{iX();N3();Up();I3=qwe});function Ywe(t){return t!=null&&typeof t=="object"}var qn,So=F(()=>{qn=Ywe});function jwe(t){return qn(t)&&sa(t)==Xwe}var Xwe,j8,aX=F(()=>{yu();So();Xwe="[object Arguments]";j8=jwe});var sX,Kwe,Zwe,Qwe,ml,Vp=F(()=>{aX();So();sX=Object.prototype,Kwe=sX.hasOwnProperty,Zwe=sX.propertyIsEnumerable,Qwe=j8(function(){return arguments}())?j8:function(t){return qn(t)&&Kwe.call(t,"callee")&&!Zwe.call(t,"callee")},ml=Qwe});var Jwe,Et,On=F(()=>{Jwe=Array.isArray,Et=Jwe});function tke(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=eke}var eke,Wp,M3=F(()=>{eke=9007199254740991;Wp=tke});function rke(t){return t!=null&&Wp(t.length)&&!gi(t)}var Jn,Co=F(()=>{Lv();M3();Jn=rke});function nke(t){return qn(t)&&Jn(t)}var pd,D3=F(()=>{Co();So();pd=nke});function ike(){return!1}var oX,lX=F(()=>{oX=ike});var hX,cX,ake,uX,ske,oke,vl,Hp=F(()=>{To();lX();hX=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cX=hX&&typeof module=="object"&&module&&!module.nodeType&&module,ake=cX&&cX.exports===hX,uX=ake?Qn.Buffer:void 0,ske=uX?uX.isBuffer:void 0,oke=ske||oX,vl=oke});function dke(t){if(!qn(t)||sa(t)!=lke)return!1;var e=Gp(t);if(e===null)return!0;var r=hke.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&fX.call(r)==fke}var lke,cke,uke,fX,hke,fke,dX,pX=F(()=>{yu();N3();So();lke="[object Object]",cke=Function.prototype,uke=Object.prototype,fX=cke.toString,hke=uke.hasOwnProperty,fke=fX.call(Object);dX=dke});function Fke(t){return qn(t)&&Wp(t.length)&&!!Nn[sa(t)]}var pke,gke,mke,vke,yke,xke,bke,wke,kke,Tke,Eke,Ske,Cke,Ake,_ke,Lke,Rke,Nke,Ike,Mke,Dke,Oke,Pke,Bke,Nn,gX,mX=F(()=>{yu();M3();So();pke="[object Arguments]",gke="[object Array]",mke="[object Boolean]",vke="[object Date]",yke="[object Error]",xke="[object Function]",bke="[object Map]",wke="[object Number]",kke="[object Object]",Tke="[object RegExp]",Eke="[object Set]",Ske="[object String]",Cke="[object WeakMap]",Ake="[object ArrayBuffer]",_ke="[object DataView]",Lke="[object Float32Array]",Rke="[object Float64Array]",Nke="[object Int8Array]",Ike="[object Int16Array]",Mke="[object Int32Array]",Dke="[object Uint8Array]",Oke="[object Uint8ClampedArray]",Pke="[object Uint16Array]",Bke="[object Uint32Array]",Nn={};Nn[Lke]=Nn[Rke]=Nn[Nke]=Nn[Ike]=Nn[Mke]=Nn[Dke]=Nn[Oke]=Nn[Pke]=Nn[Bke]=!0;Nn[pke]=Nn[gke]=Nn[Ake]=Nn[mke]=Nn[_ke]=Nn[vke]=Nn[yke]=Nn[xke]=Nn[bke]=Nn[wke]=Nn[kke]=Nn[Tke]=Nn[Eke]=Nn[Ske]=Nn[Cke]=!1;gX=Fke});function zke(t){return function(e){return t(e)}}var Ao,gd=F(()=>{Ao=zke});var vX,Pv,$ke,K8,Gke,_o,Bv=F(()=>{P8();vX=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pv=vX&&typeof module=="object"&&module&&!module.nodeType&&module,$ke=Pv&&Pv.exports===vX,K8=$ke&&w3.process,Gke=function(){try{var t=Pv&&Pv.require&&Pv.require("util").types;return t||K8&&K8.binding&&K8.binding("util")}catch{}}(),_o=Gke});var yX,Uke,Rh,Fv=F(()=>{mX();gd();Bv();yX=_o&&_o.isTypedArray,Uke=yX?Ao(yX):gX,Rh=Uke});function Vke(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var zv,Z8=F(()=>{zv=Vke});function qke(t,e,r){var n=t[e];(!(Hke.call(t,e)&&Eo(n,r))||r===void 0&&!(e in t))&&uc(t,e,r)}var Wke,Hke,fc,qp=F(()=>{Bp();fd();Wke=Object.prototype,Hke=Wke.hasOwnProperty;fc=qke});function Yke(t,e,r,n){var i=!r;r||(r={});for(var a=-1,s=e.length;++a{qp();Bp();Lo=Yke});function Xke(t,e){for(var r=-1,n=Array(t);++r{xX=Xke});function Zke(t,e){var r=typeof t;return e=e??jke,!!e&&(r=="number"||r!="symbol"&&Kke.test(t))&&t>-1&&t%1==0&&t{jke=9007199254740991,Kke=/^(?:0|[1-9]\d*)$/;Nh=Zke});function eTe(t,e){var r=Et(t),n=!r&&ml(t),i=!r&&!n&&vl(t),a=!r&&!n&&!i&&Rh(t),s=r||n||i||a,o=s?xX(t.length,String):[],l=o.length;for(var u in t)(e||Jke.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Nh(u,l)))&&o.push(u);return o}var Qke,Jke,O3,Q8=F(()=>{bX();Vp();On();Hp();$v();Fv();Qke=Object.prototype,Jke=Qke.hasOwnProperty;O3=eTe});function tTe(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var wX,kX=F(()=>{wX=tTe});function iTe(t){if(!dn(t))return wX(t);var e=hc(t),r=[];for(var n in t)n=="constructor"&&(e||!nTe.call(t,n))||r.push(n);return r}var rTe,nTe,TX,EX=F(()=>{qs();Up();kX();rTe=Object.prototype,nTe=rTe.hasOwnProperty;TX=iTe});function aTe(t){return Jn(t)?O3(t,!0):TX(t)}var ys,Ih=F(()=>{Q8();EX();Co();ys=aTe});function sTe(t){return Lo(t,ys(t))}var SX,CX=F(()=>{md();Ih();SX=sTe});function oTe(t,e,r,n,i,a,s){var o=zv(t,r),l=zv(e,r),u=s.get(l);if(u){Ov(t,r,u);return}var h=a?a(o,l,r+"",t,e,s):void 0,f=h===void 0;if(f){var d=Et(l),p=!d&&vl(l),g=!d&&!p&&Rh(l);h=l,d||p||g?Et(o)?h=o:pd(o)?h=L3(o):p?(f=!1,h=C3(l,!0)):g?(f=!1,h=_3(l,!0)):h=[]:dX(l)||ml(l)?(h=o,ml(o)?h=SX(o):(!dn(o)||gi(o))&&(h=I3(l))):f=!1}f&&(s.set(l,h),i(h,l,n,a,s),s.delete(l)),Ov(t,r,h)}var AX,_X=F(()=>{U8();V8();H8();q8();X8();Vp();On();D3();Hp();Lv();qs();pX();Fv();Z8();CX();AX=oTe});function LX(t,e,r,n,i){t!==e&&Fp(e,function(a,s){if(i||(i=new cc),dn(a))AX(t,e,s,r,LX,n,i);else{var o=n?n(zv(t,s),a,s+"",t,e,i):void 0;o===void 0&&(o=a),Ov(t,s,o)}},ys)}var RX,NX=F(()=>{Dv();U8();S3();_X();qs();Ih();Z8();RX=LX});function lTe(t){return t}var qi,wu=F(()=>{qi=lTe});function cTe(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var IX,MX=F(()=>{IX=cTe});function uTe(t,e,r){return e=DX(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,a=DX(n.length-e,0),s=Array(a);++i{MX();DX=Math.max;P3=uTe});function hTe(t){return function(){return t}}var xs,eA=F(()=>{xs=hTe});var fTe,OX,PX=F(()=>{eA();G8();wu();fTe=Pp?function(t,e){return Pp(t,"toString",{configurable:!0,enumerable:!1,value:xs(e),writable:!0})}:qi,OX=fTe});function mTe(t){var e=0,r=0;return function(){var n=gTe(),i=pTe-(n-r);if(r=n,i>0){if(++e>=dTe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var dTe,pTe,gTe,BX,FX=F(()=>{dTe=800,pTe=16,gTe=Date.now;BX=mTe});var vTe,B3,tA=F(()=>{PX();FX();vTe=BX(OX),B3=vTe});function yTe(t,e){return B3(P3(t,e,qi),t+"")}var dc,Yp=F(()=>{wu();J8();tA();dc=yTe});function xTe(t,e,r){if(!dn(r))return!1;var n=typeof e;return(n=="number"?Jn(r)&&Nh(e,r.length):n=="string"&&e in r)?Eo(r[e],t):!1}var Ys,vd=F(()=>{fd();Co();$v();qs();Ys=xTe});function bTe(t){return dc(function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(i--,a):void 0,s&&Ys(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++n{Yp();vd();F3=bTe});var wTe,Mh,nA=F(()=>{NX();rA();wTe=F3(function(t,e,r){RX(t,e,r)}),Mh=wTe});function $3(t,e){if(!t)return e;let r=`curve${t.charAt(0).toUpperCase()+t.slice(1)}`;return kTe[r]??e}function WX(t,e){let r=t.trim();if(r)return e.securityLevel!=="loose"?(0,GX.sanitizeUrl)(r):r}function aA(t,e){return!t||!e?0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function HX(t){let e,r=0;t.forEach(i=>{r+=aA(i,e),e=i});let n=r/2;return sA(t,n)}function qX(t){return t.length===1?t[0]:HX(t)}function YX(t,e,r){let n=structuredClone(r);re.info("our points",n),e!=="start_left"&&e!=="start_right"&&n.reverse();let i=25+t,a=sA(n,i),s=10+t*.5,o=Math.atan2(n[0].y-a.y,n[0].x-a.x),l={x:0,y:0};return e==="start_left"?(l.x=Math.sin(o+Math.PI)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o+Math.PI)*s+(n[0].y+a.y)/2):e==="end_right"?(l.x=Math.sin(o-Math.PI)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o-Math.PI)*s+(n[0].y+a.y)/2-5):e==="end_left"?(l.x=Math.sin(o)*s+(n[0].x+a.x)/2-5,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2-5):(l.x=Math.sin(o)*s+(n[0].x+a.x)/2,l.y=-Math.cos(o)*s+(n[0].y+a.y)/2),l}function G3(t){let e="",r="";for(let n of t)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":e=e+n+";");return{style:e,labelStyle:r}}function XX(t){let e="",r="0123456789abcdef",n=r.length;for(let i=0;i{or();GX=Gi(hp(),1);lr();$8();nA();iA="\u200B",kTe={curveBasis:gl,curveBasisClosed:p8,curveBasisOpen:g8,curveBumpX:f8,curveBumpY:d8,curveBundle:m8,curveCardinalClosed:y8,curveCardinalOpen:b8,curveCardinal:v8,curveCatmullRomClosed:T8,curveCatmullRomOpen:E8,curveCatmullRom:k8,curveLinear:kv,curveLinearClosed:S8,curveMonotoneX:A8,curveMonotoneY:_8,curveNatural:L8,curveStep:R8,curveStepAfter:I8,curveStepBefore:N8},TTe=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,ETe=v(function(t,e){let r=UX(t,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let s=r.map(o=>o.args);B1(s),n=Hn(n,[...s])}else n=r.args;if(!n)return;let i=F1(t,e),a="config";return n[a]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[a],delete n[a]),n},"detectInit"),UX=v(function(t,e=null){try{let r=new RegExp(`[%]{2}(?![{]${TTe.source})(?=[}][%]{2}).* `,"ig");t=t.trim().replace(r,"").replace(/'/gm,'"'),re.debug(`Detecting diagram directive${e!==null?" type:"+e:""} based on the text:${t}`);let n,i=[];for(;(n=J0.exec(t))!==null;)if(n.index===J0.lastIndex&&J0.lastIndex++,n&&!e||e&&n[1]?.match(e)||e&&n[2]?.match(e)){let a=n[1]?n[1]:n[2],s=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;i.push({type:a,args:s})}return i.length===0?{type:t,args:null}:i.length===1?i[0]:i}catch(r){return re.error(`ERROR: ${r.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`),{type:void 0,args:null}}},"detectDirective"),VX=v(function(t){return t.replace(J0,"")},"removeDirectives"),STe=v(function(t,e){for(let[r,n]of e.entries())if(n.match(t))return r;return-1},"isSubstringInArray");v($3,"interpolateToCurve");v(WX,"formatUrl");CTe=v((t,...e)=>{let r=t.split("."),n=r.length-1,i=r[n],a=window;for(let s=0;s{let r=Math.pow(10,e);return Math.round(t*r)/r},"roundNumber"),sA=v((t,e)=>{let r,n=e;for(let i of t){if(r){let a=aA(i,r);if(a=1)return{x:i.x,y:i.y};if(s>0&&s<1)return{x:zX((1-s)*r.x+s*i.x,5),y:zX((1-s)*r.y+s*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),ATe=v((t,e,r)=>{re.info(`our points ${JSON.stringify(e)}`),e[0]!==r&&(e=e.reverse());let i=sA(e,25),a=t?10:5,s=Math.atan2(e[0].y-i.y,e[0].x-i.x),o={x:0,y:0};return o.x=Math.sin(s)*a+(e[0].x+i.x)/2,o.y=-Math.cos(s)*a+(e[0].y+i.y)/2,o},"calcCardinalityPosition");v(YX,"calcTerminalLabelPosition");v(G3,"getStylesFromArray");$X=0,oA=v(()=>($X++,"id-"+Math.random().toString(36).substr(2,12)+"-"+$X),"generateId");v(XX,"makeRandomHex");lA=v(t=>XX(t.length),"random"),_Te=v(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),LTe=v(function(t,e){let r=e.text.replace(Xe.lineBreakRegex," "),[,n]=Ro(e.fontSize),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.style("text-anchor",e.anchor),i.style("font-family",e.fontFamily),i.style("font-size",n),i.style("font-weight",e.fontWeight),i.attr("fill",e.fill),e.class!==void 0&&i.attr("class",e.class);let a=i.append("tspan");return a.attr("x",e.x+e.textMargin*2),a.attr("fill",e.fill),a.text(r),i},"drawSimpleText"),cA=Dp((t,e,r)=>{if(!t||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},r),Xe.lineBreakRegex.test(t)))return t;let n=t.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,o)=>{let l=bs(`${s} `,r),u=bs(a,r);if(l>e){let{hyphenatedStrings:d,remainingWord:p}=RTe(s,e,"-",r);i.push(a,...d),a=p}else u+l>=e?(i.push(a),a=s):a=[a,s].filter(Boolean).join(" ");o+1===n.length&&i.push(a)}),i.filter(s=>s!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),RTe=Dp((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...t],a=[],s="";return i.forEach((o,l)=>{let u=`${s}${o}`;if(bs(u,n)>=e){let f=l+1,d=i.length===f,p=`${u}${r}`;a.push(d?u:p),s=""}else s=u}),{hyphenatedStrings:a,remainingWord:s}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);v(Gv,"calculateTextHeight");v(bs,"calculateTextWidth");uA=Dp((t,e)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};let[,a]=Ro(r),s=["sans-serif",n],o=t.split(Xe.lineBreakRegex),l=[],u=Ve("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let h=u.append("svg");for(let d of s){let p=0,g={width:0,height:0,lineHeight:0};for(let m of o){let y=_Te();y.text=m||iA;let x=LTe(h,y).style("font-size",a).style("font-weight",i).style("font-family",d),b=(x._groups||x)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,b.width)),p=Math.round(b.height),g.height+=p,g.lineHeight=Math.round(Math.max(g.lineHeight,p))}l.push(g)}h.remove();let f=isNaN(l[1].height)||isNaN(l[1].width)||isNaN(l[1].lineHeight)||l[0].height>l[1].height&&l[0].width>l[1].width&&l[0].lineHeight>l[1].lineHeight?0:1;return l[f]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),NTe=class{constructor(t=!1,e){this.count=0,this.count=e?e.length:0,this.next=t?()=>this.count++:()=>Date.now()}static{v(this,"InitIDGenerator")}},ITe=v(function(t){return z3=z3||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),z3.innerHTML=t,unescape(z3.textContent)},"entityDecode");v(U3,"isDetailedError");MTe=v((t,e,r,n)=>{if(!n)return;let i=t.node()?.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),Ro=v(t=>{if(typeof t=="number")return[t,t+"px"];let e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");v(ws,"cleanAndMerge");Ut={assignWithDepth:Hn,wrapLabel:cA,calculateTextHeight:Gv,calculateTextWidth:bs,calculateTextDimensions:uA,cleanAndMerge:ws,detectInit:ETe,detectDirective:UX,isSubstringInArray:STe,interpolateToCurve:$3,calcLabelPosition:qX,calcCardinalityPosition:ATe,calcTerminalLabelPosition:YX,formatUrl:WX,getStylesFromArray:G3,generateId:oA,random:lA,runFunc:CTe,entityDecode:ITe,insertTitle:MTe,parseFontSize:Ro,InitIDGenerator:NTe},jX=v(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),e},"encodeEntities"),Xs=v(function(t){return t.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),V3=v((t,e,{counter:r=0,prefix:n,suffix:i})=>`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");v(Aa,"handleUndefinedAttr")});function dA(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function tj(t){xd=t}function js(t,e){if(e){if(rj.test(t))return t.replace(DTe,KX)}else if(nj.test(t))return t.replace(OTe,KX);return t}function FTe(t){return t.replace(BTe,(e,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}function sn(t,e){let r=typeof t=="string"?t:t.source;e=e||"";let n={replace:(i,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(zTe,"$1"),r=r.replace(i,s),n},getRegex:()=>new RegExp(r,e)};return n}function ZX(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}function QX(t,e){let r=t.replace(/\|/g,(a,s,o)=>{let l=!1,u=s;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),n=r.split(/ \|/),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length{let a=i.match(/^\s+/);if(a===null)return i;let[s]=a;return s.length>=n.length?i.slice(n.length):i}).join(` `)}function Yr(t,e){return yd.parse(t,e)}var xd,rj,DTe,nj,OTe,PTe,KX,BTe,zTe,Wv,jp,UTe,VTe,WTe,qv,HTe,ij,aj,pA,qTe,gA,YTe,XTe,q3,mA,jTe,sj,KTe,vA,ej,ZTe,QTe,oj,JTe,lj,e6e,Yv,t6e,r6e,n6e,i6e,a6e,s6e,o6e,l6e,c6e,H3,u6e,cj,uj,h6e,yA,f6e,hA,d6e,W3,Vv,ku,Kp,Hv,Tu,Xp,fA,yd,gvt,mvt,vvt,yvt,xvt,bvt,wvt,hj=F(()=>{xd=dA();rj=/[&<>"']/,DTe=new RegExp(rj.source,"g"),nj=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,OTe=new RegExp(nj.source,"g"),PTe={"&":"&","<":"<",">":">",'"':""","'":"'"},KX=t=>PTe[t];BTe=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;zTe=/(^|[^\[])\^/g;Wv={exec:()=>null};jp=class{options;rules;lexer;constructor(e){this.options=e||xd}space(e){let r=this.rules.block.newline.exec(e);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(e){let r=this.rules.block.code.exec(e);if(r){let n=r[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Uv(n,` `)}}}fences(e){let r=this.rules.block.fences.exec(e);if(r){let n=r[0],i=GTe(n,r[3]||"");return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(e){let r=this.rules.block.heading.exec(e);if(r){let n=r[2].trim();if(/#$/.test(n)){let i=Uv(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let r=this.rules.block.hr.exec(e);if(r)return{type:"hr",raw:Uv(r[0],` `)}}blockquote(e){let r=this.rules.block.blockquote.exec(e);if(r){let n=Uv(r[0],` `).split(` `),i="",a="",s=[];for(;n.length>0;){let o=!1,l=[],u;for(u=0;u/.test(n[u]))l.push(n[u]),o=!0;else if(!o)l.push(n[u]);else break;n=n.slice(u);let h=l.join(` `),f=h.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,` $1`).replace(/^ {0,3}>[ \t]?/gm,"");i=i?`${i} ${h}`:h,a=a?`${a} ${f}`:f;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,s,!0),this.lexer.state.top=d,n.length===0)break;let p=s[s.length-1];if(p?.type==="code")break;if(p?.type==="blockquote"){let g=p,m=g.raw+` `+n.join(` `),y=this.blockquote(m);s[s.length-1]=y,i=i.substring(0,i.length-g.raw.length)+y.raw,a=a.substring(0,a.length-g.text.length)+y.text;break}else if(p?.type==="list"){let g=p,m=g.raw+` `+n.join(` `),y=this.list(m);s[s.length-1]=y,i=i.substring(0,i.length-p.raw.length)+y.raw,a=a.substring(0,a.length-g.raw.length)+y.raw,n=m.substring(s[s.length-1].raw.length).split(` `);continue}}return{type:"blockquote",raw:i,tokens:s,text:a}}}list(e){let r=this.rules.block.list.exec(e);if(r){let n=r[1].trim(),i=n.length>1,a={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let s=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),o=!1;for(;e;){let l=!1,u="",h="";if(!(r=s.exec(e))||this.rules.block.hr.test(e))break;u=r[0],e=e.substring(u.length);let f=r[2].split(` `,1)[0].replace(/^\t+/,x=>" ".repeat(3*x.length)),d=e.split(` `,1)[0],p=!f.trim(),g=0;if(this.options.pedantic?(g=2,h=f.trimStart()):p?g=r[1].length+1:(g=r[2].search(/[^ ]/),g=g>4?1:g,h=f.slice(g),g+=r[1].length),p&&/^ *$/.test(d)&&(u+=d+` `,e=e.substring(d.length+1),l=!0),!l){let x=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),b=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),_=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;e;){let k=e.split(` `,1)[0];if(d=k,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),w.test(d)||_.test(d)||x.test(d)||b.test(e))break;if(d.search(/[^ ]/)>=g||!d.trim())h+=` `+d.slice(g);else{if(p||f.search(/[^ ]/)>=4||w.test(f)||_.test(f)||b.test(f))break;h+=` `+d}!p&&!d.trim()&&(p=!0),u+=k+` `,e=e.substring(k.length+1),f=d.slice(g)}}a.loose||(o?a.loose=!0:/\n *\n *$/.test(u)&&(o=!0));let m=null,y;this.options.gfm&&(m=/^\[[ xX]\] /.exec(h),m&&(y=m[0]!=="[ ] ",h=h.replace(/^\[[ xX]\] +/,""))),a.items.push({type:"list_item",raw:u,task:!!m,checked:y,loose:!1,text:h,tokens:[]}),a.raw+=u}a.items[a.items.length-1].raw=a.items[a.items.length-1].raw.trimEnd(),a.items[a.items.length-1].text=a.items[a.items.length-1].text.trimEnd(),a.raw=a.raw.trimEnd();for(let l=0;lf.type==="space"),h=u.length>0&&u.some(f=>/\n.*\n/.test(f.raw));a.loose=h}if(a.loose)for(let l=0;l$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:a}}}table(e){let r=this.rules.block.table.exec(e);if(!r||!/[:|]/.test(r[2]))return;let n=QX(r[1]),i=r[2].replace(/^\||\| *$/g,"").split("|"),a=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(` `):[],s={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let o of i)/^ *-+: *$/.test(o)?s.align.push("right"):/^ *:-+: *$/.test(o)?s.align.push("center"):/^ *:-+ *$/.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(e){let r=this.rules.block.lheading.exec(e);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(e){let r=this.rules.block.paragraph.exec(e);if(r){let n=r[1].charAt(r[1].length-1)===` `?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let r=this.rules.block.text.exec(e);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(e){let r=this.rules.inline.escape.exec(e);if(r)return{type:"escape",raw:r[0],text:js(r[1])}}tag(e){let r=this.rules.inline.tag.exec(e);if(r)return!this.lexer.state.inLink&&/^/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(e){let r=this.rules.inline.link.exec(e);if(r){let n=r[2].trim();if(!this.options.pedantic&&/^$/.test(n))return;let s=Uv(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=$Te(r[2],"()");if(s>-1){let l=(r[0].indexOf("!")===0?5:4)+r[1].length+s;r[2]=r[2].substring(0,s),r[0]=r[0].substring(0,l).trim(),r[3]=""}}let i=r[2],a="";if(this.options.pedantic){let s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);s&&(i=s[1],a=s[3])}else a=r[3]?r[3].slice(1,-1):"";return i=i.trim(),/^$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),JX(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(e,r){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(/\s+/g," "),a=r[i.toLowerCase()];if(!a){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return JX(n,a,n[0],this.lexer)}}emStrong(e,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...i[0]].length-1,o,l,u=s,h=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,r=r.slice(-1*e.length+s);(i=f.exec(r))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(l=[...o].length,i[3]||i[4]){u+=l;continue}else if((i[5]||i[6])&&s%3&&!((s+l)%3)){h+=l;continue}if(u-=l,u>0)continue;l=Math.min(l,l+u+h);let d=[...i[0]][0].length,p=e.slice(0,s+i.index+d+l);if(Math.min(s,l)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let r=this.rules.inline.code.exec(e);if(r){let n=r[2].replace(/\n/g," "),i=/[^ ]/.test(n),a=/^ /.test(n)&&/ $/.test(n);return i&&a&&(n=n.substring(1,n.length-1)),n=js(n,!0),{type:"codespan",raw:r[0],text:n}}}br(e){let r=this.rules.inline.br.exec(e);if(r)return{type:"br",raw:r[0]}}del(e){let r=this.rules.inline.del.exec(e);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(e){let r=this.rules.inline.autolink.exec(e);if(r){let n,i;return r[2]==="@"?(n=js(r[1]),i="mailto:"+n):(n=js(r[1]),i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let r;if(r=this.rules.inline.url.exec(e)){let n,i;if(r[2]==="@")n=js(r[0]),i="mailto:"+n;else{let a;do a=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(a!==r[0]);n=js(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let r=this.rules.inline.text.exec(e);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=js(r[0]),{type:"text",raw:r[0],text:n}}}},UTe=/^(?: *(?:\n|$))+/,VTe=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,WTe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,HTe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ij=/(?:[*+-]|\d{1,9}[.)])/,aj=sn(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ij).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),pA=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,qTe=/^[^\n]+/,gA=/(?!\s*\])(?:\\.|[^\[\]\\])+/,YTe=sn(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",gA).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),XTe=sn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ij).getRegex(),q3="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",mA=/|$))/,jTe=sn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",mA).replace("tag",q3).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),sj=sn(pA).replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",q3).getRegex(),KTe=sn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",sj).getRegex(),vA={blockquote:KTe,code:VTe,def:YTe,fences:WTe,heading:HTe,hr:qv,html:jTe,lheading:aj,list:XTe,newline:UTe,paragraph:sj,table:Wv,text:qTe},ej=sn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",q3).getRegex(),ZTe={...vA,table:ej,paragraph:sn(pA).replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ej).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",q3).getRegex()},QTe={...vA,html:sn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",mA).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wv,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:sn(pA).replace("hr",qv).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",aj).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},oj=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,JTe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lj=/^( {2,}|\\)\n(?!\s*$)/,e6e=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,n6e=sn(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Yv).getRegex(),i6e=sn("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Yv).getRegex(),a6e=sn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Yv).getRegex(),s6e=sn(/\\([punct])/,"gu").replace(/punct/g,Yv).getRegex(),o6e=sn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),l6e=sn(mA).replace("(?:-->|$)","-->").getRegex(),c6e=sn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",l6e).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),H3=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,u6e=sn(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",H3).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),cj=sn(/^!?\[(label)\]\[(ref)\]/).replace("label",H3).replace("ref",gA).getRegex(),uj=sn(/^!?\[(ref)\](?:\[\])?/).replace("ref",gA).getRegex(),h6e=sn("reflink|nolink(?!\\()","g").replace("reflink",cj).replace("nolink",uj).getRegex(),yA={_backpedal:Wv,anyPunctuation:s6e,autolink:o6e,blockSkip:r6e,br:lj,code:JTe,del:Wv,emStrongLDelim:n6e,emStrongRDelimAst:i6e,emStrongRDelimUnd:a6e,escape:oj,link:u6e,nolink:uj,punctuation:t6e,reflink:cj,reflinkSearch:h6e,tag:c6e,text:e6e,url:Wv},f6e={...yA,link:sn(/^!?\[(label)\]\((.*?)\)/).replace("label",H3).getRegex(),reflink:sn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",H3).getRegex()},hA={...yA,escape:sn(oj).replace("])","~|])").getRegex(),url:sn(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\l+" ".repeat(u.length));let i,a,s;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(i=o.call({lexer:this},e,r))?(e=e.substring(i.raw.length),r.push(i),!0):!1))){if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length),i.raw.length===1&&r.length>0?r[r.length-1].raw+=` `:r.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length),a=r[r.length-1],a&&(a.type==="paragraph"||a.type==="text")?(a.raw+=` `+i.raw,a.text+=` `+i.text,this.inlineQueue[this.inlineQueue.length-1].src=a.text):r.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length),a=r[r.length-1],a&&(a.type==="paragraph"||a.type==="text")?(a.raw+=` `+i.raw,a.text+=` `+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=a.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),r.push(i);continue}if(s=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0,l=e.slice(1),u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},l),typeof u=="number"&&u>=0&&(o=Math.min(o,u))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){a=r[r.length-1],n&&a?.type==="paragraph"?(a.raw+=` `+i.raw,a.text+=` `+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=a.text):r.push(i),n=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length),a=r[r.length-1],a&&a.type==="text"?(a.raw+=` `+i.raw,a.text+=` `+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=a.text):r.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){let n,i,a,s=e,o,l,u;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(u=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},e,r))?(e=e.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(e,s,u)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),r.push(n);continue}if(a=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0,f=e.slice(1),d;this.options.extensions.startInline.forEach(p=>{d=p.call({lexer:this},f),typeof d=="number"&&d>=0&&(h=Math.min(h,d))}),h<1/0&&h>=0&&(a=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(a)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(u=n.raw.slice(-1)),l=!0,i=r[r.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(e){let h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},Kp=class{options;parser;constructor(e){this.options=e||xd}space(e){return""}code({text:e,lang:r,escaped:n}){let i=(r||"").match(/^\S*/)?.[0],a=e.replace(/\n$/,"")+` `;return i?'
'+(n?a:js(a,!0))+`
`:"
"+(n?a:js(a,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}heading({tokens:e,depth:r}){return`${this.parser.parseInline(e)} `}hr(e){return`
`}list(e){let r=e.ordered,n=e.start,i="";for(let o=0;o `+i+" `}listitem(e){let r="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" "}):r+=n+" "}return r+=this.parser.parse(e.tokens,!!e.loose),`
  • ${r}
  • `}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    `}table(e){let r="",n="";for(let a=0;a${i}`),` `+r+` `+i+`
    `}tablerow({text:e}){return` ${e} `}tablecell(e){let r=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+r+` `}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${e}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:r,tokens:n}){let i=this.parser.parseInline(n),a=ZX(e);if(a===null)return i;e=a;let s='
    ",s}image({href:e,title:r,text:n}){let i=ZX(e);if(i===null)return n;e=i;let a=`${n}{let o=a[s].flat(1/0);n=n.concat(this.walkTokens(o,r))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,r)))}}return n}use(...e){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let s=r.renderers[a.name];s?r.renderers[a.name]=function(...o){let l=a.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:r.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=r[a.level];s?s.unshift(a.tokenizer):r[a.level]=[a.tokenizer],a.start&&(a.level==="block"?r.startBlock?r.startBlock.push(a.start):r.startBlock=[a.start]:a.level==="inline"&&(r.startInline?r.startInline.push(a.start):r.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(r.childTokens[a.name]=a.childTokens)}),i.extensions=r),n.renderer){let a=this.defaults.renderer||new Kp(this.defaults);for(let s in n.renderer){if(!(s in a))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,l=n.renderer[o];n.useNewRenderer||(l=this.#t(l,o,a));let u=a[o];a[o]=(...h)=>{let f=l.apply(a,h);return f===!1&&(f=u.apply(a,h)),f||""}}i.renderer=a}if(n.tokenizer){let a=this.defaults.tokenizer||new jp(this.defaults);for(let s in n.tokenizer){if(!(s in a))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,l=n.tokenizer[o],u=a[o];a[o]=(...h)=>{let f=l.apply(a,h);return f===!1&&(f=u.apply(a,h)),f}}i.tokenizer=a}if(n.hooks){let a=this.defaults.hooks||new Xp;for(let s in n.hooks){if(!(s in a))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;let o=s,l=n.hooks[o],u=a[o];Xp.passThroughHooks.has(s)?a[o]=h=>{if(this.defaults.async)return Promise.resolve(l.call(a,h)).then(d=>u.call(a,d));let f=l.call(a,h);return u.call(a,f)}:a[o]=(...h)=>{let f=l.apply(a,h);return f===!1&&(f=u.apply(a,h)),f}}i.hooks=a}if(n.walkTokens){let a=this.defaults.walkTokens,s=n.walkTokens;i.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),a&&(l=l.concat(a.call(this,o))),l}}this.defaults={...this.defaults,...i}}),this}#t(e,r,n){switch(r){case"heading":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,n.parser.parseInline(i.tokens),i.depth,FTe(n.parser.parseInline(i.tokens,n.parser.textRenderer)))};case"code":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.text,i.lang,!!i.escaped)};case"table":return function(i){if(!i.type||i.type!==r)return e.apply(this,arguments);let a="",s="";for(let l=0;l0&&h.tokens[0].type==="paragraph"?(h.tokens[0].text=g+" "+h.tokens[0].text,h.tokens[0].tokens&&h.tokens[0].tokens.length>0&&h.tokens[0].tokens[0].type==="text"&&(h.tokens[0].tokens[0].text=g+" "+h.tokens[0].tokens[0].text)):h.tokens.unshift({type:"text",text:g+" "}):p+=g+" "}p+=this.parser.parse(h.tokens,o),l+=this.listitem({type:"list_item",raw:p,text:p,task:d,checked:!!f,loose:o,tokens:h.tokens})}return e.call(this,l,a,s)};case"html":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.text,i.block)};case"paragraph":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,this.parser.parseInline(i.tokens))};case"escape":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.text)};case"link":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.href,i.title,this.parser.parseInline(i.tokens))};case"image":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.href,i.title,i.text)};case"strong":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,this.parser.parseInline(i.tokens))};case"em":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,this.parser.parseInline(i.tokens))};case"codespan":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.text)};case"del":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,this.parser.parseInline(i.tokens))};case"text":return function(i){return!i.type||i.type!==r?e.apply(this,arguments):e.call(this,i.text)}}return e}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,r){return ku.lex(e,r??this.defaults)}parser(e,r){return Tu.parse(e,r??this.defaults)}#e(e,r){return(n,i)=>{let a={...i},s={...this.defaults,...a};this.defaults.async===!0&&a.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);let o=this.#r(!!s.silent,!!s.async);if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(l=>e(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>r(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let l=e(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let u=r(l,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(l){return o(l)}}}#r(e,r){return n=>{if(n.message+=` Please report this to https://github.com/markedjs/marked.`,e){let i="

    An error occurred:

    "+js(n.message+"",!0)+"
    ";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},yd=new fA;Yr.options=Yr.setOptions=function(t){return yd.setOptions(t),Yr.defaults=yd.defaults,tj(Yr.defaults),Yr};Yr.getDefaults=dA;Yr.defaults=xd;Yr.use=function(...t){return yd.use(...t),Yr.defaults=yd.defaults,tj(Yr.defaults),Yr};Yr.walkTokens=function(t,e){return yd.walkTokens(t,e)};Yr.parseInline=yd.parseInline;Yr.Parser=Tu;Yr.parser=Tu.parse;Yr.Renderer=Kp;Yr.TextRenderer=Hv;Yr.Lexer=ku;Yr.lexer=ku.lex;Yr.Tokenizer=jp;Yr.Hooks=Xp;Yr.parse=Yr;gvt=Yr.options,mvt=Yr.setOptions,vvt=Yr.use,yvt=Yr.walkTokens,xvt=Yr.parseInline,bvt=Tu.parse,wvt=ku.lex});function Y3(t){for(var e=[],r=1;r{});function fj(t,{markdownAutoWrap:e}){let n=t.replace(//g,` `).replace(/\n{2,}/g,` `),i=Y3(n);return e===!1?i.replace(/ /g," "):i}function dj(t,e={}){let r=fj(t,e),n=Yr.lexer(r),i=[[]],a=0;function s(o,l="normal"){o.type==="text"?o.text.split(` `).forEach((h,f)=>{f!==0&&(a++,i.push([])),h.split(" ").forEach(d=>{d=d.replace(/'/g,"'"),d&&i[a].push({content:d,type:l})})}):o.type==="strong"||o.type==="em"?o.tokens.forEach(u=>{s(u,o.type)}):o.type==="html"&&i[a].push({content:o.text,type:"normal"})}return v(s,"processNode"),n.forEach(o=>{o.type==="paragraph"?o.tokens?.forEach(l=>{s(l)}):o.type==="html"&&i[a].push({content:o.text,type:"normal"})}),i}function pj(t,{markdownAutoWrap:e}={}){let r=Yr.lexer(t);function n(i){return i.type==="text"?e===!1?i.text.replace(/\n */g,"
    ").replace(/ /g," "):i.text.replace(/\n */g,"
    "):i.type==="strong"?`${i.tokens?.map(n).join("")}`:i.type==="em"?`${i.tokens?.map(n).join("")}`:i.type==="paragraph"?`

    ${i.tokens?.map(n).join("")}

    `:i.type==="space"?"":i.type==="html"?`${i.text}`:i.type==="escape"?i.text:`Unsupported markdown: ${i.type}`}return v(n,"output"),r.map(n).join("")}function gj(t){return Intl.Segmenter?[...new Intl.Segmenter().segment(t)].map(e=>e.segment):[...t]}function mj(t,e){let r=gj(e.content);return wA(t,[],r,e.type)}function wA(t,e,r,n){if(r.length===0)return[{content:e.join(""),type:n},{content:"",type:n}];let[i,...a]=r,s=[...e,i];return t([{content:s.join(""),type:n}])?wA(t,s,a,n):(e.length===0&&i&&(e.push(i),r.shift()),[{content:e.join(""),type:n},{content:r.join(""),type:n}])}function vj(t,e){if(t.some(({content:r})=>r.includes(` `)))throw new Error("splitLineToFitWidth does not support newlines in the line");return X3(t,e)}function X3(t,e,r=[],n=[]){if(t.length===0)return n.length>0&&r.push(n),r.length>0?r:[];let i="";t[0].content===" "&&(i=" ",t.shift());let a=t.shift()??{content:" ",type:"normal"},s=[...n];if(i!==""&&s.push({content:i,type:"normal"}),s.push(a),e(s))return X3(t,e,r,s);if(n.length>0)r.push(n),t.unshift(a);else if(a.content){let[o,l]=mj(e,a);r.push([o]),l.content&&t.unshift(l)}return X3(t,e,r)}function bA(t,e){e&&t.attr("style",e)}async function yj(t,e,r,n,i=!1){let a=t.append("foreignObject");a.attr("width",`${10*r}px`),a.attr("height",`${10*r}px`);let s=a.append("xhtml:div"),o=e.label;e.label&&Ei(e.label)&&(o=await fh(e.label.replace(Xe.lineBreakRegex,` `),pe()));let l=e.isNode?"nodeLabel":"edgeLabel",u=s.append("span");u.html(o),bA(u,e.labelStyle),u.attr("class",`${l} ${n}`),bA(s,e.labelStyle),s.style("display","table-cell"),s.style("white-space","nowrap"),s.style("line-height","1.5"),s.style("max-width",r+"px"),s.style("text-align","center"),s.attr("xmlns","http://www.w3.org/1999/xhtml"),i&&s.attr("class","labelBkg");let h=s.node().getBoundingClientRect();return h.width===r&&(s.style("display","table"),s.style("white-space","break-spaces"),s.style("width",r+"px"),h=s.node().getBoundingClientRect()),a.node()}function j3(t,e,r){return t.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",e*r-.1+"em").attr("dy",r+"em")}function xj(t,e,r){let n=t.append("text"),i=j3(n,1,e);K3(i,r);let a=i.node().getComputedTextLength();return n.remove(),a}function kA(t,e,r){let n=t.append("text"),i=j3(n,1,e);K3(i,[{content:r,type:"normal"}]);let a=i.node()?.getBoundingClientRect();return a&&n.remove(),a}function bj(t,e,r,n=!1){let a=e.append("g"),s=a.insert("rect").attr("class","background").attr("style","stroke: none"),o=a.append("text").attr("y","-10.1"),l=0;for(let u of r){let h=v(d=>xj(a,1.1,d)<=t,"checkWidth"),f=h(u)?[u]:vj(u,h);for(let d of f){let p=j3(o,l,1.1);K3(p,d),l++}}if(n){let u=o.node().getBBox(),h=2;return s.attr("x",u.x-h).attr("y",u.y-h).attr("width",u.width+2*h).attr("height",u.height+2*h),a.node()}else return o.node()}function K3(t,e){t.text(""),e.forEach((r,n)=>{let i=t.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");n===0?i.text(r.content):i.text(" "+r.content)})}function Z3(t){return t.replace(/fa[bklrs]?:fa-[\w-]+/g,e=>``)}var oa,Ya=F(()=>{kn();or();lr();hj();xA();v(fj,"preprocessMarkdown");v(dj,"markdownToLines");v(pj,"markdownToHTML");v(gj,"splitTextToChars");v(mj,"splitWordToFitWidth");v(wA,"splitWordToFitWidthRecursion");v(vj,"splitLineToFitWidth");v(X3,"splitLineToFitWidthRecursion");v(bA,"applyStyle");v(yj,"addHtmlSpan");v(j3,"createTspan");v(xj,"computeWidthOfText");v(kA,"computeDimensionOfText");v(bj,"createFormattedText");v(K3,"updateTextContentAndStyles");v(Z3,"replaceIconSubstring");oa=v(async(t,e="",{style:r="",isTitle:n=!1,classes:i="",useHtmlLabels:a=!0,isNode:s=!0,width:o=200,addSvgBackground:l=!1}={},u)=>{if(re.debug("XYZ createText",e,r,n,i,a,s,"addSvgBackground: ",l),a){let h=pj(e,u),f=Z3(Xs(h)),d=e.replace(/\\\\/g,"\\"),p={isNode:s,label:Ei(e)?d:f,labelStyle:r.replace("fill:","color:")};return await yj(t,p,o,i,l)}else{let h=e.replace(//g,"
    "),f=dj(h.replace("
    ","
    "),u),d=bj(o,t,f,e?l:!1);if(s){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));let p=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Ve(d).attr("style",p)}else{let p=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Ve(d).select("rect").attr("style",p.replace(/background:/g,"fill:"));let g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Ve(d).select("text").attr("style",g)}return d}},"createText")});function TA(t,e,r){if(t&&t.length){let[n,i]=e,a=Math.PI/180*r,s=Math.cos(a),o=Math.sin(a);for(let l of t){let[u,h]=l;l[0]=(u-n)*s-(h-i)*o+n,l[1]=(u-n)*o+(h-i)*s+i}}}function p6e(t,e){return t[0]===e[0]&&t[1]===e[1]}function g6e(t,e,r,n=1){let i=r,a=Math.max(e,.1),s=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,o=[0,0];if(i)for(let u of s)TA(u,o,i);let l=function(u,h,f){let d=[];for(let b of u){let w=[...b];p6e(w[0],w[w.length-1])||w.push([w[0][0],w[0][1]]),w.length>2&&d.push(w)}let p=[];h=Math.max(h,.1);let g=[];for(let b of d)for(let w=0;wb.yminw.ymin?1:b.xw.x?1:b.ymax===w.ymax?0:(b.ymax-w.ymax)/Math.abs(b.ymax-w.ymax)),!g.length)return p;let m=[],y=g[0].ymin,x=0;for(;m.length||g.length;){if(g.length){let b=-1;for(let w=0;wy);w++)b=w;g.splice(0,b+1).forEach(w=>{m.push({s:y,edge:w})})}if(m=m.filter(b=>!(b.edge.ymax<=y)),m.sort((b,w)=>b.edge.x===w.edge.x?0:(b.edge.x-w.edge.x)/Math.abs(b.edge.x-w.edge.x)),(f!==1||x%h==0)&&m.length>1)for(let b=0;b=m.length)break;let _=m[b].edge,k=m[w].edge;p.push([[Math.round(_.x),y],[Math.round(k.x),y]])}y+=f,m.forEach(b=>{b.edge.x=b.edge.x+f*b.edge.islope}),x++}return p}(s,a,n);if(i){for(let u of s)TA(u,o,-i);(function(u,h,f){let d=[];u.forEach(p=>d.push(...p)),TA(d,h,f)})(l,o,-i)}return l}function Zv(t,e){var r;let n=e.hachureAngle+90,i=e.hachureGap;i<0&&(i=4*e.strokeWidth),i=Math.round(Math.max(i,.1));let a=1;return e.roughness>=1&&(((r=e.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(a=i),g6e(t,i,n,a||1)}function s5(t){let e=t[0],r=t[1];return Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2))}function SA(t,e){return t.type===e}function zA(t){let e=[],r=function(s){let o=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))o[o.length]={type:m6e,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];o[o.length]={type:EA,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return o[o.length]={type:wj,text:""},o}(t),n="BOD",i=0,a=r[i];for(;!SA(a,wj);){let s=0,o=[];if(n==="BOD"){if(a.text!=="M"&&a.text!=="m")return zA("M0,0"+t);i++,s=Q3[a.text],n=a.text}else SA(a,EA)?s=Q3[n]:(i++,s=Q3[a.text],n=a.text);if(!(i+sh%2?u+r:u+e);a.push({key:"C",data:l}),e=l[4],r=l[5];break}case"Q":a.push({key:"Q",data:[...o]}),e=o[2],r=o[3];break;case"q":{let l=o.map((u,h)=>h%2?u+r:u+e);a.push({key:"Q",data:l}),e=l[2],r=l[3];break}case"A":a.push({key:"A",data:[...o]}),e=o[5],r=o[6];break;case"a":e+=o[5],r+=o[6],a.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,r]});break;case"H":a.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],a.push({key:"H",data:[e]});break;case"V":a.push({key:"V",data:[...o]}),r=o[0];break;case"v":r+=o[0],a.push({key:"V",data:[r]});break;case"S":a.push({key:"S",data:[...o]}),e=o[2],r=o[3];break;case"s":{let l=o.map((u,h)=>h%2?u+r:u+e);a.push({key:"S",data:l}),e=l[2],r=l[3];break}case"T":a.push({key:"T",data:[...o]}),e=o[0],r=o[1];break;case"t":e+=o[0],r+=o[1],a.push({key:"T",data:[e,r]});break;case"Z":case"z":a.push({key:"Z",data:[]}),e=n,r=i}return a}function Rj(t){let e=[],r="",n=0,i=0,a=0,s=0,o=0,l=0;for(let{key:u,data:h}of t){switch(u){case"M":e.push({key:"M",data:[...h]}),[n,i]=h,[a,s]=h;break;case"C":e.push({key:"C",data:[...h]}),n=h[4],i=h[5],o=h[2],l=h[3];break;case"L":e.push({key:"L",data:[...h]}),[n,i]=h;break;case"H":n=h[0],e.push({key:"L",data:[n,i]});break;case"V":i=h[0],e.push({key:"L",data:[n,i]});break;case"S":{let f=0,d=0;r==="C"||r==="S"?(f=n+(n-o),d=i+(i-l)):(f=n,d=i),e.push({key:"C",data:[f,d,...h]}),o=h[0],l=h[1],n=h[2],i=h[3];break}case"T":{let[f,d]=h,p=0,g=0;r==="Q"||r==="T"?(p=n+(n-o),g=i+(i-l)):(p=n,g=i);let m=n+2*(p-n)/3,y=i+2*(g-i)/3,x=f+2*(p-f)/3,b=d+2*(g-d)/3;e.push({key:"C",data:[m,y,x,b,f,d]}),o=p,l=g,n=f,i=d;break}case"Q":{let[f,d,p,g]=h,m=n+2*(f-n)/3,y=i+2*(d-i)/3,x=p+2*(f-p)/3,b=g+2*(d-g)/3;e.push({key:"C",data:[m,y,x,b,p,g]}),o=f,l=d,n=p,i=g;break}case"A":{let f=Math.abs(h[0]),d=Math.abs(h[1]),p=h[2],g=h[3],m=h[4],y=h[5],x=h[6];f===0||d===0?(e.push({key:"C",data:[n,i,y,x,y,x]}),n=y,i=x):(n!==y||i!==x)&&(Nj(n,i,y,x,f,d,p,g,m).forEach(function(b){e.push({key:"C",data:b})}),n=y,i=x);break}case"Z":e.push({key:"Z",data:[]}),n=a,i=s}r=u}return e}function Xv(t,e,r){return[t*Math.cos(r)-e*Math.sin(r),t*Math.sin(r)+e*Math.cos(r)]}function Nj(t,e,r,n,i,a,s,o,l,u){let h=(f=s,Math.PI*f/180);var f;let d=[],p=0,g=0,m=0,y=0;if(u)[p,g,m,y]=u;else{[t,e]=Xv(t,e,-h),[r,n]=Xv(r,n,-h);let I=(t-r)/2,A=(e-n)/2,D=I*I/(i*i)+A*A/(a*a);D>1&&(D=Math.sqrt(D),i*=D,a*=D);let N=i*i,O=a*a,B=N*O-N*A*A-O*I*I,P=N*A*A+O*I*I,$=(o===l?-1:1)*Math.sqrt(Math.abs(B/P));m=$*i*A/a+(t+r)/2,y=$*-a*I/i+(e+n)/2,p=Math.asin(parseFloat(((e-y)/a).toFixed(9))),g=Math.asin(parseFloat(((n-y)/a).toFixed(9))),tg&&(p-=2*Math.PI),!l&&g>p&&(g-=2*Math.PI)}let x=g-p;if(Math.abs(x)>120*Math.PI/180){let I=g,A=r,D=n;g=l&&g>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,d=Nj(r=m+i*Math.cos(g),n=y+a*Math.sin(g),A,D,i,a,s,0,l,[g,I,m,y])}x=g-p;let b=Math.cos(p),w=Math.sin(p),_=Math.cos(g),k=Math.sin(g),E=Math.tan(x/4),L=4/3*i*E,S=4/3*a*E,C=[t,e],M=[t+L*w,e-S*b],R=[r+L*k,n-S*_],T=[r,n];if(M[0]=2*C[0]-M[0],M[1]=2*C[1]-M[1],u)return[M,R,T].concat(d);{d=[M,R,T].concat(d);let I=[];for(let A=0;A2){let i=[];for(let a=0;a2*Math.PI&&(p=0,g=2*Math.PI);let m=2*Math.PI/l.curveStepCount,y=Math.min(m/2,(g-p)/2),x=Aj(y,u,h,f,d,p,g,1,l);if(!l.disableMultiStroke){let b=Aj(y,u,h,f,d,p,g,1.5,l);x.push(...b)}return s&&(o?x.push(...Dh(u,h,u+f*Math.cos(p),h+d*Math.sin(p),l),...Dh(u,h,u+f*Math.cos(g),h+d*Math.sin(g),l)):x.push({op:"lineTo",data:[u,h]},{op:"lineTo",data:[u+f*Math.cos(p),h+d*Math.sin(p)]})),{type:"path",ops:x}}function Ej(t,e){let r=Rj(Lj(zA(t))),n=[],i=[0,0],a=[0,0];for(let{key:s,data:o}of r)switch(s){case"M":a=[o[0],o[1]],i=[o[0],o[1]];break;case"L":n.push(...Dh(a[0],a[1],o[0],o[1],e)),a=[o[0],o[1]];break;case"C":{let[l,u,h,f,d,p]=o;n.push(...x6e(l,u,h,f,d,p,a,e)),a=[d,p];break}case"Z":n.push(...Dh(a[0],a[1],i[0],i[1],e)),a=[i[0],i[1]]}return{type:"path",ops:n}}function CA(t,e){let r=[];for(let n of t)if(n.length){let i=e.maxRandomnessOffset||0,a=n.length;if(a>2){r.push({op:"move",data:[n[0][0]+jt(i,e),n[0][1]+jt(i,e)]});for(let s=1;s500?.4:-.0016668*l+1.233334;let h=i.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);let f=h/2,d=.2+.2*Dj(i),p=i.bowing*i.maxRandomnessOffset*(n-e)/200,g=i.bowing*i.maxRandomnessOffset*(t-r)/200;p=jt(p,i,u),g=jt(g,i,u);let m=[],y=()=>jt(f,i,u),x=()=>jt(h,i,u),b=i.preserveVertices;return a&&(s?m.push({op:"move",data:[t+(b?0:y()),e+(b?0:y())]}):m.push({op:"move",data:[t+(b?0:jt(h,i,u)),e+(b?0:jt(h,i,u))]})),s?m.push({op:"bcurveTo",data:[p+t+(r-t)*d+y(),g+e+(n-e)*d+y(),p+t+2*(r-t)*d+y(),g+e+2*(n-e)*d+y(),r+(b?0:y()),n+(b?0:y())]}):m.push({op:"bcurveTo",data:[p+t+(r-t)*d+x(),g+e+(n-e)*d+x(),p+t+2*(r-t)*d+x(),g+e+2*(n-e)*d+x(),r+(b?0:x()),n+(b?0:x())]}),m}function J3(t,e,r){if(!t.length)return[];let n=[];n.push([t[0][0]+jt(e,r),t[0][1]+jt(e,r)]),n.push([t[0][0]+jt(e,r),t[0][1]+jt(e,r)]);for(let i=1;i3){let a=[],s=1-r.curveTightness;i.push({op:"move",data:[t[1][0],t[1][1]]});for(let o=1;o+21&&i.push(o)):i.push(o),i.push(t[e+3])}else{let l=t[e+0],u=t[e+1],h=t[e+2],f=t[e+3],d=bd(l,u,.5),p=bd(u,h,.5),g=bd(h,f,.5),m=bd(d,p,.5),y=bd(p,g,.5),x=bd(m,y,.5);PA([l,d,m,x],0,r,i),PA([x,y,g,f],0,r,i)}var a,s;return i}function w6e(t,e){return a5(t,0,t.length,e)}function a5(t,e,r,n,i){let a=i||[],s=t[e],o=t[r-1],l=0,u=1;for(let h=e+1;hl&&(l=f,u=h)}return Math.sqrt(l)>n?(a5(t,e,u+1,n,a),a5(t,u,r,n,a)):(a.length||a.push(s),a.push(o)),a}function AA(t,e=.15,r){let n=[],i=(t.length-1)/3;for(let a=0;a0?a5(n,0,n.length,r):n}var Kv,_A,LA,RA,NA,IA,ks,MA,m6e,EA,wj,Q3,v6e,Ks,Qp,BA,e5,FA,Ye,$t=F(()=>{Kv=class{constructor(e){this.helper=e}fillPolygons(e,r){return this._fillPolygons(e,r)}_fillPolygons(e,r){let n=Zv(e,r);return{type:"fillSketch",ops:this.renderLines(n,r)}}renderLines(e,r){let n=[];for(let i of e)n.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],r));return n}};_A=class extends Kv{fillPolygons(e,r){let n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);let i=Zv(e,Object.assign({},r,{hachureGap:n})),a=Math.PI/180*r.hachureAngle,s=[],o=.5*n*Math.cos(a),l=.5*n*Math.sin(a);for(let[u,h]of i)s5([u,h])&&s.push([[u[0]-o,u[1]+l],[...h]],[[u[0]+o,u[1]-l],[...h]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}},LA=class extends Kv{fillPolygons(e,r){let n=this._fillPolygons(e,r),i=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),a=this._fillPolygons(e,i);return n.ops=n.ops.concat(a.ops),n}},RA=class{constructor(e){this.helper=e}fillPolygons(e,r){let n=Zv(e,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(n,r)}dotsOnLines(e,r){let n=[],i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let a=r.fillWeight;a<0&&(a=r.strokeWidth/2);let s=i/4;for(let o of e){let l=s5(o),u=l/i,h=Math.ceil(u)-1,f=l-h*i,d=(o[0][0]+o[1][0])/2-i/4,p=Math.min(o[0][1],o[1][1]);for(let g=0;g{let o=s5(s),l=Math.floor(o/(n+i)),u=(o+i-l*(n+i))/2,h=s[0],f=s[1];h[0]>f[0]&&(h=s[1],f=s[0]);let d=Math.atan((f[1]-h[1])/(f[0]-h[0]));for(let p=0;p{let s=s5(a),o=Math.round(s/(2*r)),l=a[0],u=a[1];l[0]>u[0]&&(l=a[1],u=a[0]);let h=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let f=0;f2*Math.PI&&(L=0,S=2*Math.PI);let C=(S-L)/b.curveStepCount,M=[];for(let R=L;R<=S;R+=C)M.push([w+k*Math.cos(R),_+E*Math.sin(R)]);return M.push([w+k*Math.cos(S),_+E*Math.sin(S)]),M.push([w,_]),Zp([M],b)}(e,r,n,i,a,s,u));return u.stroke!==Ks&&h.push(f),this._d("arc",h,u)}curve(e,r){let n=this._o(r),i=[],a=kj(e,n);if(n.fill&&n.fill!==Ks)if(n.fillStyle==="solid"){let s=kj(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],o=e;if(o.length){let l=typeof o[0][0]=="number"?[o]:o;for(let u of l)u.length<3?s.push(...u):u.length===3?s.push(...AA(_j([u[0],u[0],u[1],u[2]]),10,(1+n.roughness)/2)):s.push(...AA(_j(u),10,(1+n.roughness)/2))}s.length&&i.push(Zp([s],n))}return n.stroke!==Ks&&i.push(a),this._d("curve",i,n)}polygon(e,r){let n=this._o(r),i=[],a=t5(e,!0,n);return n.fill&&(n.fillStyle==="solid"?i.push(CA([e],n)):i.push(Zp([e],n))),n.stroke!==Ks&&i.push(a),this._d("polygon",i,n)}path(e,r){let n=this._o(r),i=[];if(!e)return this._d("path",i,n);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=n.fill&&n.fill!=="transparent"&&n.fill!==Ks,s=n.stroke!==Ks,o=!!(n.simplification&&n.simplification<1),l=function(h,f,d){let p=Rj(Lj(zA(h))),g=[],m=[],y=[0,0],x=[],b=()=>{x.length>=4&&m.push(...AA(x,f)),x=[]},w=()=>{b(),m.length&&(g.push(m),m=[])};for(let{key:k,data:E}of p)switch(k){case"M":w(),y=[E[0],E[1]],m.push(y);break;case"L":b(),m.push([E[0],E[1]]);break;case"C":if(!x.length){let L=m.length?m[m.length-1]:y;x.push([L[0],L[1]])}x.push([E[0],E[1]]),x.push([E[2],E[3]]),x.push([E[4],E[5]]);break;case"Z":b(),m.push([y[0],y[1]])}if(w(),!d)return g;let _=[];for(let k of g){let E=w6e(k,d);E.length&&_.push(E)}return _}(e,1,o?4-4*(n.simplification||1):(1+n.roughness)/2),u=Ej(e,n);if(a)if(n.fillStyle==="solid")if(l.length===1){let h=Ej(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else i.push(CA(l,n));else i.push(Zp(l,n));return s&&(o?l.forEach(h=>{i.push(t5(h,!1,n))}):i.push(u)),this._d("path",i,n)}opsToPath(e,r){let n="";for(let i of e.ops){let a=typeof r=="number"&&r>=0?i.data.map(s=>+s.toFixed(r)):i.data;switch(i.op){case"move":n+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":n+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":n+=`L${a[0]} ${a[1]} `}}return n.trim()}toPaths(e){let r=e.sets||[],n=e.options||this.defaultOptions,i=[];for(let a of r){let s=null;switch(a.type){case"path":s={d:this.opsToPath(a),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:Ks};break;case"fillPath":s={d:this.opsToPath(a),stroke:Ks,strokeWidth:0,fill:n.fill||Ks};break;case"fillSketch":s=this.fillSketch(a,n)}s&&i.push(s)}return i}fillSketch(e,r){let n=r.fillWeight;return n<0&&(n=r.strokeWidth/2),{d:this.opsToPath(e),stroke:r.fill||Ks,strokeWidth:n,fill:Ks}}_mergedShape(e){return e.filter((r,n)=>n===0||r.op!=="move")}},BA=class{constructor(e,r){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new Qp(r)}draw(e){let r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.ctx,a=e.options.fixedDecimalPlaceDigits;for(let s of r)switch(s.type){case"path":i.save(),i.strokeStyle=n.stroke==="none"?"transparent":n.stroke,i.lineWidth=n.strokeWidth,n.strokeLineDash&&i.setLineDash(n.strokeLineDash),n.strokeLineDashOffset&&(i.lineDashOffset=n.strokeLineDashOffset),this._drawToContext(i,s,a),i.restore();break;case"fillPath":{i.save(),i.fillStyle=n.fill||"";let o=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,s,a,o),i.restore();break}case"fillSketch":this.fillSketch(i,s,n)}}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2),e.save(),n.fillLineDash&&e.setLineDash(n.fillLineDash),n.fillLineDashOffset&&(e.lineDashOffset=n.fillLineDashOffset),e.strokeStyle=n.fill||"",e.lineWidth=i,this._drawToContext(e,r,n.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,r,n,i="nonzero"){e.beginPath();for(let a of r.ops){let s=typeof n=="number"&&n>=0?a.data.map(o=>+o.toFixed(n)):a.data;switch(a.op){case"move":e.moveTo(s[0],s[1]);break;case"bcurveTo":e.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":e.lineTo(s[0],s[1])}}r.type==="fillPath"?e.fill(i):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,r,n,i,a){let s=this.gen.line(e,r,n,i,a);return this.draw(s),s}rectangle(e,r,n,i,a){let s=this.gen.rectangle(e,r,n,i,a);return this.draw(s),s}ellipse(e,r,n,i,a){let s=this.gen.ellipse(e,r,n,i,a);return this.draw(s),s}circle(e,r,n,i){let a=this.gen.circle(e,r,n,i);return this.draw(a),a}linearPath(e,r){let n=this.gen.linearPath(e,r);return this.draw(n),n}polygon(e,r){let n=this.gen.polygon(e,r);return this.draw(n),n}arc(e,r,n,i,a,s,o=!1,l){let u=this.gen.arc(e,r,n,i,a,s,o,l);return this.draw(u),u}curve(e,r){let n=this.gen.curve(e,r);return this.draw(n),n}path(e,r){let n=this.gen.path(e,r);return this.draw(n),n}},e5="http://www.w3.org/2000/svg",FA=class{constructor(e,r){this.svg=e,this.gen=new Qp(r)}draw(e){let r=e.sets||[],n=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,a=i.createElementNS(e5,"g"),s=e.options.fixedDecimalPlaceDigits;for(let o of r){let l=null;switch(o.type){case"path":l=i.createElementNS(e5,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke",n.stroke),l.setAttribute("stroke-width",n.strokeWidth+""),l.setAttribute("fill","none"),n.strokeLineDash&&l.setAttribute("stroke-dasharray",n.strokeLineDash.join(" ").trim()),n.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${n.strokeLineDashOffset}`);break;case"fillPath":l=i.createElementNS(e5,"path"),l.setAttribute("d",this.opsToPath(o,s)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",n.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(i,o,n)}l&&a.appendChild(l)}return a}fillSketch(e,r,n){let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);let a=e.createElementNS(e5,"path");return a.setAttribute("d",this.opsToPath(r,n.fixedDecimalPlaceDigits)),a.setAttribute("stroke",n.fill||""),a.setAttribute("stroke-width",i+""),a.setAttribute("fill","none"),n.fillLineDash&&a.setAttribute("stroke-dasharray",n.fillLineDash.join(" ").trim()),n.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${n.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,r){return this.gen.opsToPath(e,r)}line(e,r,n,i,a){let s=this.gen.line(e,r,n,i,a);return this.draw(s)}rectangle(e,r,n,i,a){let s=this.gen.rectangle(e,r,n,i,a);return this.draw(s)}ellipse(e,r,n,i,a){let s=this.gen.ellipse(e,r,n,i,a);return this.draw(s)}circle(e,r,n,i){let a=this.gen.circle(e,r,n,i);return this.draw(a)}linearPath(e,r){let n=this.gen.linearPath(e,r);return this.draw(n)}polygon(e,r){let n=this.gen.polygon(e,r);return this.draw(n)}arc(e,r,n,i,a,s,o=!1,l){let u=this.gen.arc(e,r,n,i,a,s,o,l);return this.draw(u)}curve(e,r){let n=this.gen.curve(e,r);return this.draw(n)}path(e,r){let n=this.gen.path(e,r);return this.draw(n)}},Ye={canvas:(t,e)=>new BA(t,e),svg:(t,e)=>new FA(t,e),generator:t=>new Qp(t),newSeed:()=>Qp.newSeed()}});function Er(t){let e=t.map((r,n)=>`${n===0?"M":"L"}${r.x},${r.y}`);return e.push("Z"),e.join(" ")}function Oh(t,e,r,n,i,a){let s=[],l=r-t,u=n-e,h=l/a,f=2*Math.PI/h,d=e+u/2;for(let p=0;p<=50;p++){let g=p/50,m=t+g*l,y=d+i*Math.sin(f*(m-t));s.push({x:m,y})}return s}function VA(t,e,r,n,i,a){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;f"+n+""),Oj(r,t.labelStyle),r.style("display","inline-block"),r.style("padding-right","1px"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}function $j(t,e){return t.intersect(e)}function Gj(t,e,r,n){var i=t.x,a=t.y,s=i-n.x,o=a-n.y,l=Math.sqrt(e*e*o*o+r*r*s*s),u=Math.abs(e*r*s/l);n.x0}function Hj(t,e,r){let n=t.x,i=t.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof e.forEach=="function"?e.forEach(function(h){s=Math.min(s,h.x),o=Math.min(o,h.y)}):(s=Math.min(s,e.x),o=Math.min(o,e.y));let l=n-t.width/2-s,u=i-t.height/2-o;for(let h=0;h1&&a.sort(function(h,f){let d=h.x-r.x,p=h.y-r.y,g=Math.sqrt(d*d+p*p),m=f.x-r.x,y=f.y-r.y,x=Math.sqrt(m*m+y*y);return gh,":first-child");return f.attr("class","anchor").attr("style",Aa(o)),Pt(e,f),e.intersect=function(d){return re.info("Circle intersect",e,s,d),Nt.circle(e,s,d)},a}function UA(t,e,r,n,i,a,s){let l=(t+r)/2,u=(e+n)/2,h=Math.atan2(n-e,r-t),f=(r-t)/2,d=(n-e)/2,p=f/i,g=d/a,m=Math.sqrt(p**2+g**2);if(m>1)throw new Error("The given radii are too small to create an arc between the points.");let y=Math.sqrt(1-m**2),x=l+y*a*Math.sin(h)*(s?-1:1),b=u-y*i*Math.cos(h)*(s?-1:1),w=Math.atan2((e-b)/a,(t-x)/i),k=Math.atan2((n-b)/a,(r-x)/i)-w;s&&k<0&&(k+=2*Math.PI),!s&&k>0&&(k-=2*Math.PI);let E=[];for(let L=0;L<20;L++){let S=L/19,C=w+S*k,M=x+i*Math.cos(C),R=b+a*Math.sin(C);E.push({x:M,y:R})}return E}async function Yj(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=a.width+e.padding+20,o=a.height+e.padding,l=o/2,u=l/(2.5+o/50),{cssStyles:h}=e,f=[{x:s/2,y:-o/2},{x:-s/2,y:-o/2},...UA(-s/2,-o/2,-s/2,o/2,u,l,!1),{x:s/2,y:o/2},...UA(s/2,o/2,s/2,-o/2,u,l,!0)],d=Ye.svg(i),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=Er(f),m=d.path(g,p),y=i.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",h),n&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(${u/2}, 0)`),Pt(e,y),e.intersect=function(x){return Nt.polygon(e,f,x)},i}function Au(t,e,r,n){return t.insert("polygon",":first-child").attr("points",n.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}async function Xj(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=a.height+e.padding,o=12,l=a.width+e.padding+o,u=0,h=l,f=-s,d=0,p=[{x:u+o,y:f},{x:h,y:f},{x:h,y:d},{x:u,y:d},{x:u,y:f+o},{x:u+o,y:f}],g,{cssStyles:m}=e;if(e.look==="handDrawn"){let y=Ye.svg(i),x=Bt(e,{}),b=Er(p),w=y.path(b,x);g=i.insert(()=>w,":first-child").attr("transform",`translate(${-l/2}, ${s/2})`),m&&g.attr("style",m)}else g=Au(i,l,s,p);return n&&g.attr("style",n),Pt(e,g),e.intersect=function(y){return Nt.polygon(e,p,y)},i}function jj(t,e){let{nodeStyles:r}=Vt(e);e.label="";let n=t.insert("g").attr("class",rr(e)).attr("id",e.domId??e.id),{cssStyles:i}=e,a=Math.max(28,e.width??0),s=[{x:0,y:a/2},{x:a/2,y:0},{x:0,y:-a/2},{x:-a/2,y:0}],o=Ye.svg(n),l=Bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=Er(s),h=o.path(u,l),f=n.insert(()=>h,":first-child");return i&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",i),r&&e.look!=="handDrawn"&&f.selectAll("path").attr("style",r),e.width=28,e.height=28,e.intersect=function(d){return Nt.polygon(e,s,d)},n}async function Kj(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s}=await tr(t,e,rr(e)),o=a.width/2+s,l,{cssStyles:u}=e;if(e.look==="handDrawn"){let h=Ye.svg(i),f=Bt(e,{}),d=h.circle(0,0,o*2,f);l=i.insert(()=>d,":first-child"),l.attr("class","basic label-container").attr("style",Aa(u))}else l=i.insert("circle",":first-child").attr("class","basic label-container").attr("style",n).attr("r",o).attr("cx",0).attr("cy",0);return Pt(e,l),e.intersect=function(h){return re.info("Circle intersect",e,o,h),Nt.circle(e,o,h)},i}function Zj(t){let e=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),n=t*2,i={x:n/2*e,y:n/2*r},a={x:-(n/2)*e,y:n/2*r},s={x:-(n/2)*e,y:-(n/2)*r},o={x:n/2*e,y:-(n/2)*r};return`M ${a.x},${a.y} L ${o.x},${o.y} M ${i.x},${i.y} L ${s.x},${s.y}`}function Qj(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r,e.label="";let i=t.insert("g").attr("class",rr(e)).attr("id",e.domId??e.id),a=Math.max(30,e?.width??0),{cssStyles:s}=e,o=Ye.svg(i),l=Bt(e,{});e.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let u=o.circle(0,0,a*2,l),h=Zj(a),f=o.path(h,l),d=i.insert(()=>u,":first-child");return d.insert(()=>f),s&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",s),n&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",n),Pt(e,d),e.intersect=function(p){return re.info("crossedCircle intersect",e,{radius:a,point:p}),Nt.circle(e,a,p)},i}function Eu(t,e,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fw,":first-child").attr("stroke-opacity",0),_.insert(()=>x,":first-child"),_.attr("class","text"),h&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",h),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${u}, 0)`),s.attr("transform",`translate(${-o/2+u-(a.x-(a.left??0))},${-l/2+(e.padding??0)/2-(a.y-(a.top??0))})`),Pt(e,_),e.intersect=function(k){return Nt.polygon(e,d,k)},i}function Su(t,e,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fw,":first-child").attr("stroke-opacity",0),_.insert(()=>x,":first-child"),_.attr("class","text"),h&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",h),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(${-u}, 0)`),s.attr("transform",`translate(${-o/2+(e.padding??0)/2-(a.x-(a.left??0))},${-l/2+(e.padding??0)/2-(a.y-(a.top??0))})`),Pt(e,_),e.intersect=function(k){return Nt.polygon(e,d,k)},i}function la(t,e,r,n=100,i=0,a=180){let s=[],o=i*Math.PI/180,h=(a*Math.PI/180-o)/(n-1);for(let f=0;fL,":first-child").attr("stroke-opacity",0),S.insert(()=>b,":first-child"),S.insert(()=>k,":first-child"),S.attr("class","text"),h&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",h),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.attr("transform",`translate(${u-u/4}, 0)`),s.attr("transform",`translate(${-o/2+(e.padding??0)/2-(a.x-(a.left??0))},${-l/2+(e.padding??0)/2-(a.y-(a.top??0))})`),Pt(e,S),e.intersect=function(C){return Nt.polygon(e,p,C)},i}async function rK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=80,o=20,l=Math.max(s,(a.width+(e.padding??0)*2)*1.25,e?.width??0),u=Math.max(o,a.height+(e.padding??0)*2,e?.height??0),h=u/2,{cssStyles:f}=e,d=Ye.svg(i),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=l,m=u,y=g-h,x=m/4,b=[{x:y,y:0},{x,y:0},{x:0,y:m/2},{x,y:m},{x:y,y:m},...VA(-y,-m/2,h,50,270,90)],w=Er(b),_=d.path(w,p),k=i.insert(()=>_,":first-child");return k.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&k.selectChildren("path").attr("style",n),k.attr("transform",`translate(${-l/2}, ${-u/2})`),Pt(e,k),e.intersect=function(E){return Nt.polygon(e,b,E)},i}async function nK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+e.padding,e.width??0),l=o/2,u=l/(2.5+o/50),h=Math.max(a.height+u+e.padding,e.height??0),f,{cssStyles:d}=e;if(e.look==="handDrawn"){let p=Ye.svg(i),g=B6e(0,0,o,h,l,u),m=F6e(0,u,o,h,l,u),y=p.path(g,Bt(e,{})),x=p.path(m,Bt(e,{fill:"none"}));f=i.insert(()=>x,":first-child"),f=i.insert(()=>y,":first-child"),f.attr("class","basic label-container"),d&&f.attr("style",d)}else{let p=P6e(0,0,o,h,l,u);f=i.insert("path",":first-child").attr("d",p).attr("class","basic label-container").attr("style",Aa(d)).attr("style",n)}return f.attr("label-offset-y",u),f.attr("transform",`translate(${-o/2}, ${-(h/2+u)})`),Pt(e,f),s.attr("transform",`translate(${-(a.width/2)-(a.x-(a.left??0))}, ${-(a.height/2)+(e.padding??0)/1.5-(a.y-(a.top??0))})`),e.intersect=function(p){let g=Nt.rect(e,p),m=g.x-(e.x??0);if(l!=0&&(Math.abs(m)<(e.width??0)/2||Math.abs(m)==(e.width??0)/2&&Math.abs(g.y-(e.y??0))>(e.height??0)/2-u)){let y=u*u*(1-m*m/(l*l));y>0&&(y=Math.sqrt(y)),y=u-y,p.y-(e.y??0)>0&&(y=-y),g.y+=y}return g},i}async function iK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=a.width+e.padding,l=a.height+e.padding,u=l*.2,h=-o/2,f=-l/2-u/2,{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let m=[{x:h,y:f+u},{x:-h,y:f+u},{x:-h,y:-f},{x:h,y:-f},{x:h,y:f},{x:-h,y:f},{x:-h,y:f+u}],y=p.polygon(m.map(b=>[b.x,b.y]),g),x=i.insert(()=>y,":first-child");return x.attr("class","basic label-container"),d&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",d),n&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",n),s.attr("transform",`translate(${h+(e.padding??0)/2-(a.x-(a.left??0))}, ${f+u+(e.padding??0)/2-(a.y-(a.top??0))})`),Pt(e,x),e.intersect=function(b){return Nt.rect(e,b)},i}async function aK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,halfPadding:s}=await tr(t,e,rr(e)),l=a.width/2+s+5,u=a.width/2+s,h,{cssStyles:f}=e;if(e.look==="handDrawn"){let d=Ye.svg(i),p=Bt(e,{roughness:.2,strokeWidth:2.5}),g=Bt(e,{roughness:.2,strokeWidth:1.5}),m=d.circle(0,0,l*2,p),y=d.circle(0,0,u*2,g);h=i.insert("g",":first-child"),h.attr("class",Aa(e.cssClasses)).attr("style",Aa(f)),h.node()?.appendChild(m),h.node()?.appendChild(y)}else{h=i.insert("g",":first-child");let d=h.insert("circle",":first-child"),p=h.insert("circle");h.attr("class","basic label-container").attr("style",n),d.attr("class","outer-circle").attr("style",n).attr("r",l).attr("cx",0).attr("cy",0),p.attr("class","inner-circle").attr("style",n).attr("r",u).attr("cx",0).attr("cy",0)}return Pt(e,h),e.intersect=function(d){return re.info("DoubleCircle intersect",e,l,d),Nt.circle(e,l,d)},i}function sK(t,e,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=Vt(e);e.label="",e.labelStyle=n;let a=t.insert("g").attr("class",rr(e)).attr("id",e.domId??e.id),s=7,{cssStyles:o}=e,l=Ye.svg(a),{nodeBorder:u}=r,h=Bt(e,{fillStyle:"solid"});e.look!=="handDrawn"&&(h.roughness=0);let f=l.circle(0,0,s*2,h),d=a.insert(()=>f,":first-child");return d.selectAll("path").attr("style",`fill: ${u} !important;`),o&&o.length>0&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",o),i&&e.look!=="handDrawn"&&d.selectAll("path").attr("style",i),Pt(e,d),e.intersect=function(p){return re.info("filledCircle intersect",e,{radius:s,point:p}),Nt.circle(e,s,p)},a}async function oK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=a.width+(e.padding??0),l=o+a.height,u=o+a.height,h=[{x:0,y:-l},{x:u,y:-l},{x:u/2,y:0}],{cssStyles:f}=e,d=Ye.svg(i),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=Er(h),m=d.path(g,p),y=i.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`);return f&&e.look!=="handDrawn"&&y.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),e.width=o,e.height=l,Pt(e,y),s.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${-l/2+(e.padding??0)/2+(a.y-(a.top??0))})`),e.intersect=function(x){return re.info("Triangle intersect",e,h,x),Nt.polygon(e,h,x)},i}function lK(t,e,{dir:r,config:{state:n,themeVariables:i}}){let{nodeStyles:a}=Vt(e);e.label="";let s=t.insert("g").attr("class",rr(e)).attr("id",e.domId??e.id),{cssStyles:o}=e,l=Math.max(70,e?.width??0),u=Math.max(10,e?.height??0);r==="LR"&&(l=Math.max(10,e?.width??0),u=Math.max(70,e?.height??0));let h=-1*l/2,f=-1*u/2,d=Ye.svg(s),p=Bt(e,{stroke:i.lineColor,fill:i.lineColor});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=d.rectangle(h,f,l,u,p),m=s.insert(()=>g,":first-child");o&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",o),a&&e.look!=="handDrawn"&&m.selectAll("path").attr("style",a),Pt(e,m);let y=n?.padding??0;return e.width&&e.height&&(e.width+=y/2||0,e.height+=y/2||0),e.intersect=function(x){return Nt.rect(e,x)},s}async function cK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let i=80,a=50,{shapeSvg:s,bbox:o}=await tr(t,e,rr(e)),l=Math.max(i,o.width+(e.padding??0)*2,e?.width??0),u=Math.max(a,o.height+(e.padding??0)*2,e?.height??0),h=u/2,{cssStyles:f}=e,d=Ye.svg(s),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=[{x:-l/2,y:-u/2},{x:l/2-h,y:-u/2},...VA(-l/2+h,0,h,50,90,270),{x:l/2-h,y:u/2},{x:-l/2,y:u/2}],m=Er(g),y=d.path(m,p),x=s.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),Pt(e,x),e.intersect=function(b){return re.info("Pill intersect",e,{radius:h,point:b}),Nt.polygon(e,g,b)},s}async function uK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=4,o=a.height+e.padding,l=o/s,u=a.width+2*l+e.padding,h=[{x:l,y:0},{x:u-l,y:0},{x:u,y:-o/2},{x:u-l,y:-o},{x:l,y:-o},{x:0,y:-o/2}],f,{cssStyles:d}=e;if(e.look==="handDrawn"){let p=Ye.svg(i),g=Bt(e,{}),m=z6e(0,0,u,o,l),y=p.path(m,g);f=i.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${o/2})`),d&&f.attr("style",d)}else f=Au(i,u,o,h);return n&&f.attr("style",n),e.width=u,e.height=o,Pt(e,f),e.intersect=function(p){return Nt.polygon(e,h,p)},i}async function hK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.label="",e.labelStyle=r;let{shapeSvg:i}=await tr(t,e,rr(e)),a=Math.max(30,e?.width??0),s=Math.max(30,e?.height??0),{cssStyles:o}=e,l=Ye.svg(i),u=Bt(e,{});e.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=[{x:0,y:0},{x:a,y:0},{x:0,y:s},{x:a,y:s}],f=Er(h),d=l.path(f,u),p=i.insert(()=>d,":first-child");return p.attr("class","basic label-container"),o&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",o),n&&e.look!=="handDrawn"&&p.selectChildren("path").attr("style",n),p.attr("transform",`translate(${-a/2}, ${-s/2})`),Pt(e,p),e.intersect=function(g){return re.info("Pill intersect",e,{points:h}),Nt.polygon(e,h,g)},i}async function fK(t,e,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=Vt(e);e.labelStyle=i;let a=e.assetHeight??48,s=e.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;e.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await tr(t,e,"icon-shape default"),d=e.pos==="t",p=o,g=o,{nodeBorder:m}=r,{stylesMap:y}=eg(e),x=-g/2,b=-p/2,w=e.label?8:0,_=Ye.svg(u),k=Bt(e,{stroke:"none",fill:"none"});e.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");let E=_.rectangle(x,b,g,p,k),L=Math.max(g,h.width),S=p+h.height+w,C=_.rectangle(-L/2,-S/2,L,S,{...k,fill:"transparent",stroke:"none"}),M=u.insert(()=>E,":first-child"),R=u.insert(()=>C);if(e.icon){let T=u.append("g");T.html(`${await su(e.icon,{height:o,width:o,fallbackPrefix:""})}`);let I=T.node().getBBox(),A=I.width,D=I.height,N=I.x,O=I.y;T.attr("transform",`translate(${-A/2-N},${d?h.height/2+w/2-D/2-O:-h.height/2-w/2-D/2-O})`),T.attr("style",`color: ${y.get("stroke")??m};`)}return f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${d?-S/2:S/2-h.height})`),M.attr("transform",`translate(0,${d?h.height/2+w/2:-h.height/2-w/2})`),Pt(e,R),e.intersect=function(T){if(re.info("iconSquare intersect",e,T),!e.label)return Nt.rect(e,T);let I=e.x??0,A=e.y??0,D=e.height??0,N=[];return d?N=[{x:I-h.width/2,y:A-D/2},{x:I+h.width/2,y:A-D/2},{x:I+h.width/2,y:A-D/2+h.height+w},{x:I+g/2,y:A-D/2+h.height+w},{x:I+g/2,y:A+D/2},{x:I-g/2,y:A+D/2},{x:I-g/2,y:A-D/2+h.height+w},{x:I-h.width/2,y:A-D/2+h.height+w}]:N=[{x:I-g/2,y:A-D/2},{x:I+g/2,y:A-D/2},{x:I+g/2,y:A-D/2+p},{x:I+h.width/2,y:A-D/2+p},{x:I+h.width/2/2,y:A+D/2},{x:I-h.width/2,y:A+D/2},{x:I-h.width/2,y:A-D/2+p},{x:I-g/2,y:A-D/2+p}],Nt.polygon(e,N,T)},u}async function dK(t,e,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=Vt(e);e.labelStyle=i;let a=e.assetHeight??48,s=e.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;e.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,label:f}=await tr(t,e,"icon-shape default"),d=20,p=e.label?8:0,g=e.pos==="t",{nodeBorder:m,mainBkg:y}=r,{stylesMap:x}=eg(e),b=Ye.svg(u),w=Bt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let _=x.get("fill");w.stroke=_??y;let k=u.append("g");e.icon&&k.html(`${await su(e.icon,{height:o,width:o,fallbackPrefix:""})}`);let E=k.node().getBBox(),L=E.width,S=E.height,C=E.x,M=E.y,R=Math.max(L,S)*Math.SQRT2+d*2,T=b.circle(0,0,R,w),I=Math.max(R,h.width),A=R+h.height+p,D=b.rectangle(-I/2,-A/2,I,A,{...w,fill:"transparent",stroke:"none"}),N=u.insert(()=>T,":first-child"),O=u.insert(()=>D);return k.attr("transform",`translate(${-L/2-C},${g?h.height/2+p/2-S/2-M:-h.height/2-p/2-S/2-M})`),k.attr("style",`color: ${x.get("stroke")??m};`),f.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${g?-A/2:A/2-h.height})`),N.attr("transform",`translate(0,${g?h.height/2+p/2:-h.height/2-p/2})`),Pt(e,O),e.intersect=function(B){return re.info("iconSquare intersect",e,B),Nt.rect(e,B)},u}async function pK(t,e,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=Vt(e);e.labelStyle=i;let a=e.assetHeight??48,s=e.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;e.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await tr(t,e,"icon-shape default"),p=e.pos==="t",g=o+f*2,m=o+f*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=eg(e),w=-m/2,_=-g/2,k=e.label?8:0,E=Ye.svg(u),L=Bt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");let S=b.get("fill");L.stroke=S??x;let C=E.path(Cu(w,_,m,g,5),L),M=Math.max(m,h.width),R=g+h.height+k,T=E.rectangle(-M/2,-R/2,M,R,{...L,fill:"transparent",stroke:"none"}),I=u.insert(()=>C,":first-child").attr("class","icon-shape2"),A=u.insert(()=>T);if(e.icon){let D=u.append("g");D.html(`${await su(e.icon,{height:o,width:o,fallbackPrefix:""})}`);let N=D.node().getBBox(),O=N.width,B=N.height,P=N.x,$=N.y;D.attr("transform",`translate(${-O/2-P},${p?h.height/2+k/2-B/2-$:-h.height/2-k/2-B/2-$})`),D.attr("style",`color: ${b.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-R/2:R/2-h.height})`),I.attr("transform",`translate(0,${p?h.height/2+k/2:-h.height/2-k/2})`),Pt(e,A),e.intersect=function(D){if(re.info("iconSquare intersect",e,D),!e.label)return Nt.rect(e,D);let N=e.x??0,O=e.y??0,B=e.height??0,P=[];return p?P=[{x:N-h.width/2,y:O-B/2},{x:N+h.width/2,y:O-B/2},{x:N+h.width/2,y:O-B/2+h.height+k},{x:N+m/2,y:O-B/2+h.height+k},{x:N+m/2,y:O+B/2},{x:N-m/2,y:O+B/2},{x:N-m/2,y:O-B/2+h.height+k},{x:N-h.width/2,y:O-B/2+h.height+k}]:P=[{x:N-m/2,y:O-B/2},{x:N+m/2,y:O-B/2},{x:N+m/2,y:O-B/2+g},{x:N+h.width/2,y:O-B/2+g},{x:N+h.width/2/2,y:O+B/2},{x:N-h.width/2,y:O+B/2},{x:N-h.width/2,y:O-B/2+g},{x:N-m/2,y:O-B/2+g}],Nt.polygon(e,P,D)},u}async function gK(t,e,{config:{themeVariables:r,flowchart:n}}){let{labelStyles:i}=Vt(e);e.labelStyle=i;let a=e.assetHeight??48,s=e.assetWidth??48,o=Math.max(a,s),l=n?.wrappingWidth;e.width=Math.max(o,l??0);let{shapeSvg:u,bbox:h,halfPadding:f,label:d}=await tr(t,e,"icon-shape default"),p=e.pos==="t",g=o+f*2,m=o+f*2,{nodeBorder:y,mainBkg:x}=r,{stylesMap:b}=eg(e),w=-m/2,_=-g/2,k=e.label?8:0,E=Ye.svg(u),L=Bt(e,{});e.look!=="handDrawn"&&(L.roughness=0,L.fillStyle="solid");let S=b.get("fill");L.stroke=S??x;let C=E.path(Cu(w,_,m,g,.1),L),M=Math.max(m,h.width),R=g+h.height+k,T=E.rectangle(-M/2,-R/2,M,R,{...L,fill:"transparent",stroke:"none"}),I=u.insert(()=>C,":first-child"),A=u.insert(()=>T);if(e.icon){let D=u.append("g");D.html(`${await su(e.icon,{height:o,width:o,fallbackPrefix:""})}`);let N=D.node().getBBox(),O=N.width,B=N.height,P=N.x,$=N.y;D.attr("transform",`translate(${-O/2-P},${p?h.height/2+k/2-B/2-$:-h.height/2-k/2-B/2-$})`),D.attr("style",`color: ${b.get("stroke")??y};`)}return d.attr("transform",`translate(${-h.width/2-(h.x-(h.left??0))},${p?-R/2:R/2-h.height})`),I.attr("transform",`translate(0,${p?h.height/2+k/2:-h.height/2-k/2})`),Pt(e,A),e.intersect=function(D){if(re.info("iconSquare intersect",e,D),!e.label)return Nt.rect(e,D);let N=e.x??0,O=e.y??0,B=e.height??0,P=[];return p?P=[{x:N-h.width/2,y:O-B/2},{x:N+h.width/2,y:O-B/2},{x:N+h.width/2,y:O-B/2+h.height+k},{x:N+m/2,y:O-B/2+h.height+k},{x:N+m/2,y:O+B/2},{x:N-m/2,y:O+B/2},{x:N-m/2,y:O-B/2+h.height+k},{x:N-h.width/2,y:O-B/2+h.height+k}]:P=[{x:N-m/2,y:O-B/2},{x:N+m/2,y:O-B/2},{x:N+m/2,y:O-B/2+g},{x:N+h.width/2,y:O-B/2+g},{x:N+h.width/2/2,y:O+B/2},{x:N-h.width/2,y:O+B/2},{x:N-h.width/2,y:O-B/2+g},{x:N-m/2,y:O-B/2+g}],Nt.polygon(e,P,D)},u}async function mK(t,e,{config:{flowchart:r}}){let n=new Image;n.src=e?.img??"",await n.decode();let i=Number(n.naturalWidth.toString().replace("px","")),a=Number(n.naturalHeight.toString().replace("px",""));e.imageAspectRatio=i/a;let{labelStyles:s}=Vt(e);e.labelStyle=s;let o=r?.wrappingWidth;e.defaultWidth=r?.wrappingWidth;let l=Math.max(e.label?o??0:0,e?.assetWidth??i),u=e.constraint==="on"&&e?.assetHeight?e.assetHeight*e.imageAspectRatio:l,h=e.constraint==="on"?u/e.imageAspectRatio:e?.assetHeight??a;e.width=Math.max(u,o??0);let{shapeSvg:f,bbox:d,label:p}=await tr(t,e,"image-shape default"),g=e.pos==="t",m=-u/2,y=-h/2,x=e.label?8:0,b=Ye.svg(f),w=Bt(e,{});e.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let _=b.rectangle(m,y,u,h,w),k=Math.max(u,d.width),E=h+d.height+x,L=b.rectangle(-k/2,-E/2,k,E,{...w,fill:"none",stroke:"none"}),S=f.insert(()=>_,":first-child"),C=f.insert(()=>L);if(e.img){let M=f.append("image");M.attr("href",e.img),M.attr("width",u),M.attr("height",h),M.attr("preserveAspectRatio","none"),M.attr("transform",`translate(${-u/2},${g?E/2-h:-E/2})`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${g?-h/2-d.height/2-x/2:h/2-d.height/2+x/2})`),S.attr("transform",`translate(0,${g?d.height/2+x/2:-d.height/2-x/2})`),Pt(e,C),e.intersect=function(M){if(re.info("iconSquare intersect",e,M),!e.label)return Nt.rect(e,M);let R=e.x??0,T=e.y??0,I=e.height??0,A=[];return g?A=[{x:R-d.width/2,y:T-I/2},{x:R+d.width/2,y:T-I/2},{x:R+d.width/2,y:T-I/2+d.height+x},{x:R+u/2,y:T-I/2+d.height+x},{x:R+u/2,y:T+I/2},{x:R-u/2,y:T+I/2},{x:R-u/2,y:T-I/2+d.height+x},{x:R-d.width/2,y:T-I/2+d.height+x}]:A=[{x:R-u/2,y:T-I/2},{x:R+u/2,y:T-I/2},{x:R+u/2,y:T-I/2+h},{x:R+d.width/2,y:T-I/2+h},{x:R+d.width/2/2,y:T+I/2},{x:R-d.width/2,y:T+I/2},{x:R-d.width/2,y:T-I/2+h},{x:R-u/2,y:T-I/2+h}],Nt.polygon(e,A,M)},f}async function vK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=Math.max(a.width+(e.padding??0)*2,e?.width??0),o=Math.max(a.height+(e.padding??0)*2,e?.height??0),l=[{x:0,y:0},{x:s,y:0},{x:s+3*o/6,y:-o},{x:-3*o/6,y:-o}],u,{cssStyles:h}=e;if(e.look==="handDrawn"){let f=Ye.svg(i),d=Bt(e,{}),p=Er(l),g=f.path(p,d);u=i.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&u.attr("style",h)}else u=Au(i,s,o,l);return n&&u.attr("style",n),e.width=s,e.height=o,Pt(e,u),e.intersect=function(f){return Nt.polygon(e,l,f)},i}async function o5(t,e,r){let{labelStyles:n,nodeStyles:i}=Vt(e);e.labelStyle=n;let{shapeSvg:a,bbox:s}=await tr(t,e,rr(e)),o=Math.max(s.width+r.labelPaddingX*2,e?.width||0),l=Math.max(s.height+r.labelPaddingY*2,e?.height||0),u=-o/2,h=-l/2,f,{rx:d,ry:p}=e,{cssStyles:g}=e;if(r?.rx&&r.ry&&(d=r.rx,p=r.ry),e.look==="handDrawn"){let m=Ye.svg(a),y=Bt(e,{}),x=d||p?m.path(Cu(u,h,o,l,d||0),y):m.rectangle(u,h,o,l,y);f=a.insert(()=>x,":first-child"),f.attr("class","basic label-container").attr("style",Aa(g))}else f=a.insert("rect",":first-child"),f.attr("class","basic label-container").attr("style",i).attr("rx",Aa(d)).attr("ry",Aa(p)).attr("x",u).attr("y",h).attr("width",o).attr("height",l);return Pt(e,f),e.intersect=function(m){return Nt.rect(e,m)},a}async function yK(t,e){let{shapeSvg:r,bbox:n,label:i}=await tr(t,e,"label"),a=r.insert("rect",":first-child");return a.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),i.attr("transform",`translate(${-(n.width/2)-(n.x-(n.left??0))}, ${-(n.height/2)-(n.y-(n.top??0))})`),Pt(e,a),e.intersect=function(l){return Nt.rect(e,l)},r}async function xK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=Math.max(a.width+(e.padding??0),e?.width??0),o=Math.max(a.height+(e.padding??0),e?.height??0),l=[{x:0,y:0},{x:s+3*o/6,y:0},{x:s,y:-o},{x:-(3*o)/6,y:-o}],u,{cssStyles:h}=e;if(e.look==="handDrawn"){let f=Ye.svg(i),d=Bt(e,{}),p=Er(l),g=f.path(p,d);u=i.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&u.attr("style",h)}else u=Au(i,s,o,l);return n&&u.attr("style",n),e.width=s,e.height=o,Pt(e,u),e.intersect=function(f){return Nt.polygon(e,l,f)},i}async function bK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=Math.max(a.width+(e.padding??0),e?.width??0),o=Math.max(a.height+(e.padding??0),e?.height??0),l=[{x:-3*o/6,y:0},{x:s,y:0},{x:s+3*o/6,y:-o},{x:0,y:-o}],u,{cssStyles:h}=e;if(e.look==="handDrawn"){let f=Ye.svg(i),d=Bt(e,{}),p=Er(l),g=f.path(p,d);u=i.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&u.attr("style",h)}else u=Au(i,s,o,l);return n&&u.attr("style",n),e.width=s,e.height=o,Pt(e,u),e.intersect=function(f){return Nt.polygon(e,l,f)},i}function wK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.label="",e.labelStyle=r;let i=t.insert("g").attr("class",rr(e)).attr("id",e.domId??e.id),{cssStyles:a}=e,s=Math.max(35,e?.width??0),o=Math.max(35,e?.height??0),l=7,u=[{x:s,y:0},{x:0,y:o+l/2},{x:s-2*l,y:o+l/2},{x:0,y:2*o},{x:s,y:o-l/2},{x:2*l,y:o-l/2}],h=Ye.svg(i),f=Bt(e,{});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let d=Er(u),p=h.path(d,f),g=i.insert(()=>p,":first-child");return a&&e.look!=="handDrawn"&&g.selectAll("path").attr("style",a),n&&e.look!=="handDrawn"&&g.selectAll("path").attr("style",n),g.attr("transform",`translate(-${s/2},${-o})`),Pt(e,g),e.intersect=function(m){return re.info("lightningBolt intersect",e,m),Nt.polygon(e,u,m)},i}async function kK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0),e.width??0),l=o/2,u=l/(2.5+o/50),h=Math.max(a.height+u+(e.padding??0),e.height??0),f=h*.1,d,{cssStyles:p}=e;if(e.look==="handDrawn"){let g=Ye.svg(i),m=G6e(0,0,o,h,l,u,f),y=U6e(0,u,o,h,l,u),x=Bt(e,{}),b=g.path(m,x),w=g.path(y,x);i.insert(()=>w,":first-child").attr("class","line"),d=i.insert(()=>b,":first-child"),d.attr("class","basic label-container"),p&&d.attr("style",p)}else{let g=$6e(0,0,o,h,l,u,f);d=i.insert("path",":first-child").attr("d",g).attr("class","basic label-container").attr("style",Aa(p)).attr("style",n)}return d.attr("label-offset-y",u),d.attr("transform",`translate(${-o/2}, ${-(h/2+u)})`),Pt(e,d),s.attr("transform",`translate(${-(a.width/2)-(a.x-(a.left??0))}, ${-(a.height/2)+u-(a.y-(a.top??0))})`),e.intersect=function(g){let m=Nt.rect(e,g),y=m.x-(e.x??0);if(l!=0&&(Math.abs(y)<(e.width??0)/2||Math.abs(y)==(e.width??0)/2&&Math.abs(m.y-(e.y??0))>(e.height??0)/2-u)){let x=u*u*(1-y*y/(l*l));x>0&&(x=Math.sqrt(x)),x=u-x,g.y-(e.y??0)>0&&(x=-x),m.y+=x}return m},i}async function TK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=l/4,h=l+u,{cssStyles:f}=e,d=Ye.svg(i),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=[{x:-o/2-o/2*.1,y:-h/2},{x:-o/2-o/2*.1,y:h/2},...Oh(-o/2-o/2*.1,h/2,o/2+o/2*.1,h/2,u,.8),{x:o/2+o/2*.1,y:-h/2},{x:-o/2-o/2*.1,y:-h/2},{x:-o/2,y:-h/2},{x:-o/2,y:h/2*1.1},{x:-o/2,y:-h/2}],m=d.polygon(g.map(x=>[x.x,x.y]),p),y=i.insert(()=>m,":first-child");return y.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",n),y.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-o/2+(e.padding??0)+o/2*.1/2-(a.x-(a.left??0))},${-l/2+(e.padding??0)-u/2-(a.y-(a.top??0))})`),Pt(e,y),e.intersect=function(x){return Nt.polygon(e,g,x)},i}async function EK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=5,h=-o/2,f=-l/2,{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{}),m=[{x:h-u,y:f+u},{x:h-u,y:f+l+u},{x:h+o-u,y:f+l+u},{x:h+o-u,y:f+l},{x:h+o,y:f+l},{x:h+o,y:f+l-u},{x:h+o+u,y:f+l-u},{x:h+o+u,y:f-u},{x:h+u,y:f-u},{x:h+u,y:f},{x:h,y:f},{x:h,y:f+u}],y=[{x:h,y:f+u},{x:h+o-u,y:f+u},{x:h+o-u,y:f+l},{x:h+o,y:f+l},{x:h+o,y:f},{x:h,y:f}];e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let x=Er(m),b=p.path(x,g),w=Er(y),_=p.path(w,{...g,fill:"none"}),k=i.insert(()=>_,":first-child");return k.insert(()=>b,":first-child"),k.attr("class","basic label-container"),d&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),s.attr("transform",`translate(${-(a.width/2)-u-(a.x-(a.left??0))}, ${-(a.height/2)+u-(a.y-(a.top??0))})`),Pt(e,k),e.intersect=function(E){return Nt.polygon(e,m,E)},i}async function SK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=l/4,h=l+u,f=-o/2,d=-h/2,p=5,{cssStyles:g}=e,m=Oh(f-p,d+h+p,f+o-p,d+h+p,u,.8),y=m?.[m.length-1],x=[{x:f-p,y:d+p},{x:f-p,y:d+h+p},...m,{x:f+o-p,y:y.y-p},{x:f+o,y:y.y-p},{x:f+o,y:y.y-2*p},{x:f+o+p,y:y.y-2*p},{x:f+o+p,y:d-p},{x:f+p,y:d-p},{x:f+p,y:d},{x:f,y:d},{x:f,y:d+p}],b=[{x:f,y:d+p},{x:f+o-p,y:d+p},{x:f+o-p,y:y.y-p},{x:f+o,y:y.y-p},{x:f+o,y:d},{x:f,y:d}],w=Ye.svg(i),_=Bt(e,{});e.look!=="handDrawn"&&(_.roughness=0,_.fillStyle="solid");let k=Er(x),E=w.path(k,_),L=Er(b),S=w.path(L,_),C=i.insert(()=>E,":first-child");return C.insert(()=>S),C.attr("class","basic label-container"),g&&e.look!=="handDrawn"&&C.selectAll("path").attr("style",g),n&&e.look!=="handDrawn"&&C.selectAll("path").attr("style",n),C.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-(a.width/2)-p-(a.x-(a.left??0))}, ${-(a.height/2)+p-u/2-(a.y-(a.top??0))})`),Pt(e,C),e.intersect=function(M){return Nt.polygon(e,x,M)},i}async function CK(t,e,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=Vt(e);e.labelStyle=n,e.useHtmlLabels||Or().flowchart?.htmlLabels!==!1||(e.centerLabel=!0);let{shapeSvg:s,bbox:o}=await tr(t,e,rr(e)),l=Math.max(o.width+(e.padding??0)*2,e?.width??0),u=Math.max(o.height+(e.padding??0)*2,e?.height??0),h=-l/2,f=-u/2,{cssStyles:d}=e,p=Ye.svg(s),g=Bt(e,{fill:r.noteBkgColor,stroke:r.noteBorderColor});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let m=p.rectangle(h,f,l,u,g),y=s.insert(()=>m,":first-child");return y.attr("class","basic label-container"),d&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",d),i&&e.look!=="handDrawn"&&y.selectAll("path").attr("style",i),Pt(e,y),e.intersect=function(x){return Nt.rect(e,x)},s}async function AK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=a.width+e.padding,o=a.height+e.padding,l=s+o,u=[{x:l/2,y:0},{x:l,y:-l/2},{x:l/2,y:-l},{x:0,y:-l/2}],h,{cssStyles:f}=e;if(e.look==="handDrawn"){let d=Ye.svg(i),p=Bt(e,{}),g=V6e(0,0,l),m=d.path(g,p);h=i.insert(()=>m,":first-child").attr("transform",`translate(${-l/2}, ${l/2})`),f&&h.attr("style",f)}else h=Au(i,l,l,u);return n&&h.attr("style",n),Pt(e,h),e.intersect=function(d){return re.debug(`APA12 Intersect called SPLIT point:`,d,` node: `,e,` res:`,Nt.polygon(e,u,d)),Nt.polygon(e,u,d)},i}async function _K(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0),e?.width??0),l=Math.max(a.height+(e.padding??0),e?.height??0),u=-o/2,h=-l/2,f=h/2,d=[{x:u+f,y:h},{x:u,y:0},{x:u+f,y:-h},{x:-u,y:-h},{x:-u,y:h}],{cssStyles:p}=e,g=Ye.svg(i),m=Bt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let y=Er(d),x=g.path(y,m),b=i.insert(()=>x,":first-child");return b.attr("class","basic label-container"),p&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),b.attr("transform",`translate(${-f/2},0)`),s.attr("transform",`translate(${-f/2-a.width/2-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Pt(e,b),e.intersect=function(w){return Nt.polygon(e,d,w)},i}async function LK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let i;e.cssClasses?i="node "+e.cssClasses:i="node default";let a=t.insert("g").attr("class",i).attr("id",e.domId||e.id),s=a.insert("g"),o=a.insert("g").attr("class","label").attr("style",n),l=e.description,u=e.label,h=o.node().appendChild(await Ph(u,e.labelStyle,!0,!0)),f={width:0,height:0};if(Wr(pe()?.flowchart?.htmlLabels)){let S=h.children[0],C=Ve(h);f=S.getBoundingClientRect(),C.attr("width",f.width),C.attr("height",f.height)}re.info("Text 2",l);let d=l||[],p=h.getBBox(),g=o.node().appendChild(await Ph(d.join?d.join("
    "):d,e.labelStyle,!0,!0)),m=g.children[0],y=Ve(g);f=m.getBoundingClientRect(),y.attr("width",f.width),y.attr("height",f.height);let x=(e.padding||0)/2;Ve(g).attr("transform","translate( "+(f.width>p.width?0:(p.width-f.width)/2)+", "+(p.height+x+5)+")"),Ve(h).attr("transform","translate( "+(f.width(re.debug("Rough node insert CXC",M),R),":first-child"),E=a.insert(()=>(re.debug("Rough node insert CXC",M),M),":first-child")}else E=s.insert("rect",":first-child"),L=s.insert("line"),E.attr("class","outer title-state").attr("style",n).attr("x",-f.width/2-x).attr("y",-f.height/2-x).attr("width",f.width+(e.padding||0)).attr("height",f.height+(e.padding||0)),L.attr("class","divider").attr("x1",-f.width/2-x).attr("x2",f.width/2+x).attr("y1",-f.height/2-x+p.height+x).attr("y2",-f.height/2-x+p.height+x);return Pt(e,E),e.intersect=function(S){return Nt.rect(e,S)},a}async function RK(t,e){let r={rx:5,ry:5,classes:"",labelPaddingX:(e?.padding||0)*1,labelPaddingY:(e?.padding||0)*1};return o5(t,e,r)}async function NK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=e?.padding??0,l=Math.max(a.width+(e.padding??0)*2,e?.width??0),u=Math.max(a.height+(e.padding??0)*2,e?.height??0),h=-a.width/2-o,f=-a.height/2-o,{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let m=[{x:h,y:f},{x:h+l+8,y:f},{x:h+l+8,y:f+u},{x:h-8,y:f+u},{x:h-8,y:f},{x:h,y:f},{x:h,y:f+u}],y=p.polygon(m.map(b=>[b.x,b.y]),g),x=i.insert(()=>y,":first-child");return x.attr("class","basic label-container").attr("style",Aa(d)),n&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",n),d&&e.look!=="handDrawn"&&x.selectAll("path").attr("style",n),s.attr("transform",`translate(${-l/2+4+(e.padding??0)-(a.x-(a.left??0))},${-u/2+(e.padding??0)-(a.y-(a.top??0))})`),Pt(e,x),e.intersect=function(b){return Nt.rect(e,b)},i}async function IK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=-o/2,h=-l/2,{cssStyles:f}=e,d=Ye.svg(i),p=Bt(e,{});e.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let g=[{x:u,y:h},{x:u,y:h+l},{x:u+o,y:h+l},{x:u+o,y:h-l/2}],m=Er(g),y=d.path(m,p),x=i.insert(()=>y,":first-child");return x.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),n&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),x.attr("transform",`translate(0, ${l/4})`),s.attr("transform",`translate(${-o/2+(e.padding??0)-(a.x-(a.left??0))}, ${-l/4+(e.padding??0)-(a.y-(a.top??0))})`),Pt(e,x),e.intersect=function(b){return Nt.polygon(e,g,b)},i}async function MK(t,e){let r={rx:0,ry:0,classes:"",labelPaddingX:(e?.padding||0)*2,labelPaddingY:(e?.padding||0)*1};return o5(t,e,r)}async function DK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=a.height+e.padding,o=a.width+s/4+e.padding,l,{cssStyles:u}=e;if(e.look==="handDrawn"){let h=Ye.svg(i),f=Bt(e,{}),d=Cu(-o/2,-s/2,o,s,s/2),p=h.path(d,f);l=i.insert(()=>p,":first-child"),l.attr("class","basic label-container").attr("style",Aa(u))}else l=i.insert("rect",":first-child"),l.attr("class","basic label-container").attr("style",n).attr("rx",s/2).attr("ry",s/2).attr("x",-o/2).attr("y",-s/2).attr("width",o).attr("height",s);return Pt(e,l),e.intersect=function(h){return Nt.rect(e,h)},i}async function OK(t,e){return o5(t,e,{rx:5,ry:5,classes:"flowchart-node"})}function PK(t,e,{config:{themeVariables:r}}){let{labelStyles:n,nodeStyles:i}=Vt(e);e.labelStyle=n;let{cssStyles:a}=e,{lineColor:s,stateBorder:o,nodeBorder:l}=r,u=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),h=Ye.svg(u),f=Bt(e,{});e.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let d=h.circle(0,0,14,{...f,stroke:s,strokeWidth:2}),p=o??l,g=h.circle(0,0,5,{...f,fill:p,stroke:p,strokeWidth:2,fillStyle:"solid"}),m=u.insert(()=>d,":first-child");return m.insert(()=>g),a&&m.selectAll("path").attr("style",a),i&&m.selectAll("path").attr("style",i),Pt(e,m),e.intersect=function(y){return Nt.circle(e,7,y)},u}function BK(t,e,{config:{themeVariables:r}}){let{lineColor:n}=r,i=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),a;if(e.look==="handDrawn"){let o=Ye.svg(i).circle(0,0,14,E6e(n));a=i.insert(()=>o),a.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else a=i.insert("circle",":first-child"),a.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return Pt(e,a),e.intersect=function(s){return Nt.circle(e,7,s)},i}async function FK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=(e?.padding||0)/2,o=a.width+e.padding,l=a.height+e.padding,u=-a.width/2-s,h=-a.height/2-s,f=[{x:0,y:0},{x:o,y:0},{x:o,y:-l},{x:0,y:-l},{x:0,y:0},{x:-8,y:0},{x:o+8,y:0},{x:o+8,y:-l},{x:-8,y:-l},{x:-8,y:0}];if(e.look==="handDrawn"){let d=Ye.svg(i),p=Bt(e,{}),g=d.rectangle(u-8,h,o+16,l,p),m=d.line(u,h,u,h+l,p),y=d.line(u+o,h,u+o,h+l,p);i.insert(()=>m,":first-child"),i.insert(()=>y,":first-child");let x=i.insert(()=>g,":first-child"),{cssStyles:b}=e;x.attr("class","basic label-container").attr("style",Aa(b)),Pt(e,x)}else{let d=Au(i,o,l,f);n&&d.attr("style",n),Pt(e,d)}return e.intersect=function(d){return Nt.polygon(e,f,d)},i}async function zK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=Math.max(a.width+(e.padding??0)*2,e?.width??0),o=Math.max(a.height+(e.padding??0)*2,e?.height??0),l=-s/2,u=-o/2,h=.2*o,f=.2*o,{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{}),m=[{x:l-h/2,y:u},{x:l+s+h/2,y:u},{x:l+s+h/2,y:u+o},{x:l-h/2,y:u+o}],y=[{x:l+s-h/2,y:u+o},{x:l+s+h/2,y:u+o},{x:l+s+h/2,y:u+o-f}];e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let x=Er(m),b=p.path(x,g),w=Er(y),_=p.path(w,{...g,fillStyle:"solid"}),k=i.insert(()=>_,":first-child");return k.insert(()=>b,":first-child"),k.attr("class","basic label-container"),d&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",d),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),Pt(e,k),e.intersect=function(E){return Nt.polygon(e,m,E)},i}async function $K(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=l/4,h=.2*o,f=.2*l,d=l+u,{cssStyles:p}=e,g=Ye.svg(i),m=Bt(e,{});e.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let y=[{x:-o/2-o/2*.1,y:d/2},...Oh(-o/2-o/2*.1,d/2,o/2+o/2*.1,d/2,u,.8),{x:o/2+o/2*.1,y:-d/2},{x:-o/2-o/2*.1,y:-d/2}],x=-o/2+o/2*.1,b=-d/2-f*.4,w=[{x:x+o-h,y:(b+l)*1.4},{x:x+o,y:b+l-f},{x:x+o,y:(b+l)*.9},...Oh(x+o,(b+l)*1.3,x+o-h,(b+l)*1.5,-l*.03,.5)],_=Er(y),k=g.path(_,m),E=Er(w),L=g.path(E,{...m,fillStyle:"solid"}),S=i.insert(()=>L,":first-child");return S.insert(()=>k,":first-child"),S.attr("class","basic label-container"),p&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",p),n&&e.look!=="handDrawn"&&S.selectAll("path").attr("style",n),S.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-o/2+(e.padding??0)-(a.x-(a.left??0))},${-l/2+(e.padding??0)-u/2-(a.y-(a.top??0))})`),Pt(e,S),e.intersect=function(C){return Nt.polygon(e,y,C)},i}async function GK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=Math.max(a.width+e.padding,e?.width||0),o=Math.max(a.height+e.padding,e?.height||0),l=-s/2,u=-o/2,h=i.insert("rect",":first-child");return h.attr("class","text").attr("style",n).attr("rx",0).attr("ry",0).attr("x",l).attr("y",u).attr("width",s).attr("height",o),Pt(e,h),e.intersect=function(f){return Nt.rect(e,f)},i}async function UK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s,halfPadding:o}=await tr(t,e,rr(e)),l=e.look==="neo"?o*2:o,u=a.height+l,h=u/2,f=h/(2.5+u/50),d=a.width+f+l,{cssStyles:p}=e,g;if(e.look==="handDrawn"){let m=Ye.svg(i),y=H6e(0,0,d,u,f,h),x=q6e(0,0,d,u,f,h),b=m.path(y,Bt(e,{})),w=m.path(x,Bt(e,{fill:"none"}));g=i.insert(()=>w,":first-child"),g=i.insert(()=>b,":first-child"),g.attr("class","basic label-container"),p&&g.attr("style",p)}else{let m=W6e(0,0,d,u,f,h);g=i.insert("path",":first-child").attr("d",m).attr("class","basic label-container").attr("style",Aa(p)).attr("style",n),g.attr("class","basic label-container"),p&&g.selectAll("path").attr("style",p),n&&g.selectAll("path").attr("style",n)}return g.attr("label-offset-x",f),g.attr("transform",`translate(${-d/2}, ${u/2} )`),s.attr("transform",`translate(${-(a.width/2)-f-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),Pt(e,g),e.intersect=function(m){let y=Nt.rect(e,m),x=y.y-(e.y??0);if(h!=0&&(Math.abs(x)<(e.height??0)/2||Math.abs(x)==(e.height??0)/2&&Math.abs(y.x-(e.x??0))>(e.width??0)/2-f)){let b=f*f*(1-x*x/(h*h));b!=0&&(b=Math.sqrt(b)),b=f-b,m.x-(e.x??0)>0&&(b=-b),y.x+=b}return y},i}async function VK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=a.width+e.padding,o=a.height+e.padding,l=[{x:-3*o/6,y:0},{x:s+3*o/6,y:0},{x:s,y:-o},{x:0,y:-o}],u,{cssStyles:h}=e;if(e.look==="handDrawn"){let f=Ye.svg(i),d=Bt(e,{}),p=Er(l),g=f.path(p,d);u=i.insert(()=>g,":first-child").attr("transform",`translate(${-s/2}, ${o/2})`),h&&u.attr("style",h)}else u=Au(i,s,o,l);return n&&u.attr("style",n),e.width=s,e.height=o,Pt(e,u),e.intersect=function(f){return Nt.polygon(e,l,f)},i}async function WK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=60,o=20,l=Math.max(s,a.width+(e.padding??0)*2,e?.width??0),u=Math.max(o,a.height+(e.padding??0)*2,e?.height??0),{cssStyles:h}=e,f=Ye.svg(i),d=Bt(e,{});e.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let p=[{x:-l/2*.8,y:-u/2},{x:l/2*.8,y:-u/2},{x:l/2,y:-u/2*.6},{x:l/2,y:u/2},{x:-l/2,y:u/2},{x:-l/2,y:-u/2*.6}],g=Er(p),m=f.path(g,d),y=i.insert(()=>m,":first-child");return y.attr("class","basic label-container"),h&&e.look!=="handDrawn"&&y.selectChildren("path").attr("style",h),n&&e.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),Pt(e,y),e.intersect=function(x){return Nt.polygon(e,p,x)},i}async function HK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Wr(pe().flowchart?.htmlLabels),l=a.width+(e.padding??0),u=l+a.height,h=l+a.height,f=[{x:0,y:0},{x:h,y:0},{x:h/2,y:-u}],{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let m=Er(f),y=p.path(m,g),x=i.insert(()=>y,":first-child").attr("transform",`translate(${-u/2}, ${u/2})`);return d&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",d),n&&e.look!=="handDrawn"&&x.selectChildren("path").attr("style",n),e.width=l,e.height=u,Pt(e,x),s.attr("transform",`translate(${-a.width/2-(a.x-(a.left??0))}, ${u/2-(a.height+(e.padding??0)/(o?2:1)-(a.y-(a.top??0)))})`),e.intersect=function(b){return re.info("Triangle intersect",e,f,b),Nt.polygon(e,f,b)},i}async function qK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=l/8,h=l+u,{cssStyles:f}=e,p=70-o,g=p>0?p/2:0,m=Ye.svg(i),y=Bt(e,{});e.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let x=[{x:-o/2-g,y:h/2},...Oh(-o/2-g,h/2,o/2+g,h/2,u,.8),{x:o/2+g,y:-h/2},{x:-o/2-g,y:-h/2}],b=Er(x),w=m.path(b,y),_=i.insert(()=>w,":first-child");return _.attr("class","basic label-container"),f&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",f),n&&e.look!=="handDrawn"&&_.selectAll("path").attr("style",n),_.attr("transform",`translate(0,${-u/2})`),s.attr("transform",`translate(${-o/2+(e.padding??0)-(a.x-(a.left??0))},${-l/2+(e.padding??0)-u-(a.y-(a.top??0))})`),Pt(e,_),e.intersect=function(k){return Nt.polygon(e,x,k)},i}async function YK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a}=await tr(t,e,rr(e)),s=100,o=50,l=Math.max(a.width+(e.padding??0)*2,e?.width??0),u=Math.max(a.height+(e.padding??0)*2,e?.height??0),h=l/u,f=l,d=u;f>d*h?d=f/h:f=d*h,f=Math.max(f,s),d=Math.max(d,o);let p=Math.min(d*.2,d/4),g=d+p*2,{cssStyles:m}=e,y=Ye.svg(i),x=Bt(e,{});e.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let b=[{x:-f/2,y:g/2},...Oh(-f/2,g/2,f/2,g/2,p,1),{x:f/2,y:-g/2},...Oh(f/2,-g/2,-f/2,-g/2,p,-1)],w=Er(b),_=y.path(w,x),k=i.insert(()=>_,":first-child");return k.attr("class","basic label-container"),m&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",m),n&&e.look!=="handDrawn"&&k.selectAll("path").attr("style",n),Pt(e,k),e.intersect=function(E){return Nt.polygon(e,b,E)},i}async function XK(t,e){let{labelStyles:r,nodeStyles:n}=Vt(e);e.labelStyle=r;let{shapeSvg:i,bbox:a,label:s}=await tr(t,e,rr(e)),o=Math.max(a.width+(e.padding??0)*2,e?.width??0),l=Math.max(a.height+(e.padding??0)*2,e?.height??0),u=5,h=-o/2,f=-l/2,{cssStyles:d}=e,p=Ye.svg(i),g=Bt(e,{}),m=[{x:h-u,y:f-u},{x:h-u,y:f+l},{x:h+o,y:f+l},{x:h+o,y:f-u}],y=`M${h-u},${f-u} L${h+o},${f-u} L${h+o},${f+l} L${h-u},${f+l} L${h-u},${f-u} M${h-u},${f} L${h+o},${f} M${h},${f-u} L${h},${f+l}`;e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let x=p.path(y,g),b=i.insert(()=>x,":first-child");return b.attr("transform",`translate(${u/2}, ${u/2})`),b.attr("class","basic label-container"),d&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",d),n&&e.look!=="handDrawn"&&b.selectAll("path").attr("style",n),s.attr("transform",`translate(${-(a.width/2)+u/2-(a.x-(a.left??0))}, ${-(a.height/2)+u/2-(a.y-(a.top??0))})`),Pt(e,b),e.intersect=function(w){return Nt.polygon(e,m,w)},i}async function jK(t,e,r,n,i=r.class.padding??12){let a=n?0:3,s=t.insert("g").attr("class",rr(e)).attr("id",e.domId||e.id),o=null,l=null,u=null,h=null,f=0,d=0,p=0;if(o=s.insert("g").attr("class","annotation-group text"),e.annotations.length>0){let b=e.annotations[0];await Qv(o,{text:`\xAB${b}\xBB`},0),f=o.node().getBBox().height}l=s.insert("g").attr("class","label-group text"),await Qv(l,e,0,["font-weight: bolder"]);let g=l.node().getBBox();d=g.height,u=s.insert("g").attr("class","members-group text");let m=0;for(let b of e.members){let w=await Qv(u,b,m,[b.parseClassifier()]);m+=w+a}p=u.node().getBBox().height,p<=0&&(p=i/2),h=s.insert("g").attr("class","methods-group text");let y=0;for(let b of e.methods){let w=await Qv(h,b,y,[b.parseClassifier()]);y+=w+a}let x=s.node().getBBox();if(o!==null){let b=o.node().getBBox();o.attr("transform",`translate(${-b.width/2})`)}return l.attr("transform",`translate(${-g.width/2}, ${f})`),x=s.node().getBBox(),u.attr("transform",`translate(0, ${f+d+i*2})`),x=s.node().getBBox(),h.attr("transform",`translate(0, ${f+d+(p?p+i*4:i*2)})`),x=s.node().getBBox(),{shapeSvg:s,bbox:x}}async function Qv(t,e,r,n=[]){let i=t.insert("g").attr("class","label").attr("style",n.join("; ")),a=Or(),s="useHtmlLabels"in e?e.useHtmlLabels:Wr(a.htmlLabels)??!0,o="";"text"in e?o=e.text:o=e.label,!s&&o.startsWith("\\")&&(o=o.substring(1)),Ei(o)&&(s=!0);let l=await oa(i,WS(Xs(o)),{width:bs(o,a)+50,classes:"markdown-node-label",useHtmlLabels:s},a),u,h=1;if(s){let f=l.children[0],d=Ve(l);h=f.innerHTML.split("
    ").length,f.innerHTML.includes("")&&(h+=f.innerHTML.split("").length-1);let p=f.getElementsByTagName("img");if(p){let g=o.replace(/]*>/g,"").trim()==="";await Promise.all([...p].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",g){let b=a.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,_=parseInt(b,10)*5+"px";m.style.minWidth=_,m.style.maxWidth=_}else m.style.width="100%";y(m)}v(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}u=f.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}else{n.includes("font-weight: bolder")&&Ve(l).selectAll("tspan").attr("font-weight",""),h=l.children.length;let f=l.children[0];(l.textContent===""||l.textContent.includes(">"))&&(f.textContent=o[0]+o.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),o[1]===" "&&(f.textContent=f.textContent[0]+" "+f.textContent.substring(1))),f.textContent==="undefined"&&(f.textContent=""),u=l.getBBox()}return i.attr("transform","translate(0,"+(-u.height/(2*h)+r)+")"),u.height}async function KK(t,e){let r=pe(),n=r.class.padding??12,i=n,a=e.useHtmlLabels??Wr(r.htmlLabels)??!0,s=e;s.annotations=s.annotations??[],s.members=s.members??[],s.methods=s.methods??[];let{shapeSvg:o,bbox:l}=await jK(t,e,r,a,i),{labelStyles:u,nodeStyles:h}=Vt(e);e.labelStyle=u,e.cssStyles=s.styles||"";let f=s.styles?.join(";")||h||"";e.cssStyles||(e.cssStyles=f.replaceAll("!important","").split(";"));let d=s.members.length===0&&s.methods.length===0&&!r.class?.hideEmptyMembersBox,p=Ye.svg(o),g=Bt(e,{});e.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let m=l.width,y=l.height;s.members.length===0&&s.methods.length===0?y+=i:s.members.length>0&&s.methods.length===0&&(y+=i*2);let x=-m/2,b=-y/2,w=p.rectangle(x-n,b-n-(d?n:s.members.length===0&&s.methods.length===0?-n/2:0),m+2*n,y+2*n+(d?n*2:s.members.length===0&&s.methods.length===0?-n:0),g),_=o.insert(()=>w,":first-child");_.attr("class","basic label-container");let k=_.node().getBBox();o.selectAll(".text").each((C,M,R)=>{let T=Ve(R[M]),I=T.attr("transform"),A=0;if(I){let B=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(I);B&&(A=parseFloat(B[2]))}let D=A+b+n-(d?n:s.members.length===0&&s.methods.length===0?-n/2:0);a||(D-=4);let N=x;(T.attr("class").includes("label-group")||T.attr("class").includes("annotation-group"))&&(N=-T.node()?.getBBox().width/2||0,o.selectAll("text").each(function(O,B,P){window.getComputedStyle(P[B]).textAnchor==="middle"&&(N=0)})),T.attr("transform",`translate(${N}, ${D})`)});let E=o.select(".annotation-group").node().getBBox().height-(d?n/2:0)||0,L=o.select(".label-group").node().getBBox().height-(d?n/2:0)||0,S=o.select(".members-group").node().getBBox().height-(d?n/2:0)||0;if(s.members.length>0||s.methods.length>0||d){let C=p.line(k.x,E+L+b+n,k.x+k.width,E+L+b+n,g);o.insert(()=>C).attr("class","divider").attr("style",f)}if(d||s.members.length>0||s.methods.length>0){let C=p.line(k.x,E+L+S+b+i*2+n,k.x+k.width,E+L+S+b+n+i*2,g);o.insert(()=>C).attr("class","divider").attr("style",f)}if(s.look!=="handDrawn"&&o.selectAll("path").attr("style",f),_.select(":nth-child(2)").attr("style",f),o.selectAll(".divider").select("path").attr("style",f),e.labelStyle?o.selectAll("span").attr("style",e.labelStyle):o.selectAll("span").attr("style",f),!a){let C=RegExp(/color\s*:\s*([^;]*)/),M=C.exec(f);if(M){let R=M[0].replace("color","fill");o.selectAll("tspan").attr("style",R)}else if(u){let R=C.exec(u);if(R){let T=R[0].replace("color","fill");o.selectAll("tspan").attr("style",T)}}}return Pt(e,_),e.intersect=function(C){return Nt.rect(e,C)},o}async function ZK(t,e,{config:r}){let{labelStyles:n,nodeStyles:i}=Vt(e);e.labelStyle=n||"";let a=10,s=e.width;e.width=(e.width??200)-10;let{shapeSvg:o,bbox:l,label:u}=await tr(t,e,rr(e)),h=e.padding||10,f="",d;"ticket"in e&&e.ticket&&r?.kanban?.ticketBaseUrl&&(f=r?.kanban?.ticketBaseUrl.replace("#TICKET#",e.ticket),d=o.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",f).attr("target","_blank"));let p={useHtmlLabels:e.useHtmlLabels,labelStyle:e.labelStyle||"",width:e.width,img:e.img,padding:e.padding||8,centerLabel:!1},g,m;d?{label:g,bbox:m}=await $A(d,"ticket"in e&&e.ticket||"",p):{label:g,bbox:m}=await $A(o,"ticket"in e&&e.ticket||"",p);let{label:y,bbox:x}=await $A(o,"assigned"in e&&e.assigned||"",p);e.width=s;let b=10,w=e?.width||0,_=Math.max(m.height,x.height)/2,k=Math.max(l.height+b*2,e?.height||0)+_,E=-w/2,L=-k/2;u.attr("transform","translate("+(h-w/2)+", "+(-_-l.height/2)+")"),g.attr("transform","translate("+(h-w/2)+", "+(-_+l.height/2)+")"),y.attr("transform","translate("+(h+w/2-x.width-2*a)+", "+(-_+l.height/2)+")");let S,{rx:C,ry:M}=e,{cssStyles:R}=e;if(e.look==="handDrawn"){let T=Ye.svg(o),I=Bt(e,{}),A=C||M?T.path(Cu(E,L,w,k,C||0),I):T.rectangle(E,L,w,k,I);S=o.insert(()=>A,":first-child"),S.attr("class","basic label-container").attr("style",R||null)}else{S=o.insert("rect",":first-child"),S.attr("class","basic label-container __APA__").attr("style",i).attr("rx",C??5).attr("ry",M??5).attr("x",E).attr("y",L).attr("width",w).attr("height",k);let T="priority"in e&&e.priority;if(T){let I=o.append("line"),A=E+2,D=L+Math.floor((C??0)/2),N=L+k-Math.floor((C??0)/2);I.attr("x1",A).attr("y1",D).attr("x2",A).attr("y2",N).attr("stroke-width","4").attr("stroke",Y6e(T))}}return Pt(e,S),e.height=k,e.intersect=function(T){return Nt.rect(e,T)},o}function WA(t){return t in QK}async function wd(t,e,r){let n,i;e.shape==="rect"&&(e.rx&&e.ry?e.shape="roundedRect":e.shape="squareRect");let a=e.shape?QK[e.shape]:void 0;if(!a)throw new Error(`No such shape: ${e.shape}. Please check your syntax.`);if(e.link){let s;r.config.securityLevel==="sandbox"?s="_top":e.linkTarget&&(s=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",s??null),i=await a(n,e,r)}else i=await a(t,e,r),n=i;return e.tooltip&&i.attr("title",e.tooltip),l5.set(e.id,n),e.haveCallback&&n.attr("class",n.attr("class")+" clickable"),n}var tr,$A,Pt,rr,k6e,Jp,T6e,Ph,Cu,E6e,eg,S6e,Vt,Bt,Bj,C6e,A6e,_6e,L6e,R6e,N6e,Fj,tg,zj,I6e,Uj,M6e,D6e,O6e,Nt,P6e,B6e,F6e,z6e,$6e,G6e,U6e,V6e,W6e,H6e,q6e,Y6e,X6e,j6e,QK,l5,JK,eZ,Jv,yl=F(()=>{sl();bo();Ya();kn();or();lr();lr();$t();lr();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();lr();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();$t();lr();$t();lr();$t();tr=v(async(t,e,r)=>{let n,i=e.useHtmlLabels||Wr(pe()?.htmlLabels);r?n=r:n="node default";let a=t.insert("g").attr("class",n).attr("id",e.domId||e.id),s=a.insert("g").attr("class","label").attr("style",Aa(e.labelStyle)),o;e.label===void 0?o="":o=typeof e.label=="string"?e.label:e.label[0];let l=await oa(s,yr(Xs(o),pe()),{useHtmlLabels:i,width:e.width||pe().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:e.labelStyle,addSvgBackground:!!e.icon||!!e.img}),u=l.getBBox(),h=(e?.padding??0)/2;if(i){let f=l.children[0],d=Ve(l),p=f.getElementsByTagName("img");if(p){let g=o.replace(/]*>/g,"").trim()==="";await Promise.all([...p].map(m=>new Promise(y=>{function x(){if(m.style.display="flex",m.style.flexDirection="column",g){let b=pe().fontSize?pe().fontSize:window.getComputedStyle(document.body).fontSize,w=5,[_=sr.fontSize]=Ro(b),k=_*w+"px";m.style.minWidth=k,m.style.maxWidth=k}else m.style.width="100%";y(m)}v(x,"setupImage"),setTimeout(()=>{m.complete&&x()}),m.addEventListener("error",x),m.addEventListener("load",x)})))}u=f.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}return i?s.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"):s.attr("transform","translate(0, "+-u.height/2+")"),e.centerLabel&&s.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:a,bbox:u,halfPadding:h,label:s}},"labelHelper"),$A=v(async(t,e,r)=>{let n=r.useHtmlLabels||Wr(pe()?.flowchart?.htmlLabels),i=t.insert("g").attr("class","label").attr("style",r.labelStyle||""),a=await oa(i,yr(Xs(e),pe()),{useHtmlLabels:n,width:r.width||pe()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),s=a.getBBox(),o=r.padding/2;if(Wr(pe()?.flowchart?.htmlLabels)){let l=a.children[0],u=Ve(a);s=l.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}return n?i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):i.attr("transform","translate(0, "+-s.height/2+")"),r.centerLabel&&i.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:t,bbox:s,halfPadding:o,label:i}},"insertLabel"),Pt=v((t,e)=>{let r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds"),rr=v((t,e)=>(t.look==="handDrawn"?"rough-node":"node")+" "+t.cssClasses+" "+(e||""),"getNodeClasses");v(Er,"createPathFromPoints");v(Oh,"generateFullSineWavePoints");v(VA,"generateCirclePoints");k6e=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),Jp=k6e;v(Oj,"applyStyle");v(Pj,"addHtmlLabel");T6e=v(async(t,e,r,n)=>{let i=t||"";if(typeof i=="object"&&(i=i[0]),Wr(pe().flowchart.htmlLabels)){i=i.replace(/\\n|\n/g,"
    "),re.info("vertexText"+i);let a={isNode:n,label:Xs(i).replace(/fa[blrs]?:fa-[\w-]+/g,o=>``),labelStyle:e&&e.replace("fill:","color:")};return await Pj(a)}else{let a=document.createElementNS("http://www.w3.org/2000/svg","text");a.setAttribute("style",e.replace("color:","fill:"));let s=[];typeof i=="string"?s=i.split(/\\n|\n|/gi):Array.isArray(i)?s=i:s=[];for(let o of s){let l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),r?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=o.trim(),a.appendChild(l)}return a}},"createLabel"),Ph=T6e,Cu=v((t,e,r,n,i)=>["M",t+i,e,"H",t+r-i,"A",i,i,0,0,1,t+r,e+i,"V",e+n-i,"A",i,i,0,0,1,t+r-i,e+n,"H",t+i,"A",i,i,0,0,1,t,e+n-i,"V",e+i,"A",i,i,0,0,1,t+i,e,"Z"].join(" "),"createRoundedRectPathD"),E6e=v(t=>{let{handDrawnSeed:e}=pe();return{fill:t,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:t,seed:e}},"solidStateFill"),eg=v(t=>{let e=S6e([...t.cssCompiledStyles||[],...t.cssStyles||[]]);return{stylesMap:e,stylesArray:[...e]}},"compileStyles"),S6e=v(t=>{let e=new Map;return t.forEach(r=>{let[n,i]=r.split(":");e.set(n.trim(),i?.trim())}),e},"styles2Map"),Vt=v(t=>{let{stylesArray:e}=eg(t),r=[],n=[],i=[],a=[];return e.forEach(s=>{let o=s[0];o==="color"||o==="font-size"||o==="font-family"||o==="font-weight"||o==="font-style"||o==="text-decoration"||o==="text-align"||o==="text-transform"||o==="line-height"||o==="letter-spacing"||o==="word-spacing"||o==="text-shadow"||o==="text-overflow"||o==="white-space"||o==="word-wrap"||o==="word-break"||o==="overflow-wrap"||o==="hyphens"?r.push(s.join(":")+" !important"):(n.push(s.join(":")+" !important"),o.includes("stroke")&&i.push(s.join(":")+" !important"),o==="fill"&&a.push(s.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:n.join(";"),stylesArray:e,borderStyles:i,backgroundStyles:a}},"styles2String"),Bt=v((t,e)=>{let{themeVariables:r,handDrawnSeed:n}=pe(),{nodeBorder:i,mainBkg:a}=r,{stylesMap:s}=eg(t);return Object.assign({roughness:.7,fill:s.get("fill")||a,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||i,seed:n,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0]},e)},"userNodeOverrides"),Bj=v(async(t,e)=>{re.info("Creating subgraph rect for ",e.id,e);let r=pe(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=Vt(e),f=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),d=Wr(r.flowchart.htmlLabels),p=f.insert("g").attr("class","cluster-label "),g=await oa(p,e.label,{style:e.labelStyle,useHtmlLabels:d,isNode:!0}),m=g.getBBox();if(Wr(r.flowchart.htmlLabels)){let L=g.children[0],S=Ve(g);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}let y=e.width<=m.width+e.padding?m.width+e.padding:e.width;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;let x=e.height,b=e.x-y/2,w=e.y-x/2;re.trace("Data ",e,JSON.stringify(e));let _;if(e.look==="handDrawn"){let L=Ye.svg(f),S=Bt(e,{roughness:.7,fill:a,stroke:s,fillWeight:3,seed:i}),C=L.path(Cu(b,w,y,x,0),S);_=f.insert(()=>(re.debug("Rough node insert CXC",C),C),":first-child"),_.select("path:nth-child(2)").attr("style",u.join(";")),_.select("path").attr("style",h.join(";").replace("fill","stroke"))}else _=f.insert("rect",":first-child"),_.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",w).attr("width",y).attr("height",x);let{subGraphTitleTopMargin:k}=ou(r);if(p.attr("transform",`translate(${e.x-m.width/2}, ${e.y-e.height/2+k})`),o){let L=p.select("span");L&&L.attr("style",o)}let E=_.node().getBBox();return e.offsetX=0,e.width=E.width,e.height=E.height,e.offsetY=m.height-e.padding/2,e.intersect=function(L){return Jp(e,L)},{cluster:f,labelBBox:m}},"rect"),C6e=v((t,e)=>{let r=t.insert("g").attr("class","note-cluster").attr("id",e.id),n=r.insert("rect",":first-child"),i=0*e.padding,a=i/2;n.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-a).attr("y",e.y-e.height/2-a).attr("width",e.width+i).attr("height",e.height+i).attr("fill","none");let s=n.node().getBBox();return e.width=s.width,e.height=s.height,e.intersect=function(o){return Jp(e,o)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),A6e=v(async(t,e)=>{let r=pe(),{themeVariables:n,handDrawnSeed:i}=r,{altBackground:a,compositeBackground:s,compositeTitleBackground:o,nodeBorder:l}=n,u=t.insert("g").attr("class",e.cssClasses).attr("id",e.id).attr("data-id",e.id).attr("data-look",e.look),h=u.insert("g",":first-child"),f=u.insert("g").attr("class","cluster-label"),d=u.append("rect"),p=f.node().appendChild(await Ph(e.label,e.labelStyle,void 0,!0)),g=p.getBBox();if(Wr(r.flowchart.htmlLabels)){let C=p.children[0],M=Ve(p);g=C.getBoundingClientRect(),M.attr("width",g.width),M.attr("height",g.height)}let m=0*e.padding,y=m/2,x=(e.width<=g.width+e.padding?g.width+e.padding:e.width)+m;e.width<=g.width+e.padding?e.diff=(x-e.width)/2-e.padding:e.diff=-e.padding;let b=e.height+m,w=e.height+m-g.height-6,_=e.x-x/2,k=e.y-b/2;e.width=x;let E=e.y-e.height/2-y+g.height+2,L;if(e.look==="handDrawn"){let C=e.cssClasses.includes("statediagram-cluster-alt"),M=Ye.svg(u),R=e.rx||e.ry?M.path(Cu(_,k,x,b,10),{roughness:.7,fill:o,fillStyle:"solid",stroke:l,seed:i}):M.rectangle(_,k,x,b,{seed:i});L=u.insert(()=>R,":first-child");let T=M.rectangle(_,E,x,w,{fill:C?a:s,fillStyle:C?"hachure":"solid",stroke:l,seed:i});L=u.insert(()=>R,":first-child"),d=u.insert(()=>T)}else L=h.insert("rect",":first-child"),L.attr("class","outer").attr("x",_).attr("y",k).attr("width",x).attr("height",b).attr("data-look",e.look),d.attr("class","inner").attr("x",_).attr("y",E).attr("width",x).attr("height",w);f.attr("transform",`translate(${e.x-g.width/2}, ${k+1-(Wr(r.flowchart.htmlLabels)?0:3)})`);let S=L.node().getBBox();return e.height=S.height,e.offsetX=0,e.offsetY=g.height-e.padding/2,e.labelBBox=g,e.intersect=function(C){return Jp(e,C)},{cluster:u,labelBBox:g}},"roundedWithTitle"),_6e=v(async(t,e)=>{re.info("Creating subgraph rect for ",e.id,e);let r=pe(),{themeVariables:n,handDrawnSeed:i}=r,{clusterBkg:a,clusterBorder:s}=n,{labelStyles:o,nodeStyles:l,borderStyles:u,backgroundStyles:h}=Vt(e),f=t.insert("g").attr("class","cluster "+e.cssClasses).attr("id",e.id).attr("data-look",e.look),d=Wr(r.flowchart.htmlLabels),p=f.insert("g").attr("class","cluster-label "),g=await oa(p,e.label,{style:e.labelStyle,useHtmlLabels:d,isNode:!0,width:e.width}),m=g.getBBox();if(Wr(r.flowchart.htmlLabels)){let L=g.children[0],S=Ve(g);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}let y=e.width<=m.width+e.padding?m.width+e.padding:e.width;e.width<=m.width+e.padding?e.diff=(y-e.width)/2-e.padding:e.diff=-e.padding;let x=e.height,b=e.x-y/2,w=e.y-x/2;re.trace("Data ",e,JSON.stringify(e));let _;if(e.look==="handDrawn"){let L=Ye.svg(f),S=Bt(e,{roughness:.7,fill:a,stroke:s,fillWeight:4,seed:i}),C=L.path(Cu(b,w,y,x,e.rx),S);_=f.insert(()=>(re.debug("Rough node insert CXC",C),C),":first-child"),_.select("path:nth-child(2)").attr("style",u.join(";")),_.select("path").attr("style",h.join(";").replace("fill","stroke"))}else _=f.insert("rect",":first-child"),_.attr("style",l).attr("rx",e.rx).attr("ry",e.ry).attr("x",b).attr("y",w).attr("width",y).attr("height",x);let{subGraphTitleTopMargin:k}=ou(r);if(p.attr("transform",`translate(${e.x-m.width/2}, ${e.y-e.height/2+k})`),o){let L=p.select("span");L&&L.attr("style",o)}let E=_.node().getBBox();return e.offsetX=0,e.width=E.width,e.height=E.height,e.offsetY=m.height-e.padding/2,e.intersect=function(L){return Jp(e,L)},{cluster:f,labelBBox:m}},"kanbanSection"),L6e=v((t,e)=>{let r=pe(),{themeVariables:n,handDrawnSeed:i}=r,{nodeBorder:a}=n,s=t.insert("g").attr("class",e.cssClasses).attr("id",e.id).attr("data-look",e.look),o=s.insert("g",":first-child"),l=0*e.padding,u=e.width+l;e.diff=-e.padding;let h=e.height+l,f=e.x-u/2,d=e.y-h/2;e.width=u;let p;if(e.look==="handDrawn"){let y=Ye.svg(s).rectangle(f,d,u,h,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:a,seed:i});p=s.insert(()=>y,":first-child")}else p=o.insert("rect",":first-child"),p.attr("class","divider").attr("x",f).attr("y",d).attr("width",u).attr("height",h).attr("data-look",e.look);let g=p.node().getBBox();return e.height=g.height,e.offsetX=0,e.offsetY=0,e.intersect=function(m){return Jp(e,m)},{cluster:s,labelBBox:{}}},"divider"),R6e=Bj,N6e={rect:Bj,squareRect:R6e,roundedWithTitle:A6e,noteGroup:C6e,divider:L6e,kanbanSection:_6e},Fj=new Map,tg=v(async(t,e)=>{let r=e.shape||"rect",n=await N6e[r](t,e);return Fj.set(e.id,n),n},"insertCluster"),zj=v(()=>{Fj=new Map},"clear");v($j,"intersectNode");I6e=$j;v(Gj,"intersectEllipse");Uj=Gj;v(Vj,"intersectCircle");M6e=Vj;v(Wj,"intersectLine");v(GA,"sameSign");D6e=Wj;v(Hj,"intersectPolygon");O6e=Hj,Nt={node:I6e,circle:M6e,ellipse:Uj,polygon:O6e,rect:Jp};v(qj,"anchor");v(UA,"generateArcPoints");v(Yj,"bowTieRect");v(Au,"insertPolygonShape");v(Xj,"card");v(jj,"choice");v(Kj,"circle");v(Zj,"createLine");v(Qj,"crossedCircle");v(Eu,"generateCirclePoints");v(Jj,"curlyBraceLeft");v(Su,"generateCirclePoints");v(eK,"curlyBraceRight");v(la,"generateCirclePoints");v(tK,"curlyBraces");v(rK,"curvedTrapezoid");P6e=v((t,e,r,n,i,a)=>[`M${t},${e+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createCylinderPathD"),B6e=v((t,e,r,n,i,a)=>[`M${t},${e+a}`,`M${t+r},${e+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`].join(" "),"createOuterCylinderPathD"),F6e=v((t,e,r,n,i,a)=>[`M${t-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");v(nK,"cylinder");v(iK,"dividedRectangle");v(aK,"doublecircle");v(sK,"filledCircle");v(oK,"flippedTriangle");v(lK,"forkJoin");v(cK,"halfRoundedRectangle");z6e=v((t,e,r,n,i)=>[`M${t+i},${e}`,`L${t+r-i},${e}`,`L${t+r},${e-n/2}`,`L${t+r-i},${e-n}`,`L${t+i},${e-n}`,`L${t},${e-n/2}`,"Z"].join(" "),"createHexagonPathD");v(uK,"hexagon");v(hK,"hourglass");v(fK,"icon");v(dK,"iconCircle");v(pK,"iconRounded");v(gK,"iconSquare");v(mK,"imageSquare");v(vK,"inv_trapezoid");v(o5,"drawRect");v(yK,"labelRect");v(xK,"lean_left");v(bK,"lean_right");v(wK,"lightningBolt");$6e=v((t,e,r,n,i,a,s)=>[`M${t},${e+a}`,`a${i},${a} 0,0,0 ${r},0`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),G6e=v((t,e,r,n,i,a,s)=>[`M${t},${e+a}`,`M${t+r},${e+a}`,`a${i},${a} 0,0,0 ${-r},0`,`l0,${n}`,`a${i},${a} 0,0,0 ${r},0`,`l0,${-n}`,`M${t},${e+a+s}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),U6e=v((t,e,r,n,i,a)=>[`M${t-r/2},${-n/2}`,`a${i},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD");v(kK,"linedCylinder");v(TK,"linedWaveEdgedRect");v(EK,"multiRect");v(SK,"multiWaveEdgedRectangle");v(CK,"note");V6e=v((t,e,r)=>[`M${t+r/2},${e}`,`L${t+r},${e-r/2}`,`L${t+r/2},${e-r}`,`L${t},${e-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");v(AK,"question");v(_K,"rect_left_inv_arrow");v(LK,"rectWithTitle");v(RK,"roundedRect");v(NK,"shadedProcess");v(IK,"slopedRect");v(MK,"squareRect");v(DK,"stadium");v(OK,"state");v(PK,"stateEnd");v(BK,"stateStart");v(FK,"subroutine");v(zK,"taggedRect");v($K,"taggedWaveEdgedRectangle");v(GK,"text");W6e=v((t,e,r,n,i,a)=>`M${t},${e} a${i},${a} 0,0,1 0,${-n} l${r},0 a${i},${a} 0,0,1 0,${n} M${r},${-n} a${i},${a} 0,0,0 0,${n} l${-r},0`,"createCylinderPathD"),H6e=v((t,e,r,n,i,a)=>[`M${t},${e}`,`M${t+r},${e}`,`a${i},${a} 0,0,0 0,${-n}`,`l${-r},0`,`a${i},${a} 0,0,0 0,${n}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),q6e=v((t,e,r,n,i,a)=>[`M${t+r/2},${-n/2}`,`a${i},${a} 0,0,0 0,${n}`].join(" "),"createInnerCylinderPathD");v(UK,"tiltedCylinder");v(VK,"trapezoid");v(WK,"trapezoidalPentagon");v(HK,"triangle");v(qK,"waveEdgedRectangle");v(YK,"waveRectangle");v(XK,"windowPane");v(jK,"textHelper");v(Qv,"addText");v(KK,"classBox");Y6e=v(t=>{switch(t){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");v(ZK,"kanbanItem");X6e=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:MK},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:RK},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:DK},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:FK},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:nK},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:Kj},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:AK},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:uK},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:bK},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:xK},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:VK},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:vK},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:aK},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:GK},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Xj},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:NK},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:BK},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:PK},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:lK},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:hK},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:Jj},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:eK},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:tK},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:wK},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:qK},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:cK},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:UK},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:kK},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:rK},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:iK},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:HK},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:XK},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:sK},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:WK},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:oK},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:IK},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:SK},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:EK},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Yj},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:Qj},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:$K},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:zK},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:YK},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:_K},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:TK}],j6e=v(()=>{let e=[...Object.entries({state:OK,choice:jj,note:CK,rectWithTitle:LK,labelRect:yK,iconSquare:gK,iconCircle:dK,icon:fK,iconRounded:pK,imageSquare:mK,anchor:qj,kanbanItem:ZK,classBox:KK}),...X6e.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(i=>[i,r.handler]))];return Object.fromEntries(e)},"generateShapeMap"),QK=j6e();v(WA,"isValidShape");l5=new Map;v(wd,"insertNode");JK=v((t,e)=>{l5.set(e.id,t)},"setNodeElem"),eZ=v(()=>{l5.clear()},"clear"),Jv=v(t=>{let e=l5.get(t.id);re.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");let r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode")});function ey(t,e){if(t===void 0||e===void 0)return{angle:0,deltaX:0,deltaY:0};t=Pn(t),e=Pn(e);let[r,n]=[t.x,t.y],[i,a]=[e.x,e.y],s=i-r,o=a-n;return{angle:Math.atan(o/s),deltaX:s,deltaY:o}}var No,Pn,c5,pc=F(()=>{or();No={aggregation:18,extension:18,composition:18,dependency:6,lollipop:13.5,arrow_point:4};v(ey,"calculateDeltaAndAngle");Pn=v(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),c5=v(t=>({x:v(function(e,r,n){let i=0,a=Pn(n[0]).x=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(No,t.arrowTypeEnd)){let{angle:p,deltaX:g}=ey(n[n.length-1],n[n.length-2]);i=No[t.arrowTypeEnd]*Math.cos(p)*(g>=0?1:-1)}let s=Math.abs(Pn(e).x-Pn(n[n.length-1]).x),o=Math.abs(Pn(e).y-Pn(n[n.length-1]).y),l=Math.abs(Pn(e).x-Pn(n[0]).x),u=Math.abs(Pn(e).y-Pn(n[0]).y),h=No[t.arrowTypeStart],f=No[t.arrowTypeEnd],d=1;if(s0&&o0&&u=0?1:-1)}else if(r===n.length-1&&Object.hasOwn(No,t.arrowTypeEnd)){let{angle:p,deltaY:g}=ey(n[n.length-1],n[n.length-2]);i=No[t.arrowTypeEnd]*Math.abs(Math.sin(p))*(g>=0?1:-1)}let s=Math.abs(Pn(e).y-Pn(n[n.length-1]).y),o=Math.abs(Pn(e).x-Pn(n[n.length-1]).x),l=Math.abs(Pn(e).y-Pn(n[0]).y),u=Math.abs(Pn(e).x-Pn(n[0]).x),h=No[t.arrowTypeStart],f=No[t.arrowTypeEnd],d=1;if(s0&&o0&&u5&&Math.abs(a.y-i.y)>5||i.y===a.y&&a.x===s.x&&Math.abs(a.x-i.x)>5&&Math.abs(a.y-s.y)>5)&&(e.push(a),r.push(n))}return{cornerPoints:e,cornerPointPositions:r}}var K6e,Z6e,tZ,u5,ca,iZ,ty,h5,f5,Q6e,J6e,rZ,nZ,eEe,d5,tEe,rEe,nEe,iEe,aEe,sEe,oEe,lEe,cEe,uEe,hEe,p5,_u=F(()=>{yl();pc();bo();Ya();kn();or();lr();$t();K6e=v((t,e,r,n,i)=>{e.arrowTypeStart&&tZ(t,"start",e.arrowTypeStart,r,n,i),e.arrowTypeEnd&&tZ(t,"end",e.arrowTypeEnd,r,n,i)},"addEdgeMarkers"),Z6e={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},tZ=v((t,e,r,n,i,a)=>{let s=Z6e[r];if(!s){re.warn(`Unknown arrow type: ${r}`);return}let o=e==="start"?"Start":"End";t.attr(`marker-${e}`,`url(${n}#${i}_${a}-${s}${o})`)},"addEdgeMarker"),u5=new Map,ca=new Map,iZ=v(()=>{u5.clear(),ca.clear()},"clear"),ty=v(t=>t?t.reduce((r,n)=>r+";"+n,""):"","getLabelStyles"),h5=v(async(t,e)=>{let r=Wr(pe().flowchart.htmlLabels),n=await oa(t,e.label,{style:ty(e.labelStyle),useHtmlLabels:r,addSvgBackground:!0,isNode:!1});re.info("abc82",e,e.labelType);let i=t.insert("g").attr("class","edgeLabel"),a=i.insert("g").attr("class","label");a.node().appendChild(n);let s=n.getBBox();if(r){let l=n.children[0],u=Ve(n);s=l.getBoundingClientRect(),u.attr("width",s.width),u.attr("height",s.height)}a.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),u5.set(e.id,i),e.width=s.width,e.height=s.height;let o;if(e.startLabelLeft){let l=await Ph(e.startLabelLeft,ty(e.labelStyle)),u=t.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");o=h.node().appendChild(l);let f=l.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),ca.get(e.id)||ca.set(e.id,{}),ca.get(e.id).startLeft=u,ry(o,e.startLabelLeft)}if(e.startLabelRight){let l=await Ph(e.startLabelRight,ty(e.labelStyle)),u=t.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");o=u.node().appendChild(l),h.node().appendChild(l);let f=l.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),ca.get(e.id)||ca.set(e.id,{}),ca.get(e.id).startRight=u,ry(o,e.startLabelRight)}if(e.endLabelLeft){let l=await Ph(e.endLabelLeft,ty(e.labelStyle)),u=t.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");o=h.node().appendChild(l);let f=l.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(l),ca.get(e.id)||ca.set(e.id,{}),ca.get(e.id).endLeft=u,ry(o,e.endLabelLeft)}if(e.endLabelRight){let l=await Ph(e.endLabelRight,ty(e.labelStyle)),u=t.insert("g").attr("class","edgeTerminals"),h=u.insert("g").attr("class","inner");o=h.node().appendChild(l);let f=l.getBBox();h.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.node().appendChild(l),ca.get(e.id)||ca.set(e.id,{}),ca.get(e.id).endRight=u,ry(o,e.endLabelRight)}return n},"insertEdgeLabel");v(ry,"setTerminalWidth");f5=v((t,e)=>{re.debug("Moving label abc88 ",t.id,t.label,u5.get(t.id),e);let r=e.updatedPath?e.updatedPath:e.originalPath,n=pe(),{subGraphTitleTotalMargin:i}=ou(n);if(t.label){let a=u5.get(t.id),s=t.x,o=t.y;if(r){let l=Ut.calcLabelPosition(r);re.debug("Moving label "+t.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(t.startLabelLeft){let a=ca.get(t.id).startLeft,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.startLabelRight){let a=ca.get(t.id).startRight,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.endLabelLeft){let a=ca.get(t.id).endLeft,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.endLabelRight){let a=ca.get(t.id).endRight,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),Q6e=v((t,e)=>{let r=t.x,n=t.y,i=Math.abs(e.x-r),a=Math.abs(e.y-n),s=t.width/2,o=t.height/2;return i>=s||a>=o},"outsideNode"),J6e=v((t,e,r)=>{re.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(e)} insidePoint : ${JSON.stringify(r)} node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);let n=t.x,i=t.y,a=Math.abs(n-r.x),s=t.width/2,o=r.xMath.abs(n-e.x)*l){let f=r.y{re.warn("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(a=>{if(re.info("abc88 checking point",a,e),!Q6e(e,a)&&!i){let s=J6e(e,n,a);re.debug("abc88 inside",a,n,s),re.debug("abc88 intersection",s,e);let o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)?re.warn("abc88 no intersect",s,r):r.push(s),i=!0}else re.warn("abc88 outside",a,n),n=a,i||r.push(a)}),re.debug("returning points",r),r},"cutPathAtIntersect");v(aZ,"extractCornerPoints");nZ=v(function(t,e,r){let n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),s=r/a;return{x:e.x-s*n,y:e.y-s*i}},"findAdjacentPoint"),eEe=v(function(t){let{cornerPointPositions:e}=aZ(t),r=[];for(let n=0;n10&&Math.abs(a.y-i.y)>=10){re.debug("Corner point fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));let p=5;s.x===o.x?d={x:u<0?o.x-p+f:o.x+p-f,y:h<0?o.y-f:o.y+f}:d={x:u<0?o.x-f:o.x+f,y:h<0?o.y-p+f:o.y+p-f}}else re.debug("Corner point skipping fixing",Math.abs(a.x-i.x),Math.abs(a.y-i.y));r.push(d,l)}else r.push(t[n]);return r},"fixCorners"),d5=v(function(t,e,r,n,i,a,s){let{handDrawnSeed:o}=pe(),l=e.points,u=!1,h=i;var f=a;f.intersect&&h.intersect&&(l=l.slice(1,e.points.length-1),l.unshift(h.intersect(l[0])),re.debug("Last point APA12",e.start,"-->",e.end,l[l.length-1],f,f.intersect(l[l.length-1])),l.push(f.intersect(l[l.length-1]))),e.toCluster&&(re.info("to cluster abc88",r.get(e.toCluster)),l=rZ(e.points,r.get(e.toCluster).node),u=!0),e.fromCluster&&(re.debug("from cluster abc88",r.get(e.fromCluster),JSON.stringify(l,null,2)),l=rZ(l.reverse(),r.get(e.fromCluster).node).reverse(),u=!0);let d=l.filter(L=>!Number.isNaN(L.y));d=eEe(d);let p=gl;e.curve&&(p=e.curve);let{x:g,y:m}=c5(e),y=ms().x(g).y(m).curve(p),x;switch(e.thickness){case"normal":x="edge-thickness-normal";break;case"thick":x="edge-thickness-thick";break;case"invisible":x="edge-thickness-invisible";break;default:x="edge-thickness-normal"}switch(e.pattern){case"solid":x+=" edge-pattern-solid";break;case"dotted":x+=" edge-pattern-dotted";break;case"dashed":x+=" edge-pattern-dashed";break;default:x+=" edge-pattern-solid"}let b,w=y(d),_=Array.isArray(e.style)?e.style:[e.style];if(e.look==="handDrawn"){let L=Ye.svg(t);Object.assign([],d);let S=L.path(w,{roughness:.3,seed:o});x+=" transition",b=Ve(S).select("path").attr("id",e.id).attr("class"," "+x+(e.classes?" "+e.classes:"")).attr("style",_?_.reduce((M,R)=>M+";"+R,""):"");let C=b.attr("d");b.attr("d",C),t.node().appendChild(b.node())}else b=t.append("path").attr("d",w).attr("id",e.id).attr("class"," "+x+(e.classes?" "+e.classes:"")).attr("style",_?_.reduce((L,S)=>L+";"+S,""):"");let k="";(pe().flowchart.arrowMarkerAbsolute||pe().state.arrowMarkerAbsolute)&&(k=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,k=k.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),re.info("arrowTypeStart",e.arrowTypeStart),re.info("arrowTypeEnd",e.arrowTypeEnd),K6e(b,e,k,s,n);let E={};return u&&(E.updatedPath=l),E.originalPath=e.points,E},"insertEdge"),tEe=v((t,e,r,n)=>{e.forEach(i=>{hEe[i](t,r,n)})},"insertMarkers"),rEe=v((t,e,r)=>{re.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),nEe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),iEe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),aEe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),sEe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),oEe=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),lEe=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),cEe=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),uEe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),hEe={extension:rEe,composition:nEe,aggregation:iEe,dependency:aEe,lollipop:sEe,point:oEe,circle:lEe,cross:cEe,barb:uEe},p5=tEe});function dEe(t){return typeof t=="symbol"||qn(t)&&sa(t)==fEe}var fEe,Zs,kd=F(()=>{yu();So();fEe="[object Symbol]";Zs=dEe});function pEe(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r{Ts=pEe});function lZ(t){if(typeof t=="string")return t;if(Et(t))return Ts(t,lZ)+"";if(Zs(t))return oZ?oZ.call(t):"";var e=t+"";return e=="0"&&1/t==-gEe?"-0":e}var gEe,sZ,oZ,cZ,uZ=F(()=>{hd();Td();On();kd();gEe=1/0,sZ=Hi?Hi.prototype:void 0,oZ=sZ?sZ.toString:void 0;cZ=lZ});function vEe(t){for(var e=t.length;e--&&mEe.test(t.charAt(e)););return e}var mEe,hZ,fZ=F(()=>{mEe=/\s/;hZ=vEe});function xEe(t){return t&&t.slice(0,hZ(t)+1).replace(yEe,"")}var yEe,dZ,pZ=F(()=>{fZ();yEe=/^\s+/;dZ=xEe});function EEe(t){if(typeof t=="number")return t;if(Zs(t))return gZ;if(dn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=dn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=dZ(t);var r=wEe.test(t);return r||kEe.test(t)?TEe(t.slice(2),r?2:8):bEe.test(t)?gZ:+t}var gZ,bEe,wEe,kEe,TEe,mZ,vZ=F(()=>{pZ();qs();kd();gZ=NaN,bEe=/^[-+]0x[0-9a-f]+$/i,wEe=/^0b[01]+$/i,kEe=/^0o[0-7]+$/i,TEe=parseInt;mZ=EEe});function CEe(t){if(!t)return t===0?t:0;if(t=mZ(t),t===yZ||t===-yZ){var e=t<0?-1:1;return e*SEe}return t===t?t:0}var yZ,SEe,rg,HA=F(()=>{vZ();yZ=1/0,SEe=17976931348623157e292;rg=CEe});function AEe(t){var e=rg(t),r=e%1;return e===e?r?e-r:e:0}var gc,ng=F(()=>{HA();gc=AEe});var _Ee,g5,xZ=F(()=>{Sh();To();_Ee=vs(Qn,"WeakMap"),g5=_Ee});function LEe(){}var Yn,qA=F(()=>{Yn=LEe});function REe(t,e){for(var r=-1,n=t==null?0:t.length;++r{m5=REe});function NEe(t,e,r,n){for(var i=t.length,a=r+(n?1:-1);n?a--:++a{v5=NEe});function IEe(t){return t!==t}var bZ,wZ=F(()=>{bZ=IEe});function MEe(t,e,r){for(var n=r-1,i=t.length;++n{kZ=MEe});function DEe(t,e,r){return e===e?kZ(t,e,r):v5(t,bZ,r)}var ig,y5=F(()=>{XA();wZ();TZ();ig=DEe});function OEe(t,e){var r=t==null?0:t.length;return!!r&&ig(t,e,0)>-1}var x5,jA=F(()=>{y5();x5=OEe});var PEe,EZ,SZ=F(()=>{Y8();PEe=R3(Object.keys,Object),EZ=PEe});function zEe(t){if(!hc(t))return EZ(t);var e=[];for(var r in Object(t))FEe.call(t,r)&&r!="constructor"&&e.push(r);return e}var BEe,FEe,ag,b5=F(()=>{Up();SZ();BEe=Object.prototype,FEe=BEe.hasOwnProperty;ag=zEe});function $Ee(t){return Jn(t)?O3(t):ag(t)}var Nr,mc=F(()=>{Q8();b5();Co();Nr=$Ee});var GEe,UEe,VEe,ua,CZ=F(()=>{qp();md();rA();Co();Up();mc();GEe=Object.prototype,UEe=GEe.hasOwnProperty,VEe=F3(function(t,e){if(hc(e)||Jn(e)){Lo(e,Nr(e),t);return}for(var r in e)UEe.call(e,r)&&fc(t,r,e[r])}),ua=VEe});function qEe(t,e){if(Et(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Zs(t)?!0:HEe.test(t)||!WEe.test(t)||e!=null&&t in Object(e)}var WEe,HEe,sg,w5=F(()=>{On();kd();WEe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,HEe=/^\w*$/;sg=qEe});function XEe(t){var e=Dp(t,function(n){return r.size===YEe&&r.clear(),n}),r=e.cache;return e}var YEe,AZ,_Z=F(()=>{$8();YEe=500;AZ=XEe});var jEe,KEe,ZEe,LZ,RZ=F(()=>{_Z();jEe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,KEe=/\\(\\)?/g,ZEe=AZ(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(jEe,function(r,n,i,a){e.push(i?a.replace(KEe,"$1"):n||r)}),e}),LZ=ZEe});function QEe(t){return t==null?"":cZ(t)}var k5,KA=F(()=>{uZ();k5=QEe});function JEe(t,e){return Et(t)?t:sg(t,e)?[t]:LZ(k5(t))}var Bh,ny=F(()=>{On();w5();RZ();KA();Bh=JEe});function tSe(t){if(typeof t=="string"||Zs(t))return t;var e=t+"";return e=="0"&&1/t==-eSe?"-0":e}var eSe,vc,og=F(()=>{kd();eSe=1/0;vc=tSe});function rSe(t,e){e=Bh(e,t);for(var r=0,n=e.length;t!=null&&r{ny();og();Fh=rSe});function nSe(t,e,r){var n=t==null?void 0:Fh(t,e);return n===void 0?r:n}var NZ,IZ=F(()=>{iy();NZ=nSe});function iSe(t,e){for(var r=-1,n=e.length,i=t.length;++r{lg=iSe});function aSe(t){return Et(t)||ml(t)||!!(MZ&&t&&t[MZ])}var MZ,DZ,OZ=F(()=>{hd();Vp();On();MZ=Hi?Hi.isConcatSpreadable:void 0;DZ=aSe});function PZ(t,e,r,n,i){var a=-1,s=t.length;for(r||(r=DZ),i||(i=[]);++a0&&r(o)?e>1?PZ(o,e-1,r,n,i):lg(i,o):n||(i[i.length]=o)}return i}var yc,cg=F(()=>{T5();OZ();yc=PZ});function sSe(t){var e=t==null?0:t.length;return e?yc(t,1):[]}var Br,E5=F(()=>{cg();Br=sSe});function oSe(t){return B3(P3(t,void 0,Br),t+"")}var BZ,FZ=F(()=>{E5();J8();tA();BZ=oSe});function lSe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(i);++n{S5=lSe});function vSe(t){return mSe.test(t)}var cSe,uSe,hSe,fSe,dSe,pSe,gSe,mSe,zZ,$Z=F(()=>{cSe="\\ud800-\\udfff",uSe="\\u0300-\\u036f",hSe="\\ufe20-\\ufe2f",fSe="\\u20d0-\\u20ff",dSe=uSe+hSe+fSe,pSe="\\ufe0e\\ufe0f",gSe="\\u200d",mSe=RegExp("["+gSe+cSe+dSe+pSe+"]");zZ=vSe});function ySe(t,e,r,n){var i=-1,a=t==null?0:t.length;for(n&&a&&(r=t[++i]);++i{GZ=ySe});function xSe(t,e){return t&&Lo(e,Nr(e),t)}var VZ,WZ=F(()=>{md();mc();VZ=xSe});function bSe(t,e){return t&&Lo(e,ys(e),t)}var HZ,qZ=F(()=>{md();Ih();HZ=bSe});function wSe(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r{ug=wSe});function kSe(){return[]}var A5,QA=F(()=>{A5=kSe});var TSe,ESe,YZ,SSe,hg,_5=F(()=>{C5();QA();TSe=Object.prototype,ESe=TSe.propertyIsEnumerable,YZ=Object.getOwnPropertySymbols,SSe=YZ?function(t){return t==null?[]:(t=Object(t),ug(YZ(t),function(e){return ESe.call(t,e)}))}:A5,hg=SSe});function CSe(t,e){return Lo(t,hg(t),e)}var XZ,jZ=F(()=>{md();_5();XZ=CSe});var ASe,_Se,L5,JA=F(()=>{T5();N3();_5();QA();ASe=Object.getOwnPropertySymbols,_Se=ASe?function(t){for(var e=[];t;)lg(e,hg(t)),t=Gp(t);return e}:A5,L5=_Se});function LSe(t,e){return Lo(t,L5(t),e)}var KZ,ZZ=F(()=>{md();JA();KZ=LSe});function RSe(t,e,r){var n=e(t);return Et(t)?n:lg(n,r(t))}var R5,e_=F(()=>{T5();On();R5=RSe});function NSe(t){return R5(t,Nr,hg)}var ay,t_=F(()=>{e_();_5();mc();ay=NSe});function ISe(t){return R5(t,ys,L5)}var N5,r_=F(()=>{e_();JA();Ih();N5=ISe});var MSe,I5,QZ=F(()=>{Sh();To();MSe=vs(Qn,"DataView"),I5=MSe});var DSe,M5,JZ=F(()=>{Sh();To();DSe=vs(Qn,"Promise"),M5=DSe});var OSe,zh,n_=F(()=>{Sh();To();OSe=vs(Qn,"Set"),zh=OSe});var eQ,PSe,tQ,rQ,nQ,iQ,BSe,FSe,zSe,$Se,GSe,Ed,Qs,Sd=F(()=>{QZ();T3();JZ();n_();xZ();yu();B8();eQ="[object Map]",PSe="[object Object]",tQ="[object Promise]",rQ="[object Set]",nQ="[object WeakMap]",iQ="[object DataView]",BSe=xu(I5),FSe=xu(_h),zSe=xu(M5),$Se=xu(zh),GSe=xu(g5),Ed=sa;(I5&&Ed(new I5(new ArrayBuffer(1)))!=iQ||_h&&Ed(new _h)!=eQ||M5&&Ed(M5.resolve())!=tQ||zh&&Ed(new zh)!=rQ||g5&&Ed(new g5)!=nQ)&&(Ed=function(t){var e=sa(t),r=e==PSe?t.constructor:void 0,n=r?xu(r):"";if(n)switch(n){case BSe:return iQ;case FSe:return eQ;case zSe:return tQ;case $Se:return rQ;case GSe:return nQ}return e});Qs=Ed});function WSe(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&VSe.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var USe,VSe,aQ,sQ=F(()=>{USe=Object.prototype,VSe=USe.hasOwnProperty;aQ=WSe});function HSe(t,e){var r=e?$p(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var oQ,lQ=F(()=>{A3();oQ=HSe});function YSe(t){var e=new t.constructor(t.source,qSe.exec(t));return e.lastIndex=t.lastIndex,e}var qSe,cQ,uQ=F(()=>{qSe=/\w*$/;cQ=YSe});function XSe(t){return fQ?Object(fQ.call(t)):{}}var hQ,fQ,dQ,pQ=F(()=>{hd();hQ=Hi?Hi.prototype:void 0,fQ=hQ?hQ.valueOf:void 0;dQ=XSe});function pCe(t,e,r){var n=t.constructor;switch(e){case nCe:return $p(t);case jSe:case KSe:return new n(+t);case iCe:return oQ(t,r);case aCe:case sCe:case oCe:case lCe:case cCe:case uCe:case hCe:case fCe:case dCe:return _3(t,r);case ZSe:return new n;case QSe:case tCe:return new n(t);case JSe:return cQ(t);case eCe:return new n;case rCe:return dQ(t)}}var jSe,KSe,ZSe,QSe,JSe,eCe,tCe,rCe,nCe,iCe,aCe,sCe,oCe,lCe,cCe,uCe,hCe,fCe,dCe,gQ,mQ=F(()=>{A3();lQ();uQ();pQ();H8();jSe="[object Boolean]",KSe="[object Date]",ZSe="[object Map]",QSe="[object Number]",JSe="[object RegExp]",eCe="[object Set]",tCe="[object String]",rCe="[object Symbol]",nCe="[object ArrayBuffer]",iCe="[object DataView]",aCe="[object Float32Array]",sCe="[object Float64Array]",oCe="[object Int8Array]",lCe="[object Int16Array]",cCe="[object Int32Array]",uCe="[object Uint8Array]",hCe="[object Uint8ClampedArray]",fCe="[object Uint16Array]",dCe="[object Uint32Array]";gQ=pCe});function mCe(t){return qn(t)&&Qs(t)==gCe}var gCe,vQ,yQ=F(()=>{Sd();So();gCe="[object Map]";vQ=mCe});var xQ,vCe,bQ,wQ=F(()=>{yQ();gd();Bv();xQ=_o&&_o.isMap,vCe=xQ?Ao(xQ):vQ,bQ=vCe});function xCe(t){return qn(t)&&Qs(t)==yCe}var yCe,kQ,TQ=F(()=>{Sd();So();yCe="[object Set]";kQ=xCe});var EQ,bCe,SQ,CQ=F(()=>{TQ();gd();Bv();EQ=_o&&_o.isSet,bCe=EQ?Ao(EQ):kQ,SQ=bCe});function D5(t,e,r,n,i,a){var s,o=e&wCe,l=e&kCe,u=e&TCe;if(r&&(s=i?r(t,n,i,a):r(t)),s!==void 0)return s;if(!dn(t))return t;var h=Et(t);if(h){if(s=aQ(t),!o)return L3(t,s)}else{var f=Qs(t),d=f==_Q||f==_Ce;if(vl(t))return C3(t,o);if(f==LQ||f==AQ||d&&!i){if(s=l||d?{}:I3(t),!o)return l?KZ(t,HZ(s,t)):XZ(t,VZ(s,t))}else{if(!Tn[f])return i?t:{};s=gQ(t,f,o)}}a||(a=new cc);var p=a.get(t);if(p)return p;a.set(t,s),SQ(t)?t.forEach(function(y){s.add(D5(y,e,r,y,t,a))}):bQ(t)&&t.forEach(function(y,x){s.set(x,D5(y,e,r,x,t,a))});var g=u?l?N5:ay:l?ys:Nr,m=h?void 0:g(t);return m5(m||t,function(y,x){m&&(x=y,y=t[x]),fc(s,x,D5(y,e,r,x,t,a))}),s}var wCe,kCe,TCe,AQ,ECe,SCe,CCe,ACe,_Q,_Ce,LCe,RCe,LQ,NCe,ICe,MCe,DCe,OCe,PCe,BCe,FCe,zCe,$Ce,GCe,UCe,VCe,WCe,HCe,qCe,Tn,O5,i_=F(()=>{Dv();YA();qp();WZ();qZ();V8();q8();jZ();ZZ();t_();r_();Sd();sQ();mQ();X8();On();Hp();wQ();qs();CQ();mc();Ih();wCe=1,kCe=2,TCe=4,AQ="[object Arguments]",ECe="[object Array]",SCe="[object Boolean]",CCe="[object Date]",ACe="[object Error]",_Q="[object Function]",_Ce="[object GeneratorFunction]",LCe="[object Map]",RCe="[object Number]",LQ="[object Object]",NCe="[object RegExp]",ICe="[object Set]",MCe="[object String]",DCe="[object Symbol]",OCe="[object WeakMap]",PCe="[object ArrayBuffer]",BCe="[object DataView]",FCe="[object Float32Array]",zCe="[object Float64Array]",$Ce="[object Int8Array]",GCe="[object Int16Array]",UCe="[object Int32Array]",VCe="[object Uint8Array]",WCe="[object Uint8ClampedArray]",HCe="[object Uint16Array]",qCe="[object Uint32Array]",Tn={};Tn[AQ]=Tn[ECe]=Tn[PCe]=Tn[BCe]=Tn[SCe]=Tn[CCe]=Tn[FCe]=Tn[zCe]=Tn[$Ce]=Tn[GCe]=Tn[UCe]=Tn[LCe]=Tn[RCe]=Tn[LQ]=Tn[NCe]=Tn[ICe]=Tn[MCe]=Tn[DCe]=Tn[VCe]=Tn[WCe]=Tn[HCe]=Tn[qCe]=!0;Tn[ACe]=Tn[_Q]=Tn[OCe]=!1;O5=D5});function XCe(t){return O5(t,YCe)}var YCe,jr,a_=F(()=>{i_();YCe=4;jr=XCe});function ZCe(t){return O5(t,jCe|KCe)}var jCe,KCe,s_,RQ=F(()=>{i_();jCe=1,KCe=4;s_=ZCe});function QCe(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e{xc=QCe});function e7e(t){return this.__data__.set(t,JCe),this}var JCe,IQ,MQ=F(()=>{JCe="__lodash_hash_undefined__";IQ=e7e});function t7e(t){return this.__data__.has(t)}var DQ,OQ=F(()=>{DQ=t7e});function P5(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new dd;++e{E3();MQ();OQ();P5.prototype.add=P5.prototype.push=IQ;P5.prototype.has=DQ;fg=P5});function r7e(t,e){for(var r=-1,n=t==null?0:t.length;++r{F5=r7e});function n7e(t,e){return t.has(e)}var dg,z5=F(()=>{dg=n7e});function s7e(t,e,r,n,i,a){var s=r&i7e,o=t.length,l=e.length;if(o!=l&&!(s&&l>o))return!1;var u=a.get(t),h=a.get(e);if(u&&h)return u==e&&h==t;var f=-1,d=!0,p=r&a7e?new fg:void 0;for(a.set(t,e),a.set(e,t);++f{B5();o_();z5();i7e=1,a7e=2;$5=s7e});function o7e(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var PQ,BQ=F(()=>{PQ=o7e});function l7e(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var pg,G5=F(()=>{pg=l7e});function k7e(t,e,r,n,i,a,s){switch(r){case w7e:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case b7e:return!(t.byteLength!=e.byteLength||!a(new zp(t),new zp(e)));case h7e:case f7e:case g7e:return Eo(+t,+e);case d7e:return t.name==e.name&&t.message==e.message;case m7e:case y7e:return t==e+"";case p7e:var o=PQ;case v7e:var l=n&c7e;if(o||(o=pg),t.size!=e.size&&!l)return!1;var u=s.get(t);if(u)return u==e;n|=u7e,s.set(t,e);var h=$5(o(t),o(e),n,i,a,s);return s.delete(t),h;case x7e:if(c_)return c_.call(t)==c_.call(e)}return!1}var c7e,u7e,h7e,f7e,d7e,p7e,g7e,m7e,v7e,y7e,x7e,b7e,w7e,FQ,c_,zQ,$Q=F(()=>{hd();W8();fd();l_();BQ();G5();c7e=1,u7e=2,h7e="[object Boolean]",f7e="[object Date]",d7e="[object Error]",p7e="[object Map]",g7e="[object Number]",m7e="[object RegExp]",v7e="[object Set]",y7e="[object String]",x7e="[object Symbol]",b7e="[object ArrayBuffer]",w7e="[object DataView]",FQ=Hi?Hi.prototype:void 0,c_=FQ?FQ.valueOf:void 0;zQ=k7e});function C7e(t,e,r,n,i,a){var s=r&T7e,o=ay(t),l=o.length,u=ay(e),h=u.length;if(l!=h&&!s)return!1;for(var f=l;f--;){var d=o[f];if(!(s?d in e:S7e.call(e,d)))return!1}var p=a.get(t),g=a.get(e);if(p&&g)return p==e&&g==t;var m=!0;a.set(t,e),a.set(e,t);for(var y=s;++f{t_();T7e=1,E7e=Object.prototype,S7e=E7e.hasOwnProperty;GQ=C7e});function L7e(t,e,r,n,i,a){var s=Et(t),o=Et(e),l=s?WQ:Qs(t),u=o?WQ:Qs(e);l=l==VQ?U5:l,u=u==VQ?U5:u;var h=l==U5,f=u==U5,d=l==u;if(d&&vl(t)){if(!vl(e))return!1;s=!0,h=!1}if(d&&!h)return a||(a=new cc),s||Rh(t)?$5(t,e,r,n,i,a):zQ(t,e,l,r,n,i,a);if(!(r&A7e)){var p=h&&HQ.call(t,"__wrapped__"),g=f&&HQ.call(e,"__wrapped__");if(p||g){var m=p?t.value():t,y=g?e.value():e;return a||(a=new cc),i(m,y,r,n,a)}}return d?(a||(a=new cc),GQ(t,e,r,n,i,a)):!1}var A7e,VQ,WQ,U5,_7e,HQ,qQ,YQ=F(()=>{Dv();l_();$Q();UQ();Sd();On();Hp();Fv();A7e=1,VQ="[object Arguments]",WQ="[object Array]",U5="[object Object]",_7e=Object.prototype,HQ=_7e.hasOwnProperty;qQ=L7e});function XQ(t,e,r,n,i){return t===e?!0:t==null||e==null||!qn(t)&&!qn(e)?t!==t&&e!==e:qQ(t,e,r,n,XQ,i)}var V5,u_=F(()=>{YQ();So();V5=XQ});function I7e(t,e,r,n){var i=r.length,a=i,s=!n;if(t==null)return!a;for(t=Object(t);i--;){var o=r[i];if(s&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++i{Dv();u_();R7e=1,N7e=2;jQ=I7e});function M7e(t){return t===t&&!dn(t)}var W5,h_=F(()=>{qs();W5=M7e});function D7e(t){for(var e=Nr(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,W5(i)]}return e}var ZQ,QQ=F(()=>{h_();mc();ZQ=D7e});function O7e(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var H5,f_=F(()=>{H5=O7e});function P7e(t){var e=ZQ(t);return e.length==1&&e[0][2]?H5(e[0][0],e[0][1]):function(r){return r===t||jQ(r,t,e)}}var JQ,eJ=F(()=>{KQ();QQ();f_();JQ=P7e});function B7e(t,e){return t!=null&&e in Object(t)}var tJ,rJ=F(()=>{tJ=B7e});function F7e(t,e,r){e=Bh(e,t);for(var n=-1,i=e.length,a=!1;++n{ny();Vp();On();$v();M3();og();q5=F7e});function z7e(t,e){return t!=null&&q5(t,e,tJ)}var Y5,p_=F(()=>{rJ();d_();Y5=z7e});function U7e(t,e){return sg(t)&&W5(e)?H5(vc(t),e):function(r){var n=NZ(r,t);return n===void 0&&n===e?Y5(r,t):V5(e,n,$7e|G7e)}}var $7e,G7e,nJ,iJ=F(()=>{u_();IZ();p_();w5();h_();f_();og();$7e=1,G7e=2;nJ=U7e});function V7e(t){return function(e){return e?.[t]}}var X5,g_=F(()=>{X5=V7e});function W7e(t){return function(e){return Fh(e,t)}}var aJ,sJ=F(()=>{iy();aJ=W7e});function H7e(t){return sg(t)?X5(vc(t)):aJ(t)}var oJ,lJ=F(()=>{g_();sJ();w5();og();oJ=H7e});function q7e(t){return typeof t=="function"?t:t==null?qi:typeof t=="object"?Et(t)?nJ(t[0],t[1]):JQ(t):oJ(t)}var on,Xa=F(()=>{eJ();iJ();wu();On();lJ();on=q7e});function Y7e(t,e,r,n){for(var i=-1,a=t==null?0:t.length;++i{cJ=Y7e});function X7e(t,e){return t&&Fp(t,e,Nr)}var gg,j5=F(()=>{S3();mc();gg=X7e});function j7e(t,e){return function(r,n){if(r==null)return r;if(!Jn(r))return t(r,n);for(var i=r.length,a=e?i:-1,s=Object(r);(e?a--:++a{Co();hJ=j7e});var K7e,Es,$h=F(()=>{j5();fJ();K7e=hJ(gg),Es=K7e});function Z7e(t,e,r,n){return Es(t,function(i,a,s){e(n,i,r(i),s)}),n}var dJ,pJ=F(()=>{$h();dJ=Z7e});function Q7e(t,e){return function(r,n){var i=Et(r)?cJ:dJ,a=e?e():{};return i(r,t,on(n,2),a)}}var gJ,mJ=F(()=>{uJ();pJ();Xa();On();gJ=Q7e});var J7e,K5,vJ=F(()=>{To();J7e=function(){return Qn.Date.now()},K5=J7e});var yJ,e8e,t8e,Gh,xJ=F(()=>{Yp();fd();vd();Ih();yJ=Object.prototype,e8e=yJ.hasOwnProperty,t8e=dc(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Ys(e[0],e[1],i)&&(n=1);++r{Z5=r8e});function i8e(t,e,r,n){var i=-1,a=x5,s=!0,o=t.length,l=[],u=e.length;if(!o)return l;r&&(e=Ts(e,Ao(r))),n?(a=Z5,s=!1):e.length>=n8e&&(a=dg,s=!1,e=new fg(e));e:for(;++i{B5();jA();m_();Td();gd();z5();n8e=200;bJ=i8e});var a8e,Uh,kJ=F(()=>{wJ();cg();Yp();D3();a8e=dc(function(t,e){return pd(t)?bJ(t,yc(e,1,pd,!0)):[]}),Uh=a8e});function s8e(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ha,TJ=F(()=>{ha=s8e});function o8e(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:gc(e),S5(t,e<0?0:e,n)):[]}var li,EJ=F(()=>{ZA();ng();li=o8e});function l8e(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:gc(e),e=n-e,S5(t,0,e<0?0:e)):[]}var Lu,SJ=F(()=>{ZA();ng();Lu=l8e});function c8e(t){return typeof t=="function"?t:qi}var mg,Q5=F(()=>{wu();mg=c8e});function u8e(t,e){var r=Et(t)?m5:Es;return r(t,mg(e))}var Te,J5=F(()=>{YA();$h();Q5();On();Te=u8e});var CJ=F(()=>{J5()});function h8e(t,e){for(var r=-1,n=t==null?0:t.length;++r{AJ=h8e});function f8e(t,e){var r=!0;return Es(t,function(n,i,a){return r=!!e(n,i,a),r}),r}var LJ,RJ=F(()=>{$h();LJ=f8e});function d8e(t,e,r){var n=Et(t)?AJ:LJ;return r&&Ys(t,e,r)&&(e=void 0),n(t,on(e,3))}var _a,NJ=F(()=>{_J();RJ();Xa();On();vd();_a=d8e});function p8e(t,e){var r=[];return Es(t,function(n,i,a){e(n,i,a)&&r.push(n)}),r}var ew,v_=F(()=>{$h();ew=p8e});function g8e(t,e){var r=Et(t)?ug:ew;return r(t,on(e,3))}var Fr,y_=F(()=>{C5();v_();Xa();On();Fr=g8e});function m8e(t){return function(e,r,n){var i=Object(e);if(!Jn(e)){var a=on(r,3);e=Nr(e),r=function(o){return a(i[o],o,i)}}var s=t(e,r,n);return s>-1?i[a?e[s]:s]:void 0}}var IJ,MJ=F(()=>{Xa();Co();mc();IJ=m8e});function y8e(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:gc(r);return i<0&&(i=v8e(n+i,0)),v5(t,on(e,3),i)}var v8e,DJ,OJ=F(()=>{XA();Xa();ng();v8e=Math.max;DJ=y8e});var x8e,ja,PJ=F(()=>{MJ();OJ();x8e=IJ(DJ),ja=x8e});function b8e(t){return t&&t.length?t[0]:void 0}var Yi,BJ=F(()=>{Yi=b8e});var FJ=F(()=>{BJ()});function w8e(t,e){var r=-1,n=Jn(t)?Array(t.length):[];return Es(t,function(i,a,s){n[++r]=e(i,a,s)}),n}var tw,x_=F(()=>{$h();Co();tw=w8e});function k8e(t,e){var r=Et(t)?Ts:tw;return r(t,on(e,3))}var je,vg=F(()=>{Td();Xa();x_();On();je=k8e});function T8e(t,e){return yc(je(t,e),1)}var fa,b_=F(()=>{cg();vg();fa=T8e});function E8e(t,e){return t==null?t:Fp(t,mg(e),ys)}var w_,zJ=F(()=>{S3();Q5();Ih();w_=E8e});function S8e(t,e){return t&&gg(t,mg(e))}var k_,$J=F(()=>{j5();Q5();k_=S8e});var C8e,A8e,_8e,T_,GJ=F(()=>{Bp();mJ();C8e=Object.prototype,A8e=C8e.hasOwnProperty,_8e=gJ(function(t,e,r){A8e.call(t,r)?t[r].push(e):uc(t,r,[e])}),T_=_8e});function L8e(t,e){return t>e}var UJ,VJ=F(()=>{UJ=L8e});function I8e(t,e){return t!=null&&N8e.call(t,e)}var R8e,N8e,WJ,HJ=F(()=>{R8e=Object.prototype,N8e=R8e.hasOwnProperty;WJ=I8e});function M8e(t,e){return t!=null&&q5(t,e,WJ)}var St,qJ=F(()=>{HJ();d_();St=M8e});function O8e(t){return typeof t=="string"||!Et(t)&&qn(t)&&sa(t)==D8e}var D8e,ci,rw=F(()=>{yu();On();So();D8e="[object String]";ci=O8e});function P8e(t,e){return Ts(e,function(r){return t[r]})}var YJ,XJ=F(()=>{Td();YJ=P8e});function B8e(t){return t==null?[]:YJ(t,Nr(t))}var fr,E_=F(()=>{XJ();mc();fr=B8e});function z8e(t,e,r,n){t=Jn(t)?t:fr(t),r=r&&!n?gc(r):0;var i=t.length;return r<0&&(r=F8e(i+r,0)),ci(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&ig(t,e,r)>-1}var F8e,Bn,jJ=F(()=>{y5();Co();rw();ng();E_();F8e=Math.max;Bn=z8e});function G8e(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:gc(r);return i<0&&(i=$8e(n+i,0)),ig(t,e,i)}var $8e,nw,KJ=F(()=>{y5();ng();$8e=Math.max;nw=G8e});function q8e(t){if(t==null)return!0;if(Jn(t)&&(Et(t)||typeof t=="string"||typeof t.splice=="function"||vl(t)||Rh(t)||ml(t)))return!t.length;var e=Qs(t);if(e==U8e||e==V8e)return!t.size;if(hc(t))return!ag(t).length;for(var r in t)if(H8e.call(t,r))return!1;return!0}var U8e,V8e,W8e,H8e,ir,iw=F(()=>{b5();Sd();Vp();On();Co();Hp();Up();Fv();U8e="[object Map]",V8e="[object Set]",W8e=Object.prototype,H8e=W8e.hasOwnProperty;ir=q8e});function X8e(t){return qn(t)&&sa(t)==Y8e}var Y8e,ZJ,QJ=F(()=>{yu();So();Y8e="[object RegExp]";ZJ=X8e});var JJ,j8e,Io,eee=F(()=>{QJ();gd();Bv();JJ=_o&&_o.isRegExp,j8e=JJ?Ao(JJ):ZJ,Io=j8e});function K8e(t){return t===void 0}var ar,tee=F(()=>{ar=K8e});function Z8e(t,e){return t{aw=Z8e});function Q8e(t,e){var r={};return e=on(e,3),gg(t,function(n,i,a){uc(r,i,e(n,i,a))}),r}var Cd,ree=F(()=>{Bp();j5();Xa();Cd=Q8e});function J8e(t,e,r){for(var n=-1,i=t.length;++n{kd();yg=J8e});function eAe(t){return t&&t.length?yg(t,qi,UJ):void 0}var Ss,nee=F(()=>{sw();VJ();wu();Ss=eAe});function tAe(t){return t&&t.length?yg(t,qi,aw):void 0}var xl,C_=F(()=>{sw();S_();wu();xl=tAe});function rAe(t,e){return t&&t.length?yg(t,on(e,2),aw):void 0}var Ad,iee=F(()=>{sw();Xa();S_();Ad=rAe});function iAe(t){if(typeof t!="function")throw new TypeError(nAe);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var nAe,aee,see=F(()=>{nAe="Expected a function";aee=iAe});function aAe(t,e,r,n){if(!dn(t))return t;e=Bh(e,t);for(var i=-1,a=e.length,s=a-1,o=t;o!=null&&++i{qp();ny();$v();qs();og();oee=aAe});function sAe(t,e,r){for(var n=-1,i=e.length,a={};++n{iy();lee();ny();ow=sAe});function oAe(t,e){if(t==null)return{};var r=Ts(N5(t),function(n){return[n]});return e=on(e),ow(t,r,function(n,i){return e(n,i[0])})}var Cs,cee=F(()=>{Td();Xa();A_();r_();Cs=oAe});function lAe(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}var uee,hee=F(()=>{uee=lAe});function cAe(t,e){if(t!==e){var r=t!==void 0,n=t===null,i=t===t,a=Zs(t),s=e!==void 0,o=e===null,l=e===e,u=Zs(e);if(!o&&!u&&!a&&t>e||a&&s&&l&&!o&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&t{kd();fee=cAe});function uAe(t,e,r){for(var n=-1,i=t.criteria,a=e.criteria,s=i.length,o=r.length;++n=o)return l;var u=r[n];return l*(u=="desc"?-1:1)}}return t.index-e.index}var pee,gee=F(()=>{dee();pee=uAe});function hAe(t,e,r){e.length?e=Ts(e,function(a){return Et(a)?function(s){return Fh(s,a.length===1?a[0]:a)}:a}):e=[qi];var n=-1;e=Ts(e,Ao(on));var i=tw(t,function(a,s,o){var l=Ts(e,function(u){return u(a)});return{criteria:l,index:++n,value:a}});return uee(i,function(a,s){return pee(a,s,r)})}var mee,vee=F(()=>{Td();iy();Xa();x_();hee();gd();gee();wu();On();mee=hAe});var fAe,yee,xee=F(()=>{g_();fAe=X5("length"),yee=fAe});function EAe(t){for(var e=bee.lastIndex=0;bee.test(t);)++e;return e}var wee,dAe,pAe,gAe,mAe,vAe,yAe,__,L_,xAe,kee,Tee,Eee,bAe,See,Cee,wAe,kAe,TAe,bee,Aee,_ee=F(()=>{wee="\\ud800-\\udfff",dAe="\\u0300-\\u036f",pAe="\\ufe20-\\ufe2f",gAe="\\u20d0-\\u20ff",mAe=dAe+pAe+gAe,vAe="\\ufe0e\\ufe0f",yAe="["+wee+"]",__="["+mAe+"]",L_="\\ud83c[\\udffb-\\udfff]",xAe="(?:"+__+"|"+L_+")",kee="[^"+wee+"]",Tee="(?:\\ud83c[\\udde6-\\uddff]){2}",Eee="[\\ud800-\\udbff][\\udc00-\\udfff]",bAe="\\u200d",See=xAe+"?",Cee="["+vAe+"]?",wAe="(?:"+bAe+"(?:"+[kee,Tee,Eee].join("|")+")"+Cee+See+")*",kAe=Cee+See+wAe,TAe="(?:"+[kee+__+"?",__,Tee,Eee,yAe].join("|")+")",bee=RegExp(L_+"(?="+L_+")|"+TAe+kAe,"g");Aee=EAe});function SAe(t){return zZ(t)?Aee(t):yee(t)}var Lee,Ree=F(()=>{xee();$Z();_ee();Lee=SAe});function CAe(t,e){return ow(t,e,function(r,n){return Y5(t,n)})}var Nee,Iee=F(()=>{A_();p_();Nee=CAe});var AAe,_d,Mee=F(()=>{Iee();FZ();AAe=BZ(function(t,e){return t==null?{}:Nee(t,e)}),_d=AAe});function RAe(t,e,r,n){for(var i=-1,a=LAe(_Ae((e-t)/(r||1)),0),s=Array(a);a--;)s[n?a:++i]=t,t+=r;return s}var _Ae,LAe,Dee,Oee=F(()=>{_Ae=Math.ceil,LAe=Math.max;Dee=RAe});function NAe(t){return function(e,r,n){return n&&typeof n!="number"&&Ys(e,r,n)&&(r=n=void 0),e=rg(e),r===void 0?(r=e,e=0):r=rg(r),n=n===void 0?e{Oee();vd();HA();Pee=NAe});var IAe,Mo,Fee=F(()=>{Bee();IAe=Pee(),Mo=IAe});function MAe(t,e,r,n,i){return i(t,function(a,s,o){r=n?(n=!1,a):e(r,a,s,o)}),r}var zee,$ee=F(()=>{zee=MAe});function DAe(t,e,r){var n=Et(t)?GZ:zee,i=arguments.length<3;return n(t,on(e,4),r,i,Es)}var zr,R_=F(()=>{UZ();$h();Xa();$ee();On();zr=DAe});function OAe(t,e){var r=Et(t)?ug:ew;return r(t,aee(on(e,3)))}var Vh,Gee=F(()=>{C5();v_();Xa();On();see();Vh=OAe});function FAe(t){if(t==null)return 0;if(Jn(t))return ci(t)?Lee(t):t.length;var e=Qs(t);return e==PAe||e==BAe?t.size:ag(t).length}var PAe,BAe,N_,Uee=F(()=>{b5();Sd();Co();rw();Ree();PAe="[object Map]",BAe="[object Set]";N_=FAe});function zAe(t,e){var r;return Es(t,function(n,i,a){return r=e(n,i,a),!r}),!!r}var Vee,Wee=F(()=>{$h();Vee=zAe});function $Ae(t,e,r){var n=Et(t)?F5:Vee;return r&&Ys(t,e,r)&&(e=void 0),n(t,on(e,3))}var sy,Hee=F(()=>{o_();Xa();Wee();On();vd();sy=$Ae});var GAe,bc,qee=F(()=>{cg();vee();Yp();vd();GAe=dc(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Ys(t,e[0],e[1])?e=[]:r>2&&Ys(e[0],e[1],e[2])&&(e=[e[0]]),mee(t,yc(e,1),[])}),bc=GAe});var UAe,VAe,Yee,Xee=F(()=>{n_();qA();G5();UAe=1/0,VAe=zh&&1/pg(new zh([,-0]))[1]==UAe?function(t){return new zh(t)}:Yn,Yee=VAe});function HAe(t,e,r){var n=-1,i=x5,a=t.length,s=!0,o=[],l=o;if(r)s=!1,i=Z5;else if(a>=WAe){var u=e?null:Yee(t);if(u)return pg(u);s=!1,i=dg,l=new fg}else l=e?[]:o;e:for(;++n{B5();jA();m_();z5();Xee();G5();WAe=200;xg=HAe});var qAe,I_,jee=F(()=>{cg();Yp();lw();D3();qAe=dc(function(t){return xg(yc(t,1,pd,!0))}),I_=qAe});function YAe(t){return t&&t.length?xg(t):[]}var bg,Kee=F(()=>{lw();bg=YAe});function XAe(t,e){return t&&t.length?xg(t,on(e,2)):[]}var Zee,Qee=F(()=>{Xa();lw();Zee=XAe});function KAe(t){var e=++jAe;return k5(t)+e}var jAe,Ld,Jee=F(()=>{KA();jAe=0;Ld=KAe});function ZAe(t,e,r){for(var n=-1,i=t.length,a=e.length,s={};++n{ete=ZAe});function QAe(t,e){return ete(t||[],e||[],fc)}var cw,rte=F(()=>{qp();tte();cw=QAe});var Ot=F(()=>{CZ();a_();RQ();NQ();eA();xJ();kJ();EJ();SJ();CJ();NJ();y_();PJ();FJ();b_();E5();J5();zJ();$J();GJ();qJ();wu();jJ();KJ();On();iw();Lv();qs();eee();rw();tee();mc();TJ();vg();ree();nee();nA();C_();iee();qA();vJ();Mee();cee();Fee();R_();Gee();Uee();Hee();qee();jee();Kee();Jee();E_();rte();});function ite(t,e){t[e]?t[e]++:t[e]=1}function ate(t,e){--t[e]||delete t[e]}function oy(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+nte+a+nte+(ar(n)?JAe:n)}function e_e(t,e,r,n){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}var o={v:i,w:a};return n&&(o.name=n),o}function M_(t,e){return oy(t,e.v,e.w,e.name)}var JAe,Rd,nte,Sr,uw=F(()=>{Ot();JAe="\0",Rd="\0",nte="",Sr=class{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=xs(void 0),this._defaultEdgeLabelFn=xs(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Rd]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return gi(e)||(e=xs(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Nr(this._nodes)}sources(){var e=this;return Fr(this.nodes(),function(r){return ir(e._in[r])})}sinks(){var e=this;return Fr(this.nodes(),function(r){return ir(e._out[r])})}setNodes(e,r){var n=arguments,i=this;return Te(e,function(a){n.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=Rd,this._children[e]={},this._children[Rd][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var r=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],Te(this.children(e),n=>{this.setParent(n)}),delete this._children[e]),Te(Nr(this._in[e]),r),delete this._in[e],delete this._preds[e],Te(Nr(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ar(r))r=Rd;else{r+="";for(var n=r;!ar(n);n=this.parent(n))if(n===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==Rd)return r}}children(e){if(ar(e)&&(e=Rd),this._isCompound){var r=this._children[e];if(r)return Nr(r)}else{if(e===Rd)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return Nr(r)}successors(e){var r=this._sucs[e];if(r)return Nr(r)}neighbors(e){var r=this.predecessors(e);if(r)return I_(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var n=this;Te(this._nodes,function(s,o){e(o)&&r.setNode(o,s)}),Te(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,n.edge(s))});var i={};function a(s){var o=n.parent(s);return o===void 0||r.hasNode(o)?(i[s]=o,o):o in i?i[o]:a(o)}return this._isCompound&&Te(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(e){return gi(e)||(e=xs(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return fr(this._edgeObjs)}setPath(e,r){var n=this,i=arguments;return zr(e,function(a,s){return i.length>1?n.setEdge(a,s,r):n.setEdge(a,s),s}),this}setEdge(){var e,r,n,i,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(e=s.v,r=s.w,n=s.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=s,r=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,ar(n)||(n=""+n);var o=oy(this._isDirected,e,r,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!ar(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,n);var l=e_e(this._isDirected,e,r,n);return e=l.v,r=l.w,Object.freeze(l),this._edgeObjs[o]=l,ite(this._preds[r],e),ite(this._sucs[e],r),this._in[r][o]=l,this._out[e][o]=l,this._edgeCount++,this}edge(e,r,n){var i=arguments.length===1?M_(this._isDirected,arguments[0]):oy(this._isDirected,e,r,n);return this._edgeLabels[i]}hasEdge(e,r,n){var i=arguments.length===1?M_(this._isDirected,arguments[0]):oy(this._isDirected,e,r,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,r,n){var i=arguments.length===1?M_(this._isDirected,arguments[0]):oy(this._isDirected,e,r,n),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],ate(this._preds[r],e),ate(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var n=this._in[e];if(n){var i=fr(n);return r?Fr(i,function(a){return a.v===r}):i}}outEdges(e,r){var n=this._out[e];if(n){var i=fr(n);return r?Fr(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var n=this.inEdges(e,r);if(n)return n.concat(this.outEdges(e,r))}};Sr.prototype._nodeCount=0;Sr.prototype._edgeCount=0});var As=F(()=>{uw()});function ste(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function t_e(t,e){if(t!=="_next"&&t!=="_prev")return e}var hw,ote=F(()=>{hw=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return ste(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&ste(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,n=r._prev;n!==r;)e.push(JSON.stringify(n,t_e)),n=n._prev;return"["+e.join(", ")+"]"}}});function lte(t,e){if(t.nodeCount()<=1)return[];var r=i_e(t,e||r_e),n=n_e(r.graph,r.buckets,r.zeroIdx);return Br(je(n,function(i){return t.outEdges(i.v,i.w)}))}function n_e(t,e,r){for(var n=[],i=e[e.length-1],a=e[0],s;t.nodeCount();){for(;s=a.dequeue();)D_(t,e,r,s);for(;s=i.dequeue();)D_(t,e,r,s);if(t.nodeCount()){for(var o=e.length-2;o>0;--o)if(s=e[o].dequeue(),s){n=n.concat(D_(t,e,r,s,!0));break}}}return n}function D_(t,e,r,n,i){var a=i?[]:void 0;return Te(t.inEdges(n.v),function(s){var o=t.edge(s),l=t.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,O_(e,r,l)}),Te(t.outEdges(n.v),function(s){var o=t.edge(s),l=s.w,u=t.node(l);u.in-=o,O_(e,r,u)}),t.removeNode(n.v),a}function i_e(t,e){var r=new Sr,n=0,i=0;Te(t.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),Te(t.edges(),function(o){var l=r.edge(o.v,o.w)||0,u=e(o),h=l+u;r.setEdge(o.v,o.w,h),i=Math.max(i,r.node(o.v).out+=u),n=Math.max(n,r.node(o.w).in+=u)});var a=Mo(i+n+3).map(function(){return new hw}),s=n+1;return Te(r.nodes(),function(o){O_(a,s,r.node(o))}),{graph:r,buckets:a,zeroIdx:s}}function O_(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}var r_e,cte=F(()=>{Ot();As();ote();r_e=xs(1)});function ute(t){var e=t.graph().acyclicer==="greedy"?lte(t,r(t)):a_e(t);Te(e,function(n){var i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,Ld("rev"))});function r(n){return function(i){return n.edge(i).weight}}}function a_e(t){var e=[],r={},n={};function i(a){Object.prototype.hasOwnProperty.call(n,a)||(n[a]=!0,r[a]=!0,Te(t.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?e.push(s):i(s.w)}),delete r[a])}return Te(t.nodes(),i),e}function hte(t){Te(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}var P_=F(()=>{Ot();cte()});function wc(t,e,r,n){var i;do i=Ld(n);while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function dte(t){var e=new Sr().setGraph(t.graph());return Te(t.nodes(),function(r){e.setNode(r,t.node(r))}),Te(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},i=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e}function fw(t){var e=new Sr({multigraph:t.isMultigraph()}).setGraph(t.graph());return Te(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),Te(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e}function B_(t,e){var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:r+l,y:n+u}}function Wh(t){var e=je(Mo(z_(t)+1),function(){return[]});return Te(t.nodes(),function(r){var n=t.node(r),i=n.rank;ar(i)||(e[i][n.order]=r)}),e}function pte(t){var e=xl(je(t.nodes(),function(r){return t.node(r).rank}));Te(t.nodes(),function(r){var n=t.node(r);St(n,"rank")&&(n.rank-=e)})}function gte(t){var e=xl(je(t.nodes(),function(a){return t.node(a).rank})),r=[];Te(t.nodes(),function(a){var s=t.node(a).rank-e;r[s]||(r[s]=[]),r[s].push(a)});var n=0,i=t.graph().nodeRankFactor;Te(r,function(a,s){ar(a)&&s%i!==0?--n:n&&Te(a,function(o){t.node(o).rank+=n})})}function F_(t,e,r,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),wc(t,"border",i,e)}function z_(t){return Ss(je(t.nodes(),function(e){var r=t.node(e).rank;if(!ar(r))return r}))}function mte(t,e){var r={lhs:[],rhs:[]};return Te(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r}function vte(t,e){var r=K5();try{return e()}finally{console.log(t+" time: "+(K5()-r)+"ms")}}function yte(t,e){return e()}var kc=F(()=>{Ot();As()});function bte(t){function e(r){var n=t.children(r),i=t.node(r);if(n.length&&Te(n,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a{Ot();kc()});function Tte(t){var e=t.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Ste(t)}function Ete(t){var e=t.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&s_e(t),(e==="lr"||e==="rl")&&(o_e(t),Ste(t))}function Ste(t){Te(t.nodes(),function(e){kte(t.node(e))}),Te(t.edges(),function(e){kte(t.edge(e))})}function kte(t){var e=t.width;t.width=t.height,t.height=e}function s_e(t){Te(t.nodes(),function(e){$_(t.node(e))}),Te(t.edges(),function(e){var r=t.edge(e);Te(r.points,$_),Object.prototype.hasOwnProperty.call(r,"y")&&$_(r)})}function $_(t){t.y=-t.y}function o_e(t){Te(t.nodes(),function(e){G_(t.node(e))}),Te(t.edges(),function(e){var r=t.edge(e);Te(r.points,G_),Object.prototype.hasOwnProperty.call(r,"x")&&G_(r)})}function G_(t){var e=t.x;t.x=t.y,t.y=e}var Cte=F(()=>{Ot()});function Ate(t){t.graph().dummyChains=[],Te(t.edges(),function(e){c_e(t,e)})}function c_e(t,e){var r=e.v,n=t.node(r).rank,i=e.w,a=t.node(i).rank,s=e.name,o=t.edge(e),l=o.labelRank;if(a!==n+1){t.removeEdge(e);var u=void 0,h,f;for(f=0,++n;n{Ot();kc()});function ly(t){var e={};function r(n){var i=t.node(n);if(Object.prototype.hasOwnProperty.call(e,n))return i.rank;e[n]=!0;var a=xl(je(t.outEdges(n),function(s){return r(s.w)-t.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}Te(t.sources(),r)}function Nd(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var dw=F(()=>{Ot()});function pw(t){var e=new Sr({directed:!1}),r=t.nodes()[0],n=t.nodeCount();e.setNode(r,{});for(var i,a;u_e(e,t){Ot();As();dw()});var Rte=F(()=>{});var W_=F(()=>{});var kSt,H_=F(()=>{Ot();W_();kSt=xs(1)});var Nte=F(()=>{H_()});var q_=F(()=>{});var Ite=F(()=>{q_()});var LSt,Mte=F(()=>{Ot();LSt=xs(1)});function Y_(t){var e={},r={},n=[];function i(a){if(Object.prototype.hasOwnProperty.call(r,a))throw new cy;Object.prototype.hasOwnProperty.call(e,a)||(r[a]=!0,e[a]=!0,Te(t.predecessors(a),i),delete r[a],n.push(a))}if(Te(t.sinks(),i),N_(e)!==t.nodeCount())throw new cy;return n}function cy(){}var X_=F(()=>{Ot();Y_.CycleException=cy;cy.prototype=new Error});var Dte=F(()=>{X_()});function gw(t,e,r){Et(e)||(e=[e]);var n=(t.isDirected()?t.successors:t.neighbors).bind(t),i=[],a={};return Te(e,function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);Ote(t,s,r==="post",a,n,i)}),i}function Ote(t,e,r,n,i,a){Object.prototype.hasOwnProperty.call(n,e)||(n[e]=!0,r||a.push(e),Te(i(e),function(s){Ote(t,s,r,n,i,a)}),r&&a.push(e))}var j_=F(()=>{Ot()});function K_(t,e){return gw(t,e,"post")}var Pte=F(()=>{j_()});function Z_(t,e){return gw(t,e,"pre")}var Bte=F(()=>{j_()});var Fte=F(()=>{W_();uw()});var zte=F(()=>{Rte();H_();Nte();Ite();Mte();Dte();Pte();Bte();Fte();q_();X_()});function qh(t){t=dte(t),ly(t);var e=pw(t);J_(e),Q_(e,t);for(var r,n;r=Vte(e);)n=Wte(e,t,r),Hte(e,t,r,n)}function Q_(t,e){var r=K_(t,t.nodes());r=r.slice(0,r.length-1),Te(r,function(n){v_e(t,e,n)})}function v_e(t,e,r){var n=t.node(r),i=n.parent;t.edge(r,i).cutvalue=Gte(t,e,r)}function Gte(t,e,r){var n=t.node(r),i=n.parent,a=!0,s=e.edge(r,i),o=0;return s||(a=!1,s=e.edge(i,r)),o=s.weight,Te(e.nodeEdges(r),function(l){var u=l.v===r,h=u?l.w:l.v;if(h!==i){var f=u===a,d=e.edge(l).weight;if(o+=f?d:-d,x_e(t,r,h)){var p=t.edge(r,h).cutvalue;o+=f?-p:p}}}),o}function J_(t,e){arguments.length<2&&(e=t.nodes()[0]),Ute(t,{},1,e)}function Ute(t,e,r,n,i){var a=r,s=t.node(n);return e[n]=!0,Te(t.neighbors(n),function(o){Object.prototype.hasOwnProperty.call(e,o)||(r=Ute(t,e,r,o,n))}),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function Vte(t){return ja(t.edges(),function(e){return t.edge(e).cutvalue<0})}function Wte(t,e,r){var n=r.v,i=r.w;e.hasEdge(n,i)||(n=r.w,i=r.v);var a=t.node(n),s=t.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=Fr(e.edges(),function(h){return l===$te(t,t.node(h.v),o)&&l!==$te(t,t.node(h.w),o)});return Ad(u,function(h){return Nd(e,h)})}function Hte(t,e,r,n){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(n.v,n.w,{}),J_(t),Q_(t,e),y_e(t,e)}function y_e(t,e){var r=ja(t.nodes(),function(i){return!e.node(i).parent}),n=Z_(t,r);n=n.slice(1),Te(n,function(i){var a=t.node(i).parent,s=e.edge(i,a),o=!1;s||(s=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?s.minlen:-s.minlen)})}function x_e(t,e,r){return t.hasEdge(e,r)}function $te(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}var qte=F(()=>{Ot();zte();kc();V_();dw();qh.initLowLimValues=J_;qh.initCutValues=Q_;qh.calcCutValue=Gte;qh.leaveEdge=Vte;qh.enterEdge=Wte;qh.exchangeEdges=Hte});function e9(t){switch(t.graph().ranker){case"network-simplex":Yte(t);break;case"tight-tree":w_e(t);break;case"longest-path":b_e(t);break;default:Yte(t)}}function w_e(t){ly(t),pw(t)}function Yte(t){qh(t)}var b_e,t9=F(()=>{V_();qte();dw();b_e=ly});function Xte(t){var e=wc(t,"root",{},"_root"),r=k_e(t),n=Ss(fr(r))-1,i=2*n+1;t.graph().nestingRoot=e,Te(t.edges(),function(s){t.edge(s).minlen*=i});var a=T_e(t)+1;Te(t.children(),function(s){jte(t,e,i,a,n,r,s)}),t.graph().nodeRankFactor=i}function jte(t,e,r,n,i,a,s){var o=t.children(s);if(!o.length){s!==e&&t.setEdge(e,s,{weight:0,minlen:r});return}var l=F_(t,"_bt"),u=F_(t,"_bb"),h=t.node(s);t.setParent(l,s),h.borderTop=l,t.setParent(u,s),h.borderBottom=u,Te(o,function(f){jte(t,e,r,n,i,a,f);var d=t.node(f),p=d.borderTop?d.borderTop:f,g=d.borderBottom?d.borderBottom:f,m=d.borderTop?n:2*n,y=p!==g?1:i-a[s]+1;t.setEdge(l,p,{weight:m,minlen:y,nestingEdge:!0}),t.setEdge(g,u,{weight:m,minlen:y,nestingEdge:!0})}),t.parent(s)||t.setEdge(e,l,{weight:0,minlen:i+a[s]})}function k_e(t){var e={};function r(n,i){var a=t.children(n);a&&a.length&&Te(a,function(s){r(s,i+1)}),e[n]=i}return Te(t.children(),function(n){r(n,1)}),e}function T_e(t){return zr(t.edges(),function(e,r){return e+t.edge(r).weight},0)}function Kte(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,Te(t.edges(),function(r){var n=t.edge(r);n.nestingEdge&&t.removeEdge(r)})}var Zte=F(()=>{Ot();kc()});function Qte(t,e,r){var n={},i;Te(r,function(a){for(var s=t.parent(a),o,l;s;){if(o=t.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){e.setEdge(l,s);return}s=o}})}var Jte=F(()=>{Ot()});function ere(t,e,r){var n=S_e(t),i=new Sr({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return t.node(a)});return Te(t.nodes(),function(a){var s=t.node(a),o=t.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),Te(t[r](a),function(l){var u=l.v===a?l.w:l.v,h=i.edge(u,a),f=ar(h)?0:h.weight;i.setEdge(u,a,{weight:t.edge(l).weight+f})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i}function S_e(t){for(var e;t.hasNode(e=Ld("_root")););return e}var tre=F(()=>{Ot();As()});function rre(t,e){for(var r=0,n=1;n0;)h%2&&(f+=o[h+1]),h=h-1>>1,o[h]+=u.weight;l+=u.weight*f})),l}var nre=F(()=>{Ot()});function ire(t){var e={},r=Fr(t.nodes(),function(o){return!t.children(o).length}),n=Ss(je(r,function(o){return t.node(o).rank})),i=je(Mo(n+1),function(){return[]});function a(o){if(!St(e,o)){e[o]=!0;var l=t.node(o);i[l.rank].push(o),Te(t.successors(o),a)}}var s=bc(r,function(o){return t.node(o).rank});return Te(s,a),i}var are=F(()=>{Ot()});function sre(t,e){return je(e,function(r){var n=t.inEdges(r);if(n.length){var i=zr(n,function(a,s){var o=t.edge(s),l=t.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}var ore=F(()=>{Ot()});function lre(t,e){var r={};Te(t,function(i,a){var s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};ar(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),Te(e.edges(),function(i){var a=r[i.v],s=r[i.w];!ar(a)&&!ar(s)&&(s.indegree++,a.out.push(r[i.w]))});var n=Fr(r,function(i){return!i.indegree});return A_e(n)}function A_e(t){var e=[];function r(a){return function(s){s.merged||(ar(s.barycenter)||ar(a.barycenter)||s.barycenter>=a.barycenter)&&__e(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&t.push(s)}}for(;t.length;){var i=t.pop();e.push(i),Te(i.in.reverse(),r(i)),Te(i.out,n(i))}return je(Fr(e,function(a){return!a.merged}),function(a){return _d(a,["vs","i","barycenter","weight"])})}function __e(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}var cre=F(()=>{Ot()});function hre(t,e){var r=mte(t,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),n=r.lhs,i=bc(r.rhs,function(h){return-h.i}),a=[],s=0,o=0,l=0;n.sort(L_e(!!e)),l=ure(a,i,l),Te(n,function(h){l+=h.vs.length,a.push(h.vs),s+=h.barycenter*h.weight,o+=h.weight,l=ure(a,i,l)});var u={vs:Br(a)};return o&&(u.barycenter=s/o,u.weight=o),u}function ure(t,e,r){for(var n;e.length&&(n=ha(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}function L_e(t){return function(e,r){return e.barycenterr.barycenter?1:t?r.i-e.i:e.i-r.i}}var fre=F(()=>{Ot();kc()});function r9(t,e,r,n){var i=t.children(e),a=t.node(e),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=Fr(i,function(g){return g!==s&&g!==o}));var u=sre(t,i);Te(u,function(g){if(t.children(g.v).length){var m=r9(t,g.v,r,n);l[g.v]=m,Object.prototype.hasOwnProperty.call(m,"barycenter")&&N_e(g,m)}});var h=lre(u,r);R_e(h,l);var f=hre(h,n);if(s&&(f.vs=Br([s,f.vs,o]),t.predecessors(s).length)){var d=t.node(t.predecessors(s)[0]),p=t.node(t.predecessors(o)[0]);Object.prototype.hasOwnProperty.call(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+p.order)/(f.weight+2),f.weight+=2}return f}function R_e(t,e){Te(t,function(r){r.vs=Br(r.vs.map(function(n){return e[n]?e[n].vs:n}))})}function N_e(t,e){ar(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}var dre=F(()=>{Ot();ore();cre();fre()});function mre(t){var e=z_(t),r=pre(t,Mo(1,e+1),"inEdges"),n=pre(t,Mo(e-1,-1,-1),"outEdges"),i=ire(t);gre(t,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){I_e(o%2?r:n,o%4>=2),i=Wh(t);var u=rre(t,i);u{Ot();As();kc();Jte();tre();nre();are();dre()});function yre(t){var e=D_e(t);Te(t.graph().dummyChains,function(r){for(var n=t.node(r),i=n.edgeObj,a=M_e(t,e,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],h=!0;r!==i.w;){if(n=t.node(r),h){for(;(u=s[l])!==o&&t.node(u).maxRanks||o>e[l].lim));for(u=l,l=n;(l=t.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function D_e(t){var e={},r=0;function n(i){var a=r;Te(t.children(i),n),e[i]={low:a,lim:r++}}return Te(t.children(),n),e}var xre=F(()=>{Ot()});function O_e(t,e){var r={};function n(i,a){var s=0,o=0,l=i.length,u=ha(a);return Te(a,function(h,f){var d=B_e(t,h),p=d?t.node(d).order:l;(d||h===u)&&(Te(a.slice(o,f+1),function(g){Te(t.predecessors(g),function(m){var y=t.node(m),x=y.order;(xu)&&bre(r,d,h)})})}function i(a,s){var o=-1,l,u=0;return Te(s,function(h,f){if(t.node(h).dummy==="border"){var d=t.predecessors(h);d.length&&(l=t.node(d[0]).order,n(s,u,f,o,l),u=f,o=l)}n(s,u,s.length,l,a.length)}),s}return zr(e,i),r}function B_e(t,e){if(t.node(e).dummy)return ja(t.predecessors(e),function(r){return t.node(r).dummy})}function bre(t,e,r){if(e>r){var n=e;e=r,r=n}var i=t[e];i||(t[e]=i={}),i[r]=!0}function F_e(t,e,r){if(e>r){var n=e;e=r,r=n}return!!t[e]&&Object.prototype.hasOwnProperty.call(t[e],r)}function z_e(t,e,r,n){var i={},a={},s={};return Te(e,function(o){Te(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),Te(e,function(o){var l=-1;Te(o,function(u){var h=n(u);if(h.length){h=bc(h,function(m){return s[m]});for(var f=(h.length-1)/2,d=Math.floor(f),p=Math.ceil(f);d<=p;++d){var g=h[d];a[u]===u&&l{Ot();As();kc()});function Tre(t){t=fw(t),Y_e(t),k_(wre(t),function(e,r){t.node(r).x=e})}function Y_e(t){var e=Wh(t),r=t.graph().ranksep,n=0;Te(e,function(i){var a=Ss(je(i,function(s){return t.node(s).height}));Te(i,function(s){t.node(s).y=n+a/2}),n+=a+r})}var Ere=F(()=>{Ot();kc();kre()});function Ru(t,e){var r=e&&e.debugTiming?vte:yte;r("layout",()=>{var n=r(" buildLayoutGraph",()=>i9e(t));r(" runLayout",()=>X_e(n,r)),r(" updateInputGraph",()=>j_e(t,n))})}function X_e(t,e){e(" makeSpaceForEdgeLabels",()=>a9e(t)),e(" removeSelfEdges",()=>p9e(t)),e(" acyclic",()=>ute(t)),e(" nestingGraph.run",()=>Xte(t)),e(" rank",()=>e9(fw(t))),e(" injectEdgeLabelProxies",()=>s9e(t)),e(" removeEmptyRanks",()=>gte(t)),e(" nestingGraph.cleanup",()=>Kte(t)),e(" normalizeRanks",()=>pte(t)),e(" assignRankMinMax",()=>o9e(t)),e(" removeEdgeLabelProxies",()=>l9e(t)),e(" normalize.run",()=>Ate(t)),e(" parentDummyChains",()=>yre(t)),e(" addBorderSegments",()=>bte(t)),e(" order",()=>mre(t)),e(" insertSelfEdges",()=>g9e(t)),e(" adjustCoordinateSystem",()=>Tte(t)),e(" position",()=>Tre(t)),e(" positionSelfEdges",()=>m9e(t)),e(" removeBorderNodes",()=>d9e(t)),e(" normalize.undo",()=>_te(t)),e(" fixupEdgeLabelCoords",()=>h9e(t)),e(" undoCoordinateSystem",()=>Ete(t)),e(" translateGraph",()=>c9e(t)),e(" assignNodeIntersects",()=>u9e(t)),e(" reversePoints",()=>f9e(t)),e(" acyclic.undo",()=>hte(t))}function j_e(t,e){Te(t.nodes(),function(r){var n=t.node(r),i=e.node(r);n&&(n.x=i.x,n.y=i.y,e.children(r).length&&(n.width=i.width,n.height=i.height))}),Te(t.edges(),function(r){var n=t.edge(r),i=e.edge(r);n.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(n.x=i.x,n.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function i9e(t){var e=new Sr({multigraph:!0,compound:!0}),r=i9(t.graph());return e.setGraph(Mh({},Z_e,n9(r,K_e),_d(r,Q_e))),Te(t.nodes(),function(n){var i=i9(t.node(n));e.setNode(n,Gh(n9(i,J_e),e9e)),e.setParent(n,t.parent(n))}),Te(t.edges(),function(n){var i=i9(t.edge(n));e.setEdge(n,Mh({},r9e,n9(i,t9e),_d(i,n9e)))}),e}function a9e(t){var e=t.graph();e.ranksep/=2,Te(t.edges(),function(r){var n=t.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function s9e(t){Te(t.edges(),function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),i=t.node(e.w),a={rank:(i.rank-n.rank)/2+n.rank,e};wc(t,"edge-proxy",a,"_ep")}})}function o9e(t){var e=0;Te(t.nodes(),function(r){var n=t.node(r);n.borderTop&&(n.minRank=t.node(n.borderTop).rank,n.maxRank=t.node(n.borderBottom).rank,e=Ss(e,n.maxRank))}),t.graph().maxRank=e}function l9e(t){Te(t.nodes(),function(e){var r=t.node(e);r.dummy==="edge-proxy"&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))})}function c9e(t){var e=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var h=u.x,f=u.y,d=u.width,p=u.height;e=Math.min(e,h-d/2),r=Math.max(r,h+d/2),n=Math.min(n,f-p/2),i=Math.max(i,f+p/2)}Te(t.nodes(),function(u){l(t.node(u))}),Te(t.edges(),function(u){var h=t.edge(u);Object.prototype.hasOwnProperty.call(h,"x")&&l(h)}),e-=s,n-=o,Te(t.nodes(),function(u){var h=t.node(u);h.x-=e,h.y-=n}),Te(t.edges(),function(u){var h=t.edge(u);Te(h.points,function(f){f.x-=e,f.y-=n}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=n)}),a.width=r-e+s,a.height=i-n+o}function u9e(t){Te(t.edges(),function(e){var r=t.edge(e),n=t.node(e.v),i=t.node(e.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=i,s=n),r.points.unshift(B_(n,a)),r.points.push(B_(i,s))})}function h9e(t){Te(t.edges(),function(e){var r=t.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function f9e(t){Te(t.edges(),function(e){var r=t.edge(e);r.reversed&&r.points.reverse()})}function d9e(t){Te(t.nodes(),function(e){if(t.children(e).length){var r=t.node(e),n=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(ha(r.borderLeft)),s=t.node(ha(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),Te(t.nodes(),function(e){t.node(e).dummy==="border"&&t.removeNode(e)})}function p9e(t){Te(t.edges(),function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function g9e(t){var e=Wh(t);Te(e,function(r){var n=0;Te(r,function(i,a){var s=t.node(i);s.order=a+n,Te(s.selfEdges,function(o){wc(t,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function m9e(t){Te(t.nodes(),function(e){var r=t.node(e);if(r.dummy==="selfedge"){var n=t.node(r.e.v),i=n.x+n.width/2,a=n.y,s=r.x-i,o=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function n9(t,e){return Cd(_d(t,e),Number)}function i9(t){var e={};return Te(t,function(r,n){e[n.toLowerCase()]=r}),e}var K_e,Z_e,Q_e,J_e,e9e,t9e,r9e,n9e,Sre=F(()=>{Ot();As();wte();Cte();P_();U_();t9();Zte();vre();xre();Ere();kc();K_e=["nodesep","edgesep","ranksep","marginx","marginy"],Z_e={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Q_e=["acyclicer","ranker","rankdir","align"],J_e=["width","height"],e9e={width:0,height:0},t9e=["minlen","weight","width","height","labeloffset"],r9e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},n9e=["labelpos"]});var uy=F(()=>{P_();Sre();U_();t9()});function Do(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:v9e(t),edges:y9e(t)};return ar(t.graph())||(e.value=jr(t.graph())),e}function v9e(t){return je(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),i={v:e};return ar(r)||(i.value=r),ar(n)||(i.parent=n),i})}function y9e(t){return je(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return ar(e.name)||(n.name=e.name),ar(r)||(n.value=r),n})}var a9=F(()=>{Ot();uw()});var Dre={};vr(Dre,{render:()=>E9e});var dr,Id,_re,x9e,mw,b9e,Lre,Rre,w9e,hy,Are,k9e,Nre,Ire,T9e,Mre,E9e,Ore=F(()=>{_u();yl();sl();pc();bo();Ya();kn();or();uy();a9();As();As();a9();dr=new Map,Id=new Map,_re=new Map,x9e=v(()=>{Id.clear(),_re.clear(),dr.clear()},"clear"),mw=v((t,e)=>{let r=Id.get(e)||[];return re.trace("In isDescendant",e," ",t," = ",r.includes(t)),r.includes(t)},"isDescendant"),b9e=v((t,e)=>{let r=Id.get(e)||[];return re.info("Descendants of ",e," is ",r),re.info("Edge is ",t),t.v===e||t.w===e?!1:r?r.includes(t.v)||mw(t.v,e)||mw(t.w,e)||r.includes(t.w):(re.debug("Tilt, ",e,",not in descendants"),!1)},"edgeInCluster"),Lre=v((t,e,r,n)=>{re.warn("Copying children of ",t,"root",n,"data",e.node(t),n);let i=e.children(t)||[];t!==n&&i.push(t),re.warn("Copying (nodes) clusterId",t,"nodes",i),i.forEach(a=>{if(e.children(a).length>0)Lre(a,e,r,n);else{let s=e.node(a);re.info("cp ",a," to ",n," with parent ",t),r.setNode(a,s),n!==e.parent(a)&&(re.warn("Setting parent",a,e.parent(a)),r.setParent(a,e.parent(a))),t!==n&&a!==t?(re.debug("Setting parent",a,t),r.setParent(a,t)):(re.info("In copy ",t,"root",n,"data",e.node(t),n),re.debug("Not Setting parent for node=",a,"cluster!==rootId",t!==n,"node!==clusterId",a!==t));let o=e.edges(a);re.debug("Copying Edges",o),o.forEach(l=>{re.info("Edge",l);let u=e.edge(l.v,l.w,l.name);re.info("Edge data",u,n);try{b9e(l,n)?(re.info("Copying as ",l.v,l.w,u,l.name),r.setEdge(l.v,l.w,u,l.name),re.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):re.info("Skipping copy of edge ",l.v,"-->",l.w," rootId: ",n," clusterId:",t)}catch(h){re.error(h)}})}re.debug("Removing node",a),e.removeNode(a)})},"copy"),Rre=v((t,e)=>{let r=e.children(t),n=[...r];for(let i of r)_re.set(i,t),n=[...n,...Rre(i,e)];return n},"extractDescendants"),w9e=v((t,e,r)=>{let n=t.edges().filter(l=>l.v===e||l.w===e),i=t.edges().filter(l=>l.v===r||l.w===r),a=n.map(l=>({v:l.v===e?r:l.v,w:l.w===e?e:l.w})),s=i.map(l=>({v:l.v,w:l.w}));return a.filter(l=>s.some(u=>l.v===u.v&&l.w===u.w))},"findCommonEdges"),hy=v((t,e,r)=>{let n=e.children(t);if(re.trace("Searching children of id ",t,n),n.length<1)return t;let i;for(let a of n){let s=hy(a,e,r),o=w9e(e,r,s);if(s)if(o.length>0)i=s;else return s}return i},"findNonClusterChild"),Are=v(t=>!dr.has(t)||!dr.get(t).externalConnections?t:dr.has(t)?dr.get(t).id:t,"getAnchorId"),k9e=v((t,e)=>{if(!t||e>10){re.debug("Opting out, no graph ");return}else re.debug("Opting in, graph ");t.nodes().forEach(function(r){t.children(r).length>0&&(re.warn("Cluster identified",r," Replacement id in edges: ",hy(r,t,r)),Id.set(r,Rre(r,t)),dr.set(r,{id:hy(r,t,r),clusterData:t.node(r)}))}),t.nodes().forEach(function(r){let n=t.children(r),i=t.edges();n.length>0?(re.debug("Cluster identified",r,Id),i.forEach(a=>{let s=mw(a.v,r),o=mw(a.w,r);s^o&&(re.warn("Edge: ",a," leaves cluster ",r),re.warn("Descendants of XXX ",r,": ",Id.get(r)),dr.get(r).externalConnections=!0)})):re.debug("Not a cluster ",r,Id)});for(let r of dr.keys()){let n=dr.get(r).id,i=t.parent(n);i!==r&&dr.has(i)&&!dr.get(i).externalConnections&&(dr.get(r).id=i)}t.edges().forEach(function(r){let n=t.edge(r);re.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),re.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(t.edge(r)));let i=r.v,a=r.w;if(re.warn("Fix XXX",dr,"ids:",r.v,r.w,"Translating: ",dr.get(r.v)," --- ",dr.get(r.w)),dr.get(r.v)||dr.get(r.w)){if(re.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),i=Are(r.v),a=Are(r.w),t.removeEdge(r.v,r.w,r.name),i!==r.v){let s=t.parent(i);dr.get(s).externalConnections=!0,n.fromCluster=r.v}if(a!==r.w){let s=t.parent(a);dr.get(s).externalConnections=!0,n.toCluster=r.w}re.warn("Fix Replacing with XXX",i,a,r.name),t.setEdge(i,a,n,r.name)}}),re.warn("Adjusted Graph",Do(t)),Nre(t,0),re.trace(dr)},"adjustClustersAndEdges"),Nre=v((t,e)=>{if(re.warn("extractor - ",e,Do(t),t.children("D")),e>10){re.error("Bailing out");return}let r=t.nodes(),n=!1;for(let i of r){let a=t.children(i);n=n||a.length>0}if(!n){re.debug("Done, no node has children",t.nodes());return}re.debug("Nodes = ",r,e);for(let i of r)if(re.debug("Extracting node",i,dr,dr.has(i)&&!dr.get(i).externalConnections,!t.parent(i),t.node(i),t.children("D")," Depth ",e),!dr.has(i))re.debug("Not a cluster",i,e);else if(!dr.get(i).externalConnections&&t.children(i)&&t.children(i).length>0){re.warn("Cluster without external connections, without a parent and with children",i,e);let s=t.graph().rankdir==="TB"?"LR":"TB";dr.get(i)?.clusterData?.dir&&(s=dr.get(i).clusterData.dir,re.warn("Fixing dir",dr.get(i).clusterData.dir,s));let o=new Sr({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});re.warn("Old graph before copy",Do(t)),Lre(i,t,o,i),t.setNode(i,{clusterNode:!0,id:i,clusterData:dr.get(i).clusterData,label:dr.get(i).label,graph:o}),re.warn("New graph after copy node: (",i,")",Do(o)),re.debug("Old graph after copy",Do(t))}else re.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!dr.get(i).externalConnections," no parent: ",!t.parent(i)," children ",t.children(i)&&t.children(i).length>0,t.children("D"),e),re.debug(dr);r=t.nodes(),re.warn("New list of nodes",r);for(let i of r){let a=t.node(i);re.warn(" Now next level",i,a),a?.clusterNode&&Nre(a.graph,e+1)}},"extractor"),Ire=v((t,e)=>{if(e.length===0)return[];let r=Object.assign([],e);return e.forEach(n=>{let i=t.children(n),a=Ire(t,i);r=[...r,...a]}),r},"sorter"),T9e=v(t=>Ire(t,t.children()),"sortNodesByHierarchy"),Mre=v(async(t,e,r,n,i,a)=>{re.warn("Graph in recursive render:XAX",Do(e),i);let s=e.graph().rankdir;re.trace("Dir in recursive render - dir:",s);let o=t.insert("g").attr("class","root");e.nodes()?re.info("Recursive render XXX",e.nodes()):re.info("No nodes found for",e),e.edges().length>0&&re.info("Recursive edges",e.edge(e.edges()[0]));let l=o.insert("g").attr("class","clusters"),u=o.insert("g").attr("class","edgePaths"),h=o.insert("g").attr("class","edgeLabels"),f=o.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(m){let y=e.node(m);if(i!==void 0){let x=JSON.parse(JSON.stringify(i.clusterData));re.trace(`Setting data for parent cluster XXX Node.id = `,m,` data=`,x.height,` Parent cluster`,i.height),e.setNode(i.id,x),e.parent(m)||(re.trace("Setting parent",m,i.id),e.setParent(m,i.id,x))}if(re.info("(Insert) Node XXX"+m+": "+JSON.stringify(e.node(m))),y?.clusterNode){re.info("Cluster identified XBX",m,y.width,e.node(m));let{ranksep:x,nodesep:b}=e.graph();y.graph.setGraph({...y.graph.graph(),ranksep:x+25,nodesep:b});let w=await Mre(f,y.graph,r,n,e.node(m),a),_=w.elem;Pt(y,_),y.diff=w.diff||0,re.info("New compound node after recursive render XAX",m,"width",y.width,"height",y.height),JK(_,y)}else e.children(m).length>0?(re.trace("Cluster - the non recursive path XBX",m,y.id,y,y.width,"Graph:",e),re.trace(hy(y.id,e)),dr.set(y.id,{id:hy(y.id,e),node:y})):(re.trace("Node - the non recursive path XAX",m,f,e.node(m),s),await wd(f,e.node(m),{config:a,dir:s}))})),await v(async()=>{let m=e.edges().map(async function(y){let x=e.edge(y.v,y.w,y.name);re.info("Edge "+y.v+" -> "+y.w+": "+JSON.stringify(y)),re.info("Edge "+y.v+" -> "+y.w+": ",y," ",JSON.stringify(e.edge(y))),re.info("Fix",dr,"ids:",y.v,y.w,"Translating: ",dr.get(y.v),dr.get(y.w)),await h5(h,x)});await Promise.all(m)},"processEdges")(),re.info("Graph before layout:",JSON.stringify(Do(e))),re.info("############################################# XXX"),re.info("### Layout ### XXX"),re.info("############################################# XXX"),Ru(e),re.info("Graph after layout:",JSON.stringify(Do(e)));let p=0,{subGraphTitleTotalMargin:g}=ou(a);return await Promise.all(T9e(e).map(async function(m){let y=e.node(m);if(re.info("Position XBX => "+m+": ("+y.x,","+y.y,") width: ",y.width," height: ",y.height),y?.clusterNode)y.y+=g,re.info("A tainted cluster node XBX1",m,y.id,y.width,y.height,y.x,y.y,e.parent(m)),dr.get(y.id).node=y,Jv(y);else if(e.children(m).length>0){re.info("A pure cluster node XBX1",m,y.id,y.x,y.y,y.width,y.height,e.parent(m)),y.height+=g,e.node(y.parentId);let x=y?.padding/2||0,b=y?.labelBBox?.height||0,w=b-x||0;re.debug("OffsetY",w,"labelHeight",b,"halfPadding",x),await tg(l,y),dr.get(y.id).node=y}else{let x=e.node(y.parentId);y.y+=g/2,re.info("A regular node XBX1 - using the padding",y.id,"parent",y.parentId,y.width,y.height,y.x,y.y,"offsetY",y.offsetY,"parent",x,x?.offsetY,y),Jv(y)}})),e.edges().forEach(function(m){let y=e.edge(m);re.info("Edge "+m.v+" -> "+m.w+": "+JSON.stringify(y),y),y.points.forEach(_=>_.y+=g/2);let x=e.node(m.v);var b=e.node(m.w);let w=d5(u,y,dr,r,x,b,n);f5(y,w)}),e.nodes().forEach(function(m){let y=e.node(m);re.info(m,y.type,y.diff),y.isGroup&&(p=y.diff)}),re.warn("Returning from recursive render XAX",o,p),{elem:o,diff:p}},"recursiveRender"),E9e=v(async(t,e)=>{let r=new Sr({multigraph:!0,compound:!0}).setGraph({rankdir:t.direction,nodesep:t.config?.nodeSpacing||t.config?.flowchart?.nodeSpacing||t.nodeSpacing,ranksep:t.config?.rankSpacing||t.config?.flowchart?.rankSpacing||t.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=e.select("g");p5(n,t.markers,t.type,t.diagramId),eZ(),iZ(),zj(),x9e(),t.nodes.forEach(a=>{r.setNode(a.id,{...a}),a.parentId&&r.setParent(a.id,a.parentId)}),re.debug("Edges:",t.edges),t.edges.forEach(a=>{if(a.start===a.end){let s=a.start,o=s+"---"+s+"---1",l=s+"---"+s+"---2",u=r.node(s);r.setNode(o,{domId:o,id:o,parentId:u.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(o,u.parentId),r.setNode(l,{domId:l,id:l,parentId:u.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(l,u.parentId);let h=structuredClone(a),f=structuredClone(a),d=structuredClone(a);h.label="",h.arrowTypeEnd="none",h.id=s+"-cyclic-special-1",f.arrowTypeEnd="none",f.id=s+"-cyclic-special-mid",d.label="",u.isGroup&&(h.fromCluster=s,d.toCluster=s),d.id=s+"-cyclic-special-2",r.setEdge(s,o,h,s+"-cyclic-special-0"),r.setEdge(o,l,f,s+"-cyclic-special-1"),r.setEdge(l,s,d,s+"-cyc{_u();yl();kn();or();S9e={common:Xe,getConfig:Or,insertCluster:tg,insertEdge:d5,insertEdgeLabel:h5,insertMarkers:p5,insertNode:wd,interpolateToCurve:$3,labelHelper:tr,log:re,positionEdgeLabel:f5},fy={},s9=v(t=>{for(let e of t)fy[e.name]=e},"registerLayoutLoaders"),C9e=v(()=>{s9([{name:"dagre",loader:v(async()=>await Promise.resolve().then(()=>(Ore(),Dre)),"loader")}])},"registerDefaultLayoutLoaders");C9e();kg=v(async(t,e)=>{if(!(t.layoutAlgorithm in fy))throw new Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);let r=fy[t.layoutAlgorithm];return(await r.loader()).render(t,e,S9e,{algorithm:r.algorithm})},"render"),vw=v((t="",{fallback:e="dagre"}={})=>{if(t in fy)return t;if(e in fy)return re.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw new Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm")});var dy,o9=F(()=>{dy="11.4.0"});var La,Iu=F(()=>{or();lr();La=v(t=>{let{securityLevel:e}=pe(),r=Ve("body");if(e==="sandbox"){let a=Ve(`#i${t}`).node()?.contentDocument??document;r=Ve(a.body)}return r.select(`#${t}`)},"selectSvgElement")});var u9,Dd,_w,ene,tne,rne,Tc,Lw,Rw=F(()=>{or();u9=Gi(hp(),1),Dd=v((t,e)=>{let r=t.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name&&r.attr("name",e.name),e.rx&&r.attr("rx",e.rx),e.ry&&r.attr("ry",e.ry),e.attrs!==void 0)for(let n in e.attrs)r.attr(n,e.attrs[n]);return e.class&&r.attr("class",e.class),r},"drawRect"),_w=v((t,e)=>{let r={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};Dd(t,r).lower()},"drawBackgroundRect"),ene=v((t,e)=>{let r=e.text.replace(zf," "),n=t.append("text");n.attr("x",e.x),n.attr("y",e.y),n.attr("class","legend"),n.style("text-anchor",e.anchor),e.class&&n.attr("class",e.class);let i=n.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),n},"drawText"),tne=v((t,e,r,n)=>{let i=t.append("image");i.attr("x",e),i.attr("y",r);let a=(0,u9.sanitizeUrl)(n);i.attr("xlink:href",a)},"drawImage"),rne=v((t,e,r,n)=>{let i=t.append("use");i.attr("x",e),i.attr("y",r);let a=(0,u9.sanitizeUrl)(n);i.attr("xlink:href",`#${a}`)},"drawEmbeddedImage"),Tc=v(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),Lw=v(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj")});var pne={};vr(pne,{diagram:()=>wLe});function Fo(t,e,r,n,i){if(!e[t].width)if(r)e[t].text=cA(e[t].text,i,n),e[t].textLines=e[t].text.split(Xe.lineBreakRegex).length,e[t].width=i,e[t].height=Gv(e[t].text,n);else{let a=e[t].text.split(Xe.lineBreakRegex);e[t].textLines=a.length;let s=0;e[t].height=0,e[t].width=0;for(let o of a)e[t].width=Math.max(bs(o,n),e[t].width),s=Gv(o,n),e[t].height=e[t].height+s}}function v9(t,e,r,n,i){let a=new hne(i);a.data.widthLimit=r.data.widthLimit/Math.min(f9,n.length);for(let[s,o]of n.entries()){let l=0;o.image={width:0,height:0,Y:0},o.sprite&&(o.image.width=48,o.image.height=48,o.image.Y=l,l=o.image.Y+o.image.height);let u=o.wrap&&Mt.wrap,h=Nw(Mt);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",Fo("label",o,u,h,a.data.widthLimit),o.label.Y=l+8,l=o.label.Y+o.label.height,o.type&&o.type.text!==""){o.type.text="["+o.type.text+"]";let g=Nw(Mt);Fo("type",o,u,g,a.data.widthLimit),o.type.Y=l+5,l=o.type.Y+o.type.height}if(o.descr&&o.descr.text!==""){let g=Nw(Mt);g.fontSize=g.fontSize-2,Fo("descr",o,u,g,a.data.widthLimit),o.descr.Y=l+20,l=o.descr.Y+o.descr.height}if(s==0||s%f9===0){let g=r.data.startx+Mt.diagramMarginX,m=r.data.stopy+Mt.diagramMarginY+l;a.setData(g,g,m,m)}else{let g=a.data.stopx!==a.data.startx?a.data.stopx+Mt.diagramMarginX:a.data.startx,m=a.data.starty;a.setData(g,g,m,m)}a.name=o.alias;let f=i.db.getC4ShapeArray(o.alias),d=i.db.getC4ShapeKeys(o.alias);d.length>0&&dne(a,t,f,d),e=o.alias;let p=i.db.getBoundarys(e);p.length>0&&v9(t,e,a,p,i),o.alias!=="global"&&fne(t,o,a),r.data.stopy=Math.max(a.data.stopy+Mt.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+Mt.c4ShapeMargin,r.data.stopx),Ow=Math.max(Ow,r.data.stopx),Pw=Math.max(Pw,r.data.stopy)}}var lne,Iw,_9e,wl,Xh,Ka,bl,Sc,yy,p9,g9,Mw,Dw,ane,L9e,R9e,N9e,I9e,M9e,D9e,O9e,P9e,B9e,F9e,z9e,$9e,G9e,U9e,V9e,W9e,H9e,sne,q9e,Y9e,one,X9e,j9e,K9e,Z9e,jh,Q9e,J9e,eLe,tLe,rLe,h9,m9,cne,nLe,iLe,aLe,sLe,oLe,lLe,cLe,uLe,hLe,fLe,dLe,pLe,Du,Ec,Ow,Pw,une,f9,Mt,hne,d9,vy,Nw,gLe,fne,dne,Bo,nne,mLe,vLe,yLe,ine,xLe,bLe,wLe,gne=F(()=>{Rw();kn();or();lr();lne=Gi(hp(),1),Iw=function(){var t=v(function(We,Re,Pe,xe){for(Pe=Pe||{},xe=We.length;xe--;Pe[We[xe]]=Re);return Pe},"o"),e=[1,24],r=[1,25],n=[1,26],i=[1,27],a=[1,28],s=[1,63],o=[1,64],l=[1,65],u=[1,66],h=[1,67],f=[1,68],d=[1,69],p=[1,29],g=[1,30],m=[1,31],y=[1,32],x=[1,33],b=[1,34],w=[1,35],_=[1,36],k=[1,37],E=[1,38],L=[1,39],S=[1,40],C=[1,41],M=[1,42],R=[1,43],T=[1,44],I=[1,45],A=[1,46],D=[1,47],N=[1,48],O=[1,50],B=[1,51],P=[1,52],$=[1,53],z=[1,54],H=[1,55],J=[1,56],X=[1,57],oe=[1,58],K=[1,59],ee=[1,60],Q=[14,42],W=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Y=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Z=[1,82],se=[1,83],ce=[1,84],ue=[1,85],te=[12,14,42],Ne=[12,14,33,42],ae=[12,14,33,42,76,77,79,80],we=[12,33],Ie=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ee={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:v(function(Re,Pe,xe,q,de,ie,he){var U=ie.length-1;switch(de){case 3:q.setDirection("TB");break;case 4:q.setDirection("BT");break;case 5:q.setDirection("RL");break;case 6:q.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:q.setC4Type(ie[U-3]);break;case 19:q.setTitle(ie[U].substring(6)),this.$=ie[U].substring(6);break;case 20:q.setAccDescription(ie[U].substring(15)),this.$=ie[U].substring(15);break;case 21:this.$=ie[U].trim(),q.setTitle(this.$);break;case 22:case 23:this.$=ie[U].trim(),q.setAccDescription(this.$);break;case 28:ie[U].splice(2,0,"ENTERPRISE"),q.addPersonOrSystemBoundary(...ie[U]),this.$=ie[U];break;case 29:ie[U].splice(2,0,"SYSTEM"),q.addPersonOrSystemBoundary(...ie[U]),this.$=ie[U];break;case 30:q.addPersonOrSystemBoundary(...ie[U]),this.$=ie[U];break;case 31:ie[U].splice(2,0,"CONTAINER"),q.addContainerBoundary(...ie[U]),this.$=ie[U];break;case 32:q.addDeploymentNode("node",...ie[U]),this.$=ie[U];break;case 33:q.addDeploymentNode("nodeL",...ie[U]),this.$=ie[U];break;case 34:q.addDeploymentNode("nodeR",...ie[U]),this.$=ie[U];break;case 35:q.popBoundaryParseStack();break;case 39:q.addPersonOrSystem("person",...ie[U]),this.$=ie[U];break;case 40:q.addPersonOrSystem("external_person",...ie[U]),this.$=ie[U];break;case 41:q.addPersonOrSystem("system",...ie[U]),this.$=ie[U];break;case 42:q.addPersonOrSystem("system_db",...ie[U]),this.$=ie[U];break;case 43:q.addPersonOrSystem("system_queue",...ie[U]),this.$=ie[U];break;case 44:q.addPersonOrSystem("external_system",...ie[U]),this.$=ie[U];break;case 45:q.addPersonOrSystem("external_system_db",...ie[U]),this.$=ie[U];break;case 46:q.addPersonOrSystem("external_system_queue",...ie[U]),this.$=ie[U];break;case 47:q.addContainer("container",...ie[U]),this.$=ie[U];break;case 48:q.addContainer("container_db",...ie[U]),this.$=ie[U];break;case 49:q.addContainer("container_queue",...ie[U]),this.$=ie[U];break;case 50:q.addContainer("external_container",...ie[U]),this.$=ie[U];break;case 51:q.addContainer("external_container_db",...ie[U]),this.$=ie[U];break;case 52:q.addContainer("external_container_queue",...ie[U]),this.$=ie[U];break;case 53:q.addComponent("component",...ie[U]),this.$=ie[U];break;case 54:q.addComponent("component_db",...ie[U]),this.$=ie[U];break;case 55:q.addComponent("component_queue",...ie[U]),this.$=ie[U];break;case 56:q.addComponent("external_component",...ie[U]),this.$=ie[U];break;case 57:q.addComponent("external_component_db",...ie[U]),this.$=ie[U];break;case 58:q.addComponent("external_component_queue",...ie[U]),this.$=ie[U];break;case 60:q.addRel("rel",...ie[U]),this.$=ie[U];break;case 61:q.addRel("birel",...ie[U]),this.$=ie[U];break;case 62:q.addRel("rel_u",...ie[U]),this.$=ie[U];break;case 63:q.addRel("rel_d",...ie[U]),this.$=ie[U];break;case 64:q.addRel("rel_l",...ie[U]),this.$=ie[U];break;case 65:q.addRel("rel_r",...ie[U]),this.$=ie[U];break;case 66:q.addRel("rel_b",...ie[U]),this.$=ie[U];break;case 67:ie[U].splice(0,1),q.addRel("rel",...ie[U]),this.$=ie[U];break;case 68:q.updateElStyle("update_el_style",...ie[U]),this.$=ie[U];break;case 69:q.updateRelStyle("update_rel_style",...ie[U]),this.$=ie[U];break;case 70:q.updateLayoutConfig("update_layout_config",...ie[U]),this.$=ie[U];break;case 71:this.$=[ie[U]];break;case 72:ie[U].unshift(ie[U-1]),this.$=ie[U];break;case 73:case 75:this.$=ie[U].trim();break;case 74:let ke={};ke[ie[U-1].trim()]=ie[U].trim(),this.$=ke;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{13:70,19:20,20:21,21:22,22:e,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{13:71,19:20,20:21,21:22,22:e,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{13:72,19:20,20:21,21:22,22:e,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{13:73,19:20,20:21,21:22,22:e,23:r,24:n,26:i,28:a,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{14:[1,74]},t(Q,[2,13],{43:23,29:49,30:61,32:62,20:75,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee}),t(Q,[2,14]),t(W,[2,16],{12:[1,76]}),t(Q,[2,36],{12:[1,77]}),t(Y,[2,19]),t(Y,[2,20]),{25:[1,78]},{27:[1,79]},t(Y,[2,23]),{35:80,75:81,76:Z,77:se,79:ce,80:ue},{35:86,75:81,76:Z,77:se,79:ce,80:ue},{35:87,75:81,76:Z,77:se,79:ce,80:ue},{35:88,75:81,76:Z,77:se,79:ce,80:ue},{35:89,75:81,76:Z,77:se,79:ce,80:ue},{35:90,75:81,76:Z,77:se,79:ce,80:ue},{35:91,75:81,76:Z,77:se,79:ce,80:ue},{35:92,75:81,76:Z,77:se,79:ce,80:ue},{35:93,75:81,76:Z,77:se,79:ce,80:ue},{35:94,75:81,76:Z,77:se,79:ce,80:ue},{35:95,75:81,76:Z,77:se,79:ce,80:ue},{35:96,75:81,76:Z,77:se,79:ce,80:ue},{35:97,75:81,76:Z,77:se,79:ce,80:ue},{35:98,75:81,76:Z,77:se,79:ce,80:ue},{35:99,75:81,76:Z,77:se,79:ce,80:ue},{35:100,75:81,76:Z,77:se,79:ce,80:ue},{35:101,75:81,76:Z,77:se,79:ce,80:ue},{35:102,75:81,76:Z,77:se,79:ce,80:ue},{35:103,75:81,76:Z,77:se,79:ce,80:ue},{35:104,75:81,76:Z,77:se,79:ce,80:ue},t(te,[2,59]),{35:105,75:81,76:Z,77:se,79:ce,80:ue},{35:106,75:81,76:Z,77:se,79:ce,80:ue},{35:107,75:81,76:Z,77:se,79:ce,80:ue},{35:108,75:81,76:Z,77:se,79:ce,80:ue},{35:109,75:81,76:Z,77:se,79:ce,80:ue},{35:110,75:81,76:Z,77:se,79:ce,80:ue},{35:111,75:81,76:Z,77:se,79:ce,80:ue},{35:112,75:81,76:Z,77:se,79:ce,80:ue},{35:113,75:81,76:Z,77:se,79:ce,80:ue},{35:114,75:81,76:Z,77:se,79:ce,80:ue},{35:115,75:81,76:Z,77:se,79:ce,80:ue},{20:116,29:49,30:61,32:62,34:s,36:o,37:l,38:u,39:h,40:f,41:d,43:23,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee},{12:[1,118],33:[1,117]},{35:119,75:81,76:Z,77:se,79:ce,80:ue},{35:120,75:81,76:Z,77:se,79:ce,80:ue},{35:121,75:81,76:Z,77:se,79:ce,80:ue},{35:122,75:81,76:Z,77:se,79:ce,80:ue},{35:123,75:81,76:Z,77:se,79:ce,80:ue},{35:124,75:81,76:Z,77:se,79:ce,80:ue},{35:125,75:81,76:Z,77:se,79:ce,80:ue},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(Q,[2,15]),t(W,[2,17],{21:22,19:130,22:e,23:r,24:n,26:i,28:a}),t(Q,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:r,24:n,26:i,28:a,34:s,36:o,37:l,38:u,39:h,40:f,41:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w,51:_,52:k,53:E,54:L,55:S,56:C,57:M,58:R,59:T,60:I,61:A,62:D,63:N,64:O,65:B,66:P,67:$,68:z,69:H,70:J,71:X,72:oe,73:K,74:ee}),t(Y,[2,21]),t(Y,[2,22]),t(te,[2,39]),t(Ne,[2,71],{75:81,35:132,76:Z,77:se,79:ce,80:ue}),t(ae,[2,73]),{78:[1,133]},t(ae,[2,75]),t(ae,[2,76]),t(te,[2,40]),t(te,[2,41]),t(te,[2,42]),t(te,[2,43]),t(te,[2,44]),t(te,[2,45]),t(te,[2,46]),t(te,[2,47]),t(te,[2,48]),t(te,[2,49]),t(te,[2,50]),t(te,[2,51]),t(te,[2,52]),t(te,[2,53]),t(te,[2,54]),t(te,[2,55]),t(te,[2,56]),t(te,[2,57]),t(te,[2,58]),t(te,[2,60]),t(te,[2,61]),t(te,[2,62]),t(te,[2,63]),t(te,[2,64]),t(te,[2,65]),t(te,[2,66]),t(te,[2,67]),t(te,[2,68]),t(te,[2,69]),t(te,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(we,[2,28]),t(we,[2,29]),t(we,[2,30]),t(we,[2,31]),t(we,[2,32]),t(we,[2,33]),t(we,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(W,[2,18]),t(Q,[2,38]),t(Ne,[2,72]),t(ae,[2,74]),t(te,[2,24]),t(te,[2,35]),t(Ie,[2,25]),t(Ie,[2,26],{12:[1,138]}),t(Ie,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:v(function(Re,Pe){if(Pe.recoverable)this.trace(Re);else{var xe=new Error(Re);throw xe.hash=Pe,xe}},"parseError"),parse:v(function(Re){var Pe=this,xe=[0],q=[],de=[null],ie=[],he=this.table,U="",ke=0,j=0,ye=0,Ae=2,Ge=1,Fe=ie.slice.call(arguments,1),ge=Object.create(this.lexer),$e={yy:{}};for(var Ce in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ce)&&($e.yy[Ce]=this.yy[Ce]);ge.setInput(Re,$e.yy),$e.yy.lexer=ge,$e.yy.parser=this,typeof ge.yylloc>"u"&&(ge.yylloc={});var qe=ge.yylloc;ie.push(qe);var lt=ge.options&&ge.options.ranges;typeof $e.yy.parseError=="function"?this.parseError=$e.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function xt(_t){xe.length=xe.length-2*_t,de.length=de.length-_t,ie.length=ie.length-_t}v(xt,"popStack");function ft(){var _t;return _t=q.pop()||ge.lex()||Ge,typeof _t!="number"&&(_t instanceof Array&&(q=_t,_t=q.pop()),_t=Pe.symbols_[_t]||_t),_t}v(ft,"lex");for(var Ze,st,Ue,Ke,it,mt,Ht={},ot,et,ht,bt;;){if(Ue=xe[xe.length-1],this.defaultActions[Ue]?Ke=this.defaultActions[Ue]:((Ze===null||typeof Ze>"u")&&(Ze=ft()),Ke=he[Ue]&&he[Ue][Ze]),typeof Ke>"u"||!Ke.length||!Ke[0]){var tt="";bt=[];for(ot in he[Ue])this.terminals_[ot]&&ot>Ae&&bt.push("'"+this.terminals_[ot]+"'");ge.showPosition?tt="Parse error on line "+(ke+1)+`: `+ge.showPosition()+` Expecting `+bt.join(", ")+", got '"+(this.terminals_[Ze]||Ze)+"'":tt="Parse error on line "+(ke+1)+": Unexpected "+(Ze==Ge?"end of input":"'"+(this.terminals_[Ze]||Ze)+"'"),this.parseError(tt,{text:ge.match,token:this.terminals_[Ze]||Ze,line:ge.yylineno,loc:qe,expected:bt})}if(Ke[0]instanceof Array&&Ke.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ue+", token: "+Ze);switch(Ke[0]){case 1:xe.push(Ze),de.push(ge.yytext),ie.push(ge.yylloc),xe.push(Ke[1]),Ze=null,st?(Ze=st,st=null):(j=ge.yyleng,U=ge.yytext,ke=ge.yylineno,qe=ge.yylloc,ye>0&&ye--);break;case 2:if(et=this.productions_[Ke[1]][1],Ht.$=de[de.length-et],Ht._$={first_line:ie[ie.length-(et||1)].first_line,last_line:ie[ie.length-1].last_line,first_column:ie[ie.length-(et||1)].first_column,last_column:ie[ie.length-1].last_column},lt&&(Ht._$.range=[ie[ie.length-(et||1)].range[0],ie[ie.length-1].range[1]]),mt=this.performAction.apply(Ht,[U,j,ke,$e.yy,Ke[1],de,ie].concat(Fe)),typeof mt<"u")return mt;et&&(xe=xe.slice(0,-1*et*2),de=de.slice(0,-1*et),ie=ie.slice(0,-1*et)),xe.push(this.productions_[Ke[1]][0]),de.push(Ht.$),ie.push(Ht._$),ht=he[xe[xe.length-2]][xe[xe.length-1]],xe.push(ht);break;case 3:return!0}}return!0},"parse")},Oe=function(){var We={EOF:1,parseError:v(function(Pe,xe){if(this.yy.parser)this.yy.parser.parseError(Pe,xe);else throw new Error(Pe)},"parseError"),setInput:v(function(Re,Pe){return this.yy=Pe||this.yy||{},this._input=Re,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var Re=this._input[0];this.yytext+=Re,this.yyleng++,this.offset++,this.match+=Re,this.matched+=Re;var Pe=Re.match(/(?:\r\n?|\n).*/g);return Pe?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Re},"input"),unput:v(function(Re){var Pe=Re.length,xe=Re.split(/(?:\r\n?|\n)/g);this._input=Re+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Pe),this.offset-=Pe;var q=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),xe.length-1&&(this.yylineno-=xe.length-1);var de=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:xe?(xe.length===q.length?this.yylloc.first_column:0)+q[q.length-xe.length].length-xe[0].length:this.yylloc.first_column-Pe},this.options.ranges&&(this.yylloc.range=[de[0],de[0]+this.yyleng-Pe]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(Re){this.unput(this.match.slice(Re))},"less"),pastInput:v(function(){var Re=this.matched.substr(0,this.matched.length-this.match.length);return(Re.length>20?"...":"")+Re.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var Re=this.match;return Re.length<20&&(Re+=this._input.substr(0,20-Re.length)),(Re.substr(0,20)+(Re.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var Re=this.pastInput(),Pe=new Array(Re.length+1).join("-");return Re+this.upcomingInput()+` `+Pe+"^"},"showPosition"),test_match:v(function(Re,Pe){var xe,q,de;if(this.options.backtrack_lexer&&(de={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(de.yylloc.range=this.yylloc.range.slice(0))),q=Re[0].match(/(?:\r\n?|\n).*/g),q&&(this.yylineno+=q.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:q?q[q.length-1].length-q[q.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Re[0].length},this.yytext+=Re[0],this.match+=Re[0],this.matches=Re,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Re[0].length),this.matched+=Re[0],xe=this.performAction.call(this,this.yy,this,Pe,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),xe)return xe;if(this._backtrack){for(var ie in de)this[ie]=de[ie];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Re,Pe,xe,q;this._more||(this.yytext="",this.match="");for(var de=this._currentRules(),ie=0;iePe[0].length)){if(Pe=xe,q=ie,this.options.backtrack_lexer){if(Re=this.test_match(xe,de[ie]),Re!==!1)return Re;if(this._backtrack){Pe=!1;continue}else return!1}else if(!this.options.flex)break}return Pe?(Re=this.test_match(Pe,de[q]),Re!==!1?Re:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var Pe=this.next();return Pe||this.lex()},"lex"),begin:v(function(Pe){this.conditionStack.push(Pe)},"begin"),popState:v(function(){var Pe=this.conditionStack.length-1;return Pe>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(Pe){return Pe=this.conditionStack.length-1-Math.abs(Pe||0),Pe>=0?this.conditionStack[Pe]:"INITIAL"},"topState"),pushState:v(function(Pe){this.begin(Pe)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:v(function(Pe,xe,q,de){var ie=de;switch(q){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),26;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;break;case 23:return this.begin("person"),44;break;case 24:return this.begin("system_ext_queue"),51;break;case 25:return this.begin("system_ext_db"),50;break;case 26:return this.begin("system_ext"),49;break;case 27:return this.begin("system_queue"),48;break;case 28:return this.begin("system_db"),47;break;case 29:return this.begin("system"),46;break;case 30:return this.begin("boundary"),37;break;case 31:return this.begin("enterprise_boundary"),34;break;case 32:return this.begin("system_boundary"),36;break;case 33:return this.begin("container_ext_queue"),57;break;case 34:return this.begin("container_ext_db"),56;break;case 35:return this.begin("container_ext"),55;break;case 36:return this.begin("container_queue"),54;break;case 37:return this.begin("container_db"),53;break;case 38:return this.begin("container"),52;break;case 39:return this.begin("container_boundary"),38;break;case 40:return this.begin("component_ext_queue"),63;break;case 41:return this.begin("component_ext_db"),62;break;case 42:return this.begin("component_ext"),61;break;case 43:return this.begin("component_queue"),60;break;case 44:return this.begin("component_db"),59;break;case 45:return this.begin("component"),58;break;case 46:return this.begin("node"),39;break;case 47:return this.begin("node"),39;break;case 48:return this.begin("node_l"),40;break;case 49:return this.begin("node_r"),41;break;case 50:return this.begin("rel"),64;break;case 51:return this.begin("birel"),65;break;case 52:return this.begin("rel_u"),66;break;case 53:return this.begin("rel_u"),66;break;case 54:return this.begin("rel_d"),67;break;case 55:return this.begin("rel_d"),67;break;case 56:return this.begin("rel_l"),68;break;case 57:return this.begin("rel_l"),68;break;case 58:return this.begin("rel_r"),69;break;case 59:return this.begin("rel_r"),69;break;case 60:return this.begin("rel_b"),70;break;case 61:return this.begin("rel_index"),71;break;case 62:return this.begin("update_el_style"),72;break;case 63:return this.begin("update_rel_style"),73;break;case 64:return this.begin("update_layout_config"),74;break;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";break;case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";break;case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return We}();Ee.lexer=Oe;function De(){this.yy={}}return v(De,"Parser"),De.prototype=Ee,Ee.Parser=De,new De}();Iw.parser=Iw;_9e=Iw,wl=[],Xh=[""],Ka="global",bl="",Sc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],yy=[],p9="",g9=!1,Mw=4,Dw=2,L9e=v(function(){return ane},"getC4Type"),R9e=v(function(t){ane=yr(t,pe())},"setC4Type"),N9e=v(function(t,e,r,n,i,a,s,o,l){if(t==null||e===void 0||e===null||r===void 0||r===null||n===void 0||n===null)return;let u={},h=yy.find(f=>f.from===e&&f.to===r);if(h?u=h:yy.push(u),u.type=t,u.from=e,u.to=r,u.label={text:n},i==null)u.techn={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.techn={text:i};if(a==null)u.descr={text:""};else if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]={text:d}}else u.descr={text:a};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.sprite=s;if(typeof o=="object"){let[f,d]=Object.entries(o)[0];u[f]=d}else u.tags=o;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=jh()},"addRel"),I9e=v(function(t,e,r,n,i,a,s){if(e===null||r===null)return;let o={},l=wl.find(u=>u.alias===e);if(l&&e===l.alias?o=l:(o.alias=e,wl.push(o)),r==null?o.label={text:""}:o.label={text:r},n==null)o.descr={text:""};else if(typeof n=="object"){let[u,h]=Object.entries(n)[0];o[u]={text:h}}else o.descr={text:n};if(typeof i=="object"){let[u,h]=Object.entries(i)[0];o[u]=h}else o.sprite=i;if(typeof a=="object"){let[u,h]=Object.entries(a)[0];o[u]=h}else o.tags=a;if(typeof s=="object"){let[u,h]=Object.entries(s)[0];o[u]=h}else o.link=s;o.typeC4Shape={text:t},o.parentBoundary=Ka,o.wrap=jh()},"addPersonOrSystem"),M9e=v(function(t,e,r,n,i,a,s,o){if(e===null||r===null)return;let l={},u=wl.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,wl.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=jh(),l.typeC4Shape={text:t},l.parentBoundary=Ka},"addContainer"),D9e=v(function(t,e,r,n,i,a,s,o){if(e===null||r===null)return;let l={},u=wl.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,wl.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.techn={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.techn={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.sprite=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.wrap=jh(),l.typeC4Shape={text:t},l.parentBoundary=Ka},"addComponent"),O9e=v(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=Sc.find(o=>o.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,Sc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"system"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Ka,a.wrap=jh(),bl=Ka,Ka=t,Xh.push(bl)},"addPersonOrSystemBoundary"),P9e=v(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=Sc.find(o=>o.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,Sc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"container"};else if(typeof r=="object"){let[o,l]=Object.entries(r)[0];a[o]={text:l}}else a.type={text:r};if(typeof n=="object"){let[o,l]=Object.entries(n)[0];a[o]=l}else a.tags=n;if(typeof i=="object"){let[o,l]=Object.entries(i)[0];a[o]=l}else a.link=i;a.parentBoundary=Ka,a.wrap=jh(),bl=Ka,Ka=t,Xh.push(bl)},"addContainerBoundary"),B9e=v(function(t,e,r,n,i,a,s,o){if(e===null||r===null)return;let l={},u=Sc.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,Sc.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.type={text:"node"};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.type={text:n};if(i==null)l.descr={text:""};else if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]={text:f}}else l.descr={text:i};if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.tags=s;if(typeof o=="object"){let[h,f]=Object.entries(o)[0];l[h]=f}else l.link=o;l.nodeType=t,l.parentBoundary=Ka,l.wrap=jh(),bl=Ka,Ka=e,Xh.push(bl)},"addDeploymentNode"),F9e=v(function(){Ka=bl,Xh.pop(),bl=Xh.pop(),Xh.push(bl)},"popBoundaryParseStack"),z9e=v(function(t,e,r,n,i,a,s,o,l,u,h){let f=wl.find(d=>d.alias===e);if(!(f===void 0&&(f=Sc.find(d=>d.alias===e),f===void 0))){if(r!=null)if(typeof r=="object"){let[d,p]=Object.entries(r)[0];f[d]=p}else f.bgColor=r;if(n!=null)if(typeof n=="object"){let[d,p]=Object.entries(n)[0];f[d]=p}else f.fontColor=n;if(i!=null)if(typeof i=="object"){let[d,p]=Object.entries(i)[0];f[d]=p}else f.borderColor=i;if(a!=null)if(typeof a=="object"){let[d,p]=Object.entries(a)[0];f[d]=p}else f.shadowing=a;if(s!=null)if(typeof s=="object"){let[d,p]=Object.entries(s)[0];f[d]=p}else f.shape=s;if(o!=null)if(typeof o=="object"){let[d,p]=Object.entries(o)[0];f[d]=p}else f.sprite=o;if(l!=null)if(typeof l=="object"){let[d,p]=Object.entries(l)[0];f[d]=p}else f.techn=l;if(u!=null)if(typeof u=="object"){let[d,p]=Object.entries(u)[0];f[d]=p}else f.legendText=u;if(h!=null)if(typeof h=="object"){let[d,p]=Object.entries(h)[0];f[d]=p}else f.legendSprite=h}},"updateElStyle"),$9e=v(function(t,e,r,n,i,a,s){let o=yy.find(l=>l.from===e&&l.to===r);if(o!==void 0){if(n!=null)if(typeof n=="object"){let[l,u]=Object.entries(n)[0];o[l]=u}else o.textColor=n;if(i!=null)if(typeof i=="object"){let[l,u]=Object.entries(i)[0];o[l]=u}else o.lineColor=i;if(a!=null)if(typeof a=="object"){let[l,u]=Object.entries(a)[0];o[l]=parseInt(u)}else o.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[l,u]=Object.entries(s)[0];o[l]=parseInt(u)}else o.offsetY=parseInt(s)}},"updateRelStyle"),G9e=v(function(t,e,r){let n=Mw,i=Dw;if(typeof e=="object"){let a=Object.values(e)[0];n=parseInt(a)}else n=parseInt(e);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(Mw=n),i>=1&&(Dw=i)},"updateLayoutConfig"),U9e=v(function(){return Mw},"getC4ShapeInRow"),V9e=v(function(){return Dw},"getC4BoundaryInRow"),W9e=v(function(){return Ka},"getCurrentBoundaryParse"),H9e=v(function(){return bl},"getParentBoundaryParse"),sne=v(function(t){return t==null?wl:wl.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),q9e=v(function(t){return wl.find(e=>e.alias===t)},"getC4Shape"),Y9e=v(function(t){return Object.keys(sne(t))},"getC4ShapeKeys"),one=v(function(t){return t==null?Sc:Sc.filter(e=>e.parentBoundary===t)},"getBoundaries"),X9e=one,j9e=v(function(){return yy},"getRels"),K9e=v(function(){return p9},"getTitle"),Z9e=v(function(t){g9=t},"setWrap"),jh=v(function(){return g9},"autoWrap"),Q9e=v(function(){wl=[],Sc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],bl="",Ka="global",Xh=[""],yy=[],Xh=[""],p9="",g9=!1,Mw=4,Dw=2},"clear"),J9e={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},eLe={FILLED:0,OPEN:1},tLe={LEFTOF:0,RIGHTOF:1,OVER:2},rLe=v(function(t){p9=yr(t,pe())},"setTitle"),h9={addPersonOrSystem:I9e,addPersonOrSystemBoundary:O9e,addContainer:M9e,addContainerBoundary:P9e,addComponent:D9e,addDeploymentNode:B9e,popBoundaryParseStack:F9e,addRel:N9e,updateElStyle:z9e,updateRelStyle:$9e,updateLayoutConfig:G9e,autoWrap:jh,setWrap:Z9e,getC4ShapeArray:sne,getC4Shape:q9e,getC4ShapeKeys:Y9e,getBoundaries:one,getBoundarys:X9e,getCurrentBoundaryParse:W9e,getParentBoundaryParse:H9e,getRels:j9e,getTitle:K9e,getC4Type:L9e,getC4ShapeInRow:U9e,getC4BoundaryInRow:V9e,setAccTitle:Tr,getAccTitle:_r,getAccDescription:Rr,setAccDescription:Lr,getConfig:v(()=>pe().c4,"getConfig"),clear:Q9e,LINETYPE:J9e,ARROWTYPE:eLe,PLACEMENT:tLe,setTitle:rLe,setC4Type:R9e},m9=v(function(t,e){return Dd(t,e)},"drawRect"),cne=v(function(t,e,r,n,i,a){let s=t.append("image");s.attr("width",e),s.attr("height",r),s.attr("x",n),s.attr("y",i);let o=a.startsWith("data:image/png;base64")?a:(0,lne.sanitizeUrl)(a);s.attr("xlink:href",o)},"drawImage"),nLe=v((t,e,r)=>{let n=t.append("g"),i=0;for(let a of e){let s=a.textColor?a.textColor:"#444444",o=a.lineColor?a.lineColor:"#444444",l=a.offsetX?parseInt(a.offsetX):0,u=a.offsetY?parseInt(a.offsetY):0,h="";if(i===0){let d=n.append("line");d.attr("x1",a.startPoint.x),d.attr("y1",a.startPoint.y),d.attr("x2",a.endPoint.x),d.attr("y2",a.endPoint.y),d.attr("stroke-width","1"),d.attr("stroke",o),d.style("fill","none"),a.type!=="rel_b"&&d.attr("marker-end","url("+h+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&d.attr("marker-start","url("+h+"#arrowend)"),i=-1}else{let d=n.append("path");d.attr("fill","none").attr("stroke-width","1").attr("stroke",o).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",a.startPoint.x).replaceAll("starty",a.startPoint.y).replaceAll("controlx",a.startPoint.x+(a.endPoint.x-a.startPoint.x)/2-(a.endPoint.x-a.startPoint.x)/4).replaceAll("controly",a.startPoint.y+(a.endPoint.y-a.startPoint.y)/2).replaceAll("stopx",a.endPoint.x).replaceAll("stopy",a.endPoint.y)),a.type!=="rel_b"&&d.attr("marker-end","url("+h+"#arrowhead)"),(a.type==="birel"||a.type==="rel_b")&&d.attr("marker-start","url("+h+"#arrowend)")}let f=r.messageFont();Du(r)(a.label.text,n,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+l,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+u,a.label.width,a.label.height,{fill:s},f),a.techn&&a.techn.text!==""&&(f=r.messageFont(),Du(r)("["+a.techn.text+"]",n,Math.min(a.startPoint.x,a.endPoint.x)+Math.abs(a.endPoint.x-a.startPoint.x)/2+l,Math.min(a.startPoint.y,a.endPoint.y)+Math.abs(a.endPoint.y-a.startPoint.y)/2+r.messageFontSize+5+u,Math.max(a.label.width,a.techn.width),a.techn.height,{fill:s,"font-style":"italic"},f))}},"drawRels"),iLe=v(function(t,e,r){let n=t.append("g"),i=e.bgColor?e.bgColor:"none",a=e.borderColor?e.borderColor:"#444444",s=e.fontColor?e.fontColor:"black",o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(o={"stroke-width":1});let l={x:e.x,y:e.y,fill:i,stroke:a,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:o};m9(n,l);let u=r.boundaryFont();u.fontWeight="bold",u.fontSize=u.fontSize+2,u.fontColor=s,Du(r)(e.label.text,n,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},u),e.type&&e.type.text!==""&&(u=r.boundaryFont(),u.fontColor=s,Du(r)(e.type.text,n,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},u)),e.descr&&e.descr.text!==""&&(u=r.boundaryFont(),u.fontSize=u.fontSize-2,u.fontColor=s,Du(r)(e.descr.text,n,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},u))},"drawBoundary"),aLe=v(function(t,e,r){let n=e.bgColor?e.bgColor:r[e.typeC4Shape.text+"_bg_color"],i=e.borderColor?e.borderColor:r[e.typeC4Shape.text+"_border_color"],a=e.fontColor?e.fontColor:"#FFFFFF",s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(e.typeC4Shape.text){case"person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}let o=t.append("g");o.attr("class","person-man");let l=Tc();switch(e.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":l.x=e.x,l.y=e.y,l.fill=n,l.width=e.width,l.height=e.height,l.stroke=i,l.rx=2.5,l.ry=2.5,l.attrs={"stroke-width":.5},m9(o,l);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2).replaceAll("height",e.height)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("half",e.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":o.append("path").attr("fill",n).attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",e.x).replaceAll("starty",e.y).replaceAll("width",e.width).replaceAll("half",e.height/2)),o.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",i).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",e.x+e.width).replaceAll("starty",e.y).replaceAll("half",e.height/2));break}let u=pLe(r,e.typeC4Shape.text);switch(o.append("text").attr("fill",a).attr("font-family",u.fontFamily).attr("font-size",u.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",e.typeC4Shape.width).attr("x",e.x+e.width/2-e.typeC4Shape.width/2).attr("y",e.y+e.typeC4Shape.Y).text("<<"+e.typeC4Shape.text+">>"),e.typeC4Shape.text){case"person":case"external_person":cne(o,48,48,e.x+e.width/2-24,e.y+e.image.Y,s);break}let h=r[e.typeC4Shape.text+"Font"]();return h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=a,Du(r)(e.label.text,o,e.x,e.y+e.label.Y,e.width,e.height,{fill:a},h),h=r[e.typeC4Shape.text+"Font"](),h.fontColor=a,e.techn&&e.techn?.text!==""?Du(r)(e.techn.text,o,e.x,e.y+e.techn.Y,e.width,e.height,{fill:a,"font-style":"italic"},h):e.type&&e.type.text!==""&&Du(r)(e.type.text,o,e.x,e.y+e.type.Y,e.width,e.height,{fill:a,"font-style":"italic"},h),e.descr&&e.descr.text!==""&&(h=r.personFont(),h.fontColor=a,Du(r)(e.descr.text,o,e.x,e.y+e.descr.Y,e.width,e.height,{fill:a},h)),e.height},"drawC4Shape"),sLe=v(function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),oLe=v(function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),lLe=v(function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),cLe=v(function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),uLe=v(function(t){t.append("defs").append("marker").attr("id","arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),hLe=v(function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),fLe=v(function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertDynamicNumber"),dLe=v(function(t){let r=t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);r.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),r.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),pLe=v((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"getC4ShapeFont"),Du=function(){function t(i,a,s,o,l,u,h){let f=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("text-anchor","middle").text(i);n(f,h)}v(t,"byText");function e(i,a,s,o,l,u,h,f){let{fontSize:d,fontFamily:p,fontWeight:g}=f,m=i.split(Xe.lineBreakRegex);for(let y=0;y=this.data.widthLimit||r>=this.data.widthLimit||this.nextData.cnt>une)&&(e=this.nextData.startx+t.margin+Mt.nextLinePaddingX,n=this.nextData.stopy+t.margin*2,this.nextData.stopx=r=e+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=n+t.height,this.nextData.cnt=1),t.x=e,t.y=n,this.updateVal(this.data,"startx",e,Math.min),this.updateVal(this.data,"starty",n,Math.min),this.updateVal(this.data,"stopx",r,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",e,Math.min),this.updateVal(this.nextData,"starty",n,Math.min),this.updateVal(this.nextData,"stopx",r,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},d9(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},d9=v(function(t){Hn(Mt,t),t.fontFamily&&(Mt.personFontFamily=Mt.systemFontFamily=Mt.messageFontFamily=t.fontFamily),t.fontSize&&(Mt.personFontSize=Mt.systemFontSize=Mt.messageFontSize=t.fontSize),t.fontWeight&&(Mt.personFontWeight=Mt.systemFontWeight=Mt.messageFontWeight=t.fontWeight)},"setConf"),vy=v((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"c4ShapeFont"),Nw=v(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),gLe=v(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");v(Fo,"calcC4ShapeTextWH");fne=v(function(t,e,r){e.x=r.data.startx,e.y=r.data.starty,e.width=r.data.stopx-r.data.startx,e.height=r.data.stopy-r.data.starty,e.label.y=Mt.c4ShapeMargin-35;let n=e.wrap&&Mt.wrap,i=Nw(Mt);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=bs(e.label.text,i);Fo("label",e,n,i,a),Ec.drawBoundary(t,e,Mt)},"drawBoundary"),dne=v(function(t,e,r,n){let i=0;for(let a of n){i=0;let s=r[a],o=vy(Mt,s.typeC4Shape.text);switch(o.fontSize=o.fontSize-2,s.typeC4Shape.width=bs("\xAB"+s.typeC4Shape.text+"\xBB",o),s.typeC4Shape.height=o.fontSize+2,s.typeC4Shape.Y=Mt.c4ShapePadding,i=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height);let l=s.wrap&&Mt.wrap,u=Mt.width-Mt.c4ShapePadding*2,h=vy(Mt,s.typeC4Shape.text);if(h.fontSize=h.fontSize+2,h.fontWeight="bold",Fo("label",s,l,h,u),s.label.Y=i+8,i=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let p=vy(Mt,s.typeC4Shape.text);Fo("type",s,l,p,u),s.type.Y=i+5,i=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let p=vy(Mt,s.techn.text);Fo("techn",s,l,p,u),s.techn.Y=i+5,i=s.techn.Y+s.techn.height}let f=i,d=s.label.width;if(s.descr&&s.descr.text!==""){let p=vy(Mt,s.typeC4Shape.text);Fo("descr",s,l,p,u),s.descr.Y=i+20,i=s.descr.Y+s.descr.height,d=Math.max(s.label.width,s.descr.width),f=i-s.descr.textLines*5}d=d+Mt.c4ShapePadding,s.width=Math.max(s.width||Mt.width,d,Mt.width),s.height=Math.max(s.height||Mt.height,f,Mt.height),s.margin=s.margin||Mt.c4ShapeMargin,t.insert(s),Ec.drawC4Shape(e,s,Mt)}t.bumpLastMargin(Mt.c4ShapeMargin)},"drawC4ShapeArray"),Bo=class{static{v(this,"Point")}constructor(t,e){this.x=t,this.y=e}},nne=v(function(t,e){let r=t.x,n=t.y,i=e.x,a=e.y,s=r+t.width/2,o=n+t.height/2,l=Math.abs(r-i),u=Math.abs(n-a),h=u/l,f=t.height/t.width,d=null;return n==a&&ri?d=new Bo(r,o):r==i&&na&&(d=new Bo(s,n)),r>i&&n=h?d=new Bo(r,o+h*t.width/2):d=new Bo(s-l/u*t.height/2,n+t.height):r=h?d=new Bo(r+t.width,o+h*t.width/2):d=new Bo(s+l/u*t.height/2,n+t.height):ra?f>=h?d=new Bo(r+t.width,o-h*t.width/2):d=new Bo(s+t.height/2*l/u,n):r>i&&n>a&&(f>=h?d=new Bo(r,o-t.width/2*h):d=new Bo(s-t.height/2*l/u,n)),d},"getIntersectPoint"),mLe=v(function(t,e){let r={x:0,y:0};r.x=e.x+e.width/2,r.y=e.y+e.height/2;let n=nne(t,r);r.x=t.x+t.width/2,r.y=t.y+t.height/2;let i=nne(e,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),vLe=v(function(t,e,r,n){let i=0;for(let a of e){i=i+1;let s=a.wrap&&Mt.wrap,o=gLe(Mt);n.db.getC4Type()==="C4Dynamic"&&(a.label.text=i+": "+a.label.text);let u=bs(a.label.text,o);Fo("label",a,s,o,u),a.techn&&a.techn.text!==""&&(u=bs(a.techn.text,o),Fo("techn",a,s,o,u)),a.descr&&a.descr.text!==""&&(u=bs(a.descr.text,o),Fo("descr",a,s,o,u));let h=r(a.from),f=r(a.to),d=mLe(h,f);a.startPoint=d.startPoint,a.endPoint=d.endPoint}Ec.drawRels(t,e,Mt)},"drawRels");v(v9,"drawInsideBoundary");yLe=v(function(t,e,r,n){Mt=pe().c4;let i=pe().securityLevel,a;i==="sandbox"&&(a=Ve("#i"+e));let s=i==="sandbox"?Ve(a.nodes()[0].contentDocument.body):Ve("body"),o=n.db;n.db.setWrap(Mt.wrap),une=o.getC4ShapeInRow(),f9=o.getC4BoundaryInRow(),re.debug(`C:${JSON.stringify(Mt,null,2)}`);let l=i==="sandbox"?s.select(`[id="${e}"]`):Ve(`[id="${e}"]`);Ec.insertComputerIcon(l),Ec.insertDatabaseIcon(l),Ec.insertClockIcon(l);let u=new hne(n);u.setData(Mt.diagramMarginX,Mt.diagramMarginX,Mt.diagramMarginY,Mt.diagramMarginY),u.data.widthLimit=screen.availWidth,Ow=Mt.diagramMarginX,Pw=Mt.diagramMarginY;let h=n.db.getTitle(),f=n.db.getBoundarys("");v9(l,"",u,f,n),Ec.insertArrowHead(l),Ec.insertArrowEnd(l),Ec.insertArrowCrossHead(l),Ec.insertArrowFilledHead(l),vLe(l,n.db.getRels(),n.db.getC4Shape,n),u.data.stopx=Ow,u.data.stopy=Pw;let d=u.data,g=d.stopy-d.starty+2*Mt.diagramMarginY,y=d.stopx-d.startx+2*Mt.diagramMarginX;h&&l.append("text").text(h).attr("x",(d.stopx-d.startx)/2-4*Mt.diagramMarginX).attr("y",d.starty+Mt.diagramMarginY),Hr(l,g,y,Mt.useMaxWidth);let x=h?60:0;l.attr("viewBox",d.startx-Mt.diagramMarginX+" -"+(Mt.diagramMarginY+x)+" "+y+" "+(g+x)),re.debug("models:",d)},"draw"),ine={drawPersonOrSystemArray:dne,drawBoundary:fne,setConf:d9,draw:yLe},xLe=v(t=>`.person { stroke: ${t.personBorder}; fill: ${t.personBkg}; } `,"getStyles"),bLe=xLe,wLe={parser:_9e,db:h9,renderer:ine,styles:bLe,init:v(({c4:t,wrap:e})=>{ine.setConf(t),h9.setWrap(e)},"init")}});var Ag,_g,kLe,TLe,Kh=F(()=>{or();lr();Ag=v((t,e)=>{let r;return e==="sandbox"&&(r=Ve("#i"+t)),(e==="sandbox"?Ve(r.nodes()[0].contentDocument.body):Ve("body")).select(`[id="${t}"]`)},"getDiagramElement"),_g=v((t,e,r,n)=>{t.attr("class",r);let{width:i,height:a,x:s,y:o}=kLe(t,e);Hr(t,a,i,n);let l=TLe(s,o,i,a,e);t.attr("viewBox",l),re.debug(`viewBox configured: ${l} with padding: ${e}`)},"setupViewPortForSVG"),kLe=v((t,e)=>{let r=t.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:r.width+e*2,height:r.height+e*2,x:r.x,y:r.y}},"calculateDimensionsWithPadding"),TLe=v((t,e,r,n,i)=>`${t-i} ${e-i} ${r} ${n}`,"createViewBox")});var Vw={};vr(Vw,{diagram:()=>cRe});function Fw(t){let e=[];for(let r of t){let n=by.get(r);n?.styles&&(e=[...e,...n.styles??[]].map(i=>i.trim())),n?.textStyles&&(e=[...e,...n.textStyles??[]].map(i=>i.trim()))}return e}var ELe,mne,Lg,Zh,_s,by,Ou,w9,k9,Bw,x9,zo,zw,$w,Gw,Uw,SLe,CLe,ALe,_Le,LLe,RLe,NLe,T9,ILe,MLe,DLe,vne,OLe,PLe,yne,xne,bne,BLe,wne,FLe,zLe,$Le,GLe,ULe,xy,kne,Tne,VLe,WLe,Ene,HLe,qLe,YLe,XLe,jLe,Sne,Cne,KLe,ZLe,QLe,JLe,eRe,tRe,y9,rRe,nRe,iRe,b9,aRe,sRe,oRe,lRe,cRe,Ww=F(()=>{Kh();r4();Nu();_u();yl();sl();pc();bo();Ya();kn();or();lr();lr();go();ELe="flowchart-",mne=0,Lg=pe(),Zh=new Map,_s=[],by=new Map,Ou=[],w9=new Map,k9=new Map,Bw=0,x9=!0,$w=[],Gw=v(t=>Xe.sanitizeText(t,Lg),"sanitizeText"),Uw=v(function(t){for(let e of Zh.values())if(e.id===t)return e.domId;return t},"lookUpDomId"),SLe=v(function(t,e,r,n,i,a,s={},o){if(!t||t.trim().length===0)return;let l,u=Zh.get(t);if(u===void 0&&(u={id:t,labelType:"text",domId:ELe+t+"-"+mne,styles:[],classes:[]},Zh.set(t,u)),mne++,e!==void 0?(Lg=pe(),l=Gw(e.text.trim()),u.labelType=e.type,l.startsWith('"')&&l.endsWith('"')&&(l=l.substring(1,l.length-1)),u.text=l):u.text===void 0&&(u.text=t),r!==void 0&&(u.type=r),n?.forEach(function(h){u.styles.push(h)}),i?.forEach(function(h){u.classes.push(h)}),a!==void 0&&(u.dir=a),u.props===void 0?u.props=s:s!==void 0&&Object.assign(u.props,s),o!==void 0){let h;o.includes(` `)?h=o+` `:h=`{ `+o+` }`;let f=sp(h,{schema:ap});if(f.shape){if(f.shape!==f.shape.toLowerCase()||f.shape.includes("_"))throw new Error(`No such shape: ${f.shape}. Shape names should be lowercase.`);if(!WA(f.shape))throw new Error(`No such shape: ${f.shape}.`);u.type=f?.shape}f?.label&&(u.text=f?.label),f?.icon&&(u.icon=f?.icon,!f.label?.trim()&&u.text===t&&(u.text="")),f?.form&&(u.form=f?.form),f?.pos&&(u.pos=f?.pos),f?.img&&(u.img=f?.img,!f.label?.trim()&&u.text===t&&(u.text="")),f?.constraint&&(u.constraint=f.constraint),f.w&&(u.assetWidth=Number(f.w)),f.h&&(u.assetHeight=Number(f.h))}},"addVertex"),CLe=v(function(t,e,r){let a={start:t,end:e,type:void 0,text:"",labelType:"text"};re.info("abc78 Got edge...",a);let s=r.text;if(s!==void 0&&(a.text=Gw(s.text.trim()),a.text.startsWith('"')&&a.text.endsWith('"')&&(a.text=a.text.substring(1,a.text.length-1)),a.labelType=s.type),r!==void 0&&(a.type=r.type,a.stroke=r.stroke,a.length=r.length>10?10:r.length),_s.length<(Lg.maxEdges??500))re.info("Pushing edge..."),_s.push(a);else throw new Error(`Edge limit exceeded. ${_s.length} edges found, but the limit is ${Lg.maxEdges}. Initialize mermaid with maxEdges set to a higher number to allow more edges. You cannot set this config via configuration inside the diagram as it is a secure config. You have to call mermaid.initialize.`)},"addSingleLink"),ALe=v(function(t,e,r){re.info("addLink",t,e,r);for(let n of t)for(let i of e)CLe(n,i,r)},"addLink"),_Le=v(function(t,e){t.forEach(function(r){r==="default"?_s.defaultInterpolate=e:_s[r].interpolate=e})},"updateLinkInterpolate"),LLe=v(function(t,e){t.forEach(function(r){if(typeof r=="number"&&r>=_s.length)throw new Error(`The index ${r} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${_s.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);r==="default"?_s.defaultStyle=e:(_s[r].style=e,(_s[r]?.style?.length??0)>0&&!_s[r]?.style?.some(n=>n?.startsWith("fill"))&&_s[r]?.style?.push("fill:none"))})},"updateLink"),RLe=v(function(t,e){t.split(",").forEach(function(r){let n=by.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},by.set(r,n)),e?.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)})})},"addClass"),NLe=v(function(t){zo=t,/.*/.exec(zo)&&(zo="LR"),/.*v/.exec(zo)&&(zo="TB"),zo==="TD"&&(zo="TB")},"setDirection"),T9=v(function(t,e){for(let r of t.split(",")){let n=Zh.get(r);n&&n.classes.push(e);let i=w9.get(r);i&&i.classes.push(e)}},"setClass"),ILe=v(function(t,e){if(e!==void 0){e=Gw(e);for(let r of t.split(","))k9.set(zw==="gen-1"?Uw(r):r,e)}},"setTooltip"),MLe=v(function(t,e,r){let n=Uw(t);if(pe().securityLevel!=="loose"||e===void 0)return;let i=[];if(typeof r=="string"){i=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let s=0;s")),i.classed("hover",!0)}).on("mouseout",function(){e.transition().duration(500).style("opacity",0),Ve(this).classed("hover",!1)})},"setupToolTips");$w.push(wne);FLe=v(function(t="gen-1"){Zh=new Map,by=new Map,_s=[],$w=[wne],Ou=[],w9=new Map,Bw=0,k9=new Map,x9=!0,zw=t,Lg=pe(),xr()},"clear"),zLe=v(t=>{zw=t||"gen-2"},"setGen"),$Le=v(function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"},"defaultStyle"),GLe=v(function(t,e,r){let n=t.text.trim(),i=r.text;t===r&&/\s/.exec(r.text)&&(n=void 0);function a(u){let h={boolean:{},number:{},string:{}},f=[],d;return{nodeList:u.filter(function(g){let m=typeof g;return g.stmt&&g.stmt==="dir"?(d=g.value,!1):g.trim()===""?!1:m in h?h[m].hasOwnProperty(g)?!1:h[m][g]=!0:f.includes(g)?!1:f.push(g)}),dir:d}}v(a,"uniq");let{nodeList:s,dir:o}=a(e.flat());if(zw==="gen-1")for(let u=0;u2e3)return{result:!1,count:0};if(kne[xy]=e,Ou[e].id===t)return{result:!0,count:0};let n=0,i=1;for(;n=0){let s=Tne(t,a);if(s.result)return{result:!0,count:i+s.count};i=i+s.count}n=n+1}return{result:!1,count:i}},"indexNodes2"),VLe=v(function(t){return kne[t]},"getDepthFirstPos"),WLe=v(function(){xy=-1,Ou.length>0&&Tne("none",Ou.length-1)},"indexNodes"),Ene=v(function(){return Ou},"getSubGraphs"),HLe=v(()=>x9?(x9=!1,!0):!1,"firstGraph"),qLe=v(t=>{let e=t.trim(),r="arrow_open";switch(e[0]){case"<":r="arrow_point",e=e.slice(1);break;case"x":r="arrow_cross",e=e.slice(1);break;case"o":r="arrow_circle",e=e.slice(1);break}let n="normal";return e.includes("=")&&(n="thick"),e.includes(".")&&(n="dotted"),{type:r,stroke:n}},"destructStartLink"),YLe=v((t,e)=>{let r=e.length,n=0;for(let i=0;i{let e=t.trim(),r=e.slice(0,-1),n="arrow_open";switch(e.slice(-1)){case"x":n="arrow_cross",e.startsWith("x")&&(n="double_"+n,r=r.slice(1));break;case">":n="arrow_point",e.startsWith("<")&&(n="double_"+n,r=r.slice(1));break;case"o":n="arrow_circle",e.startsWith("o")&&(n="double_"+n,r=r.slice(1));break}let i="normal",a=r.length-1;r.startsWith("=")&&(i="thick"),r.startsWith("~")&&(i="invisible");let s=YLe(".",r);return s&&(i="dotted",a=s),{type:n,stroke:i,length:a}},"destructEndLink"),jLe=v((t,e)=>{let r=XLe(t),n;if(e){if(n=qLe(e),n.stroke!==r.stroke)return{type:"INVALID",stroke:"INVALID"};if(n.type==="arrow_open")n.type=r.type;else{if(n.type!==r.type)return{type:"INVALID",stroke:"INVALID"};n.type="double_"+n.type}return n.type==="double_arrow"&&(n.type="double_arrow_point"),n.length=r.length,n}return r},"destructLink"),Sne=v((t,e)=>{for(let r of t)if(r.nodes.includes(e))return!0;return!1},"exists"),Cne=v((t,e)=>{let r=[];return t.nodes.forEach((n,i)=>{Sne(e,n)||r.push(t.nodes[i])}),{nodes:r}},"makeUniq"),KLe={firstGraph:HLe},ZLe=v(t=>{if(t.img)return"imageSquare";if(t.icon)return t.form==="circle"?"iconCircle":t.form==="square"?"iconSquare":t.form==="rounded"?"iconRounded":"icon";switch(t.type){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return t.type}},"getTypeFromVertex"),QLe=v((t,e)=>t.find(r=>r.id===e),"findNode"),JLe=v(t=>{let e="none",r="arrow_point";switch(t){case"arrow_point":case"arrow_circle":case"arrow_cross":r=t;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":e=t.replace("double_",""),r=e;break}return{arrowTypeStart:e,arrowTypeEnd:r}},"destructEdgeType"),eRe=v((t,e,r,n,i,a)=>{let s=r.get(t.id),o=n.get(t.id)??!1,l=QLe(e,t.id);if(l)l.cssStyles=t.styles,l.cssCompiledStyles=Fw(t.classes),l.cssClasses=t.classes.join(" ");else{let u={id:t.id,label:t.text,labelStyle:"",parentId:s,padding:i.flowchart?.padding||8,cssStyles:t.styles,cssCompiledStyles:Fw(["default","node",...t.classes]),cssClasses:"default "+t.classes.join(" "),dir:t.dir,domId:t.domId,look:a,link:t.link,linkTarget:t.linkTarget,tooltip:vne(t.id),icon:t.icon,pos:t.pos,img:t.img,assetWidth:t.assetWidth,assetHeight:t.assetHeight,constraint:t.constraint};o?e.push({...u,isGroup:!0,shape:"rect"}):e.push({...u,isGroup:!1,shape:ZLe(t)})}},"addNodeFromVertex");v(Fw,"getCompiledStyles");tRe=v(()=>{let t=pe(),e=[],r=[],n=Ene(),i=new Map,a=new Map;for(let l=n.length-1;l>=0;l--){let u=n[l];u.nodes.length>0&&a.set(u.id,!0);for(let h of u.nodes)i.set(h,u.id)}for(let l=n.length-1;l>=0;l--){let u=n[l];e.push({id:u.id,label:u.title,labelStyle:"",parentId:i.get(u.id),padding:8,cssCompiledStyles:Fw(u.classes),cssClasses:u.classes.join(" "),shape:"rect",dir:u.dir,isGroup:!0,look:t.look})}xne().forEach(l=>{eRe(l,e,i,a,t,t.look||"classic")});let o=bne();return o.forEach((l,u)=>{let{arrowTypeStart:h,arrowTypeEnd:f}=JLe(l.type),d=[...o.defaultStyle??[]];l.style&&d.push(...l.style);let p={id:V3(l.start,l.end,{counter:u,prefix:"L"}),start:l.start,end:l.end,type:l.type??"normal",label:l.text,labelpos:"c",thickness:l.stroke,minlen:l.length,classes:l?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:l?.stroke==="invisible"?"none":h,arrowTypeEnd:l?.stroke==="invisible"?"none":f,arrowheadStyle:"fill: #333",labelStyle:d,style:d,pattern:l.stroke,look:t.look};r.push(p)}),{nodes:e,edges:r,other:{},config:t}},"getData"),y9={defaultConfig:v(()=>Vb.flowchart,"defaultConfig"),setAccTitle:Tr,getAccTitle:_r,getAccDescription:Rr,getData:tRe,setAccDescription:Lr,addVertex:SLe,lookUpDomId:Uw,addLink:ALe,updateLinkInterpolate:_Le,updateLink:LLe,addClass:RLe,setDirection:NLe,setClass:T9,setTooltip:ILe,getTooltip:vne,setClickEvent:OLe,setLink:DLe,bindFunctions:PLe,getDirection:yne,getVertices:xne,getEdges:bne,getClasses:BLe,clear:FLe,setGen:zLe,defaultStyle:$Le,addSubGraph:GLe,getDepthFirstPos:VLe,indexNodes:WLe,getSubGraphs:Ene,destructLink:jLe,lex:KLe,exists:Sne,makeUniq:Cne,setDiagramTitle:tn,getDiagramTitle:qr},rRe=v(function(t,e){return e.db.getClasses()},"getClasses"),nRe=v(async function(t,e,r,n){re.info("REF0:"),re.info("Drawing state diagram (v2)",e);let{securityLevel:i,flowchart:a,layout:s}=pe(),o;i==="sandbox"&&(o=Ve("#i"+e));let l=i==="sandbox"?o.nodes()[0].contentDocument:document;re.debug("Before getData: ");let u=n.db.getData();re.debug("Data: ",u);let h=Ag(e,i),f=yne();u.type=n.type,u.layoutAlgorithm=vw(s),u.layoutAlgorithm==="dagre"&&s==="elk"&&re.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),u.direction=f,u.nodeSpacing=a?.nodeSpacing||50,u.rankSpacing=a?.rankSpacing||50,u.markers=["point","circle","cross"],u.diagramId=e,re.debug("REF1:",u),await kg(u,h);let d=u.config.flowchart?.diagramPadding??8;Ut.insertTitle(h,"flowchartTitleText",a?.titleTopMargin||0,n.db.getDiagramTitle()),_g(h,d,"flowchart",a?.useMaxWidth||!1);for(let p of u.nodes){let g=Ve(`#${e} [id="${p.id}"]`);if(!g||!p.link)continue;let m=l.createElementNS("http://www.w3.org/2000/svg","a");m.setAttributeNS("http://www.w3.org/2000/svg","class",p.cssClasses),m.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),i==="sandbox"?m.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):p.linkTarget&&m.setAttributeNS("http://www.w3.org/2000/svg","target",p.linkTarget);let y=g.insert(function(){return m},":first-child"),x=g.select(".label-container");x&&y.append(function(){return x.node()});let b=g.select(".label");b&&y.append(function(){return b.node()})}},"draw"),iRe={getClasses:rRe,draw:nRe},b9=function(){var t=v(function($i,pt,Rt,wt){for(Rt=Rt||{},wt=$i.length;wt--;Rt[$i[wt]]=pt);return Rt},"o"),e=[1,4],r=[1,3],n=[1,5],i=[1,8,9,10,11,27,34,36,38,44,60,83,84,85,86,87,88,101,104,105,108,110,113,114,115,120,121,122,123],a=[2,2],s=[1,13],o=[1,14],l=[1,15],u=[1,16],h=[1,23],f=[1,25],d=[1,26],p=[1,27],g=[1,49],m=[1,48],y=[1,29],x=[1,30],b=[1,31],w=[1,32],_=[1,33],k=[1,44],E=[1,46],L=[1,42],S=[1,47],C=[1,43],M=[1,50],R=[1,45],T=[1,51],I=[1,52],A=[1,34],D=[1,35],N=[1,36],O=[1,37],B=[1,57],P=[1,8,9,10,11,27,32,34,36,38,44,60,83,84,85,86,87,88,101,104,105,108,110,113,114,115,120,121,122,123],$=[1,61],z=[1,60],H=[1,62],J=[8,9,11,75,77],X=[1,77],oe=[1,90],K=[1,95],ee=[1,94],Q=[1,91],W=[1,87],Y=[1,93],Z=[1,89],se=[1,96],ce=[1,92],ue=[1,97],te=[1,88],Ne=[8,9,10,11,40,75,77],ae=[8,9,10,11,40,46,75,77],we=[8,9,10,11,29,40,44,46,48,50,52,54,56,58,60,63,65,67,68,70,75,77,88,101,104,105,108,110,113,114,115],Ie=[8,9,11,44,60,75,77,88,101,104,105,108,110,113,114,115],Ee=[44,60,88,101,104,105,108,110,113,114,115],Oe=[1,123],De=[1,122],We=[1,130],Re=[1,144],Pe=[1,145],xe=[1,146],q=[1,147],de=[1,132],ie=[1,134],he=[1,138],U=[1,139],ke=[1,140],j=[1,141],ye=[1,142],Ae=[1,143],Ge=[1,148],Fe=[1,149],ge=[1,128],$e=[1,129],Ce=[1,136],qe=[1,131],lt=[1,135],xt=[1,133],ft=[8,9,10,11,27,32,34,36,38,44,60,83,84,85,86,87,88,101,104,105,108,110,113,114,115,120,121,122,123],Ze=[1,151],st=[1,153],Ue=[8,9,11],Ke=[8,9,10,11,14,44,60,88,104,105,108,110,113,114,115],it=[1,173],mt=[1,169],Ht=[1,170],ot=[1,174],et=[1,171],ht=[1,172],bt=[77,115,118],tt=[8,9,10,11,12,14,27,29,32,44,60,75,83,84,85,86,87,88,89,104,108,110,113,114,115],_t=[10,105],ur=[31,49,51,53,55,57,62,64,66,67,69,71,115,116,117],Qt=[1,242],Jt=[1,240],en=[1,244],Cr=[1,238],Kn=[1,239],cn=[1,241],Rn=[1,243],Vr=[1,245],xi=[1,263],Fa=[8,9,11,105],yn=[8,9,10,11,60,83,104,105,108,109,110,111],os={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,SEMI:8,NEWLINE:9,SPACE:10,EOF:11,GRAPH:12,NODIR:13,DIR:14,FirstStmtSeparator:15,ending:16,endToken:17,spaceList:18,spaceListNewline:19,vertexStatement:20,separator:21,styleStatement:22,linkStyleStatement:23,classDefStatement:24,classStatement:25,clickStatement:26,subgraph:27,textNoTags:28,SQS:29,text:30,SQE:31,end:32,direction:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,shapeData:39,SHAPE_DATA:40,link:41,node:42,styledVertex:43,AMP:44,vertex:45,STYLE_SEPARATOR:46,idString:47,DOUBLECIRCLESTART:48,DOUBLECIRCLEEND:49,PS:50,PE:51,"(-":52,"-)":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,"NODE_STRING[field]":59,COLON:60,"NODE_STRING[value]":61,PIPE:62,CYLINDERSTART:63,CYLINDEREND:64,DIAMOND_START:65,DIAMOND_STOP:66,TAGEND:67,TRAPSTART:68,TRAPEND:69,INVTRAPSTART:70,INVTRAPEND:71,linkStatement:72,arrowText:73,TESTSTR:74,START_LINK:75,edgeText:76,LINK:77,edgeTextToken:78,STR:79,MD_STR:80,textToken:81,keywords:82,STYLE:83,LINKSTYLE:84,CLASSDEF:85,CLASS:86,CLICK:87,DOWN:88,UP:89,textNoTagsToken:90,stylesOpt:91,"idString[vertex]":92,"idString[class]":93,CALLBACKNAME:94,CALLBACKARGS:95,HREF:96,LINK_TARGET:97,"STR[link]":98,"STR[tooltip]":99,alphaNum:100,DEFAULT:101,numList:102,INTERPOLATE:103,NUM:104,COMMA:105,style:106,styleComponent:107,NODE_STRING:108,UNIT:109,BRKT:110,PCT:111,idStringToken:112,MINUS:113,MULT:114,UNICODE_TEXT:115,TEXT:116,TAGSTART:117,EDGE_TEXT:118,alphaNumToken:119,direction_tb:120,direction_bt:121,direction_rl:122,direction_lr:123,$accept:0,$end:1},terminals_:{2:"error",8:"SEMI",9:"NEWLINE",10:"SPACE",11:"EOF",12:"GRAPH",13:"NODIR",14:"DIR",27:"subgraph",29:"SQS",31:"SQE",32:"end",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",40:"SHAPE_DATA",44:"AMP",46:"STYLE_SEPARATOR",48:"DOUBLECIRCLESTART",49:"DOUBLECIRCLEEND",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"VERTEX_WITH_PROPS_START",59:"NODE_STRING[field]",60:"COLON",61:"NODE_STRING[value]",62:"PIPE",63:"CYLINDERSTART",64:"CYLINDEREND",65:"DIAMOND_START",66:"DIAMOND_STOP",67:"TAGEND",68:"TRAPSTART",69:"TRAPEND",70:"INVTRAPSTART",71:"INVTRAPEND",74:"TESTSTR",75:"START_LINK",77:"LINK",79:"STR",80:"MD_STR",83:"STYLE",84:"LINKSTYLE",85:"CLASSDEF",86:"CLASS",87:"CLICK",88:"DOWN",89:"UP",92:"idString[vertex]",93:"idString[class]",94:"CALLBACKNAME",95:"CALLBACKARGS",96:"HREF",97:"LINK_TARGET",98:"STR[link]",99:"STR[tooltip]",101:"DEFAULT",103:"INTERPOLATE",104:"NUM",105:"COMMA",108:"NODE_STRING",109:"UNIT",110:"BRKT",111:"PCT",113:"MINUS",114:"MULT",115:"UNICODE_TEXT",116:"TEXT",117:"TAGSTART",118:"EDGE_TEXT",120:"direction_tb",121:"direction_bt",122:"direction_rl",123:"direction_lr"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[39,2],[39,1],[20,4],[20,3],[20,4],[20,2],[20,2],[20,1],[42,1],[42,6],[42,5],[43,1],[43,3],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,8],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[41,2],[41,3],[41,3],[41,1],[41,3],[76,1],[76,2],[76,1],[76,1],[72,1],[73,3],[30,1],[30,2],[30,1],[30,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[82,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[102,1],[102,3],[91,1],[91,3],[106,1],[106,2],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[112,1],[81,1],[81,1],[81,1],[81,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[90,1],[78,1],[78,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[119,1],[47,1],[47,2],[100,1],[100,2],[33,1],[33,1],[33,1],[33,1]],performAction:v(function(pt,Rt,wt,He,yt,fe,un){var me=fe.length-1;switch(yt){case 2:this.$=[];break;case 3:(!Array.isArray(fe[me])||fe[me].length>0)&&fe[me-1].push(fe[me]),this.$=fe[me-1];break;case 4:case 181:this.$=fe[me];break;case 11:He.setDirection("TB"),this.$="TB";break;case 12:He.setDirection(fe[me-1]),this.$=fe[me-1];break;case 27:this.$=fe[me-1].nodes;break;case 28:case 29:case 30:case 31:case 32:this.$=[];break;case 33:this.$=He.addSubGraph(fe[me-6],fe[me-1],fe[me-4]);break;case 34:this.$=He.addSubGraph(fe[me-3],fe[me-1],fe[me-3]);break;case 35:this.$=He.addSubGraph(void 0,fe[me-1],void 0);break;case 37:this.$=fe[me].trim(),He.setAccTitle(this.$);break;case 38:case 39:this.$=fe[me].trim(),He.setAccDescription(this.$);break;case 43:this.$=fe[me-1]+fe[me];break;case 44:this.$=fe[me];break;case 45:He.addVertex(fe[me-1][0],void 0,void 0,void 0,void 0,void 0,void 0,fe[me]),He.addLink(fe[me-3].stmt,fe[me-1],fe[me-2]),this.$={stmt:fe[me-1],nodes:fe[me-1].concat(fe[me-3].nodes)};break;case 46:He.addLink(fe[me-2].stmt,fe[me],fe[me-1]),this.$={stmt:fe[me],nodes:fe[me].concat(fe[me-2].nodes)};break;case 47:He.addLink(fe[me-3].stmt,fe[me-1],fe[me-2]),this.$={stmt:fe[me-1],nodes:fe[me-1].concat(fe[me-3].nodes)};break;case 48:this.$={stmt:fe[me-1],nodes:fe[me-1]};break;case 49:He.addVertex(fe[me-1][0],void 0,void 0,void 0,void 0,void 0,void 0,fe[me]),this.$={stmt:fe[me-1],nodes:fe[me-1],shapeData:fe[me]};break;case 50:this.$={stmt:fe[me],nodes:fe[me]};break;case 51:this.$=[fe[me]];break;case 52:He.addVertex(fe[me-5][0],void 0,void 0,void 0,void 0,void 0,void 0,fe[me-4]),this.$=fe[me-5].concat(fe[me]);break;case 53:this.$=fe[me-4].concat(fe[me]);break;case 54:this.$=fe[me];break;case 55:this.$=fe[me-2],He.setClass(fe[me-2],fe[me]);break;case 56:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"square");break;case 57:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"doublecircle");break;case 58:this.$=fe[me-5],He.addVertex(fe[me-5],fe[me-2],"circle");break;case 59:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"ellipse");break;case 60:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"stadium");break;case 61:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"subroutine");break;case 62:this.$=fe[me-7],He.addVertex(fe[me-7],fe[me-1],"rect",void 0,void 0,void 0,Object.fromEntries([[fe[me-5],fe[me-3]]]));break;case 63:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"cylinder");break;case 64:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"round");break;case 65:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"diamond");break;case 66:this.$=fe[me-5],He.addVertex(fe[me-5],fe[me-2],"hexagon");break;case 67:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"odd");break;case 68:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"trapezoid");break;case 69:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"inv_trapezoid");break;case 70:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"lean_right");break;case 71:this.$=fe[me-3],He.addVertex(fe[me-3],fe[me-1],"lean_left");break;case 72:this.$=fe[me],He.addVertex(fe[me]);break;case 73:fe[me-1].text=fe[me],this.$=fe[me-1];break;case 74:case 75:fe[me-2].text=fe[me-1],this.$=fe[me-2];break;case 76:this.$=fe[me];break;case 77:var za=He.destructLink(fe[me],fe[me-2]);this.$={type:za.type,stroke:za.stroke,length:za.length,text:fe[me-1]};break;case 78:this.$={text:fe[me],type:"text"};break;case 79:this.$={text:fe[me-1].text+""+fe[me],type:fe[me-1].type};break;case 80:this.$={text:fe[me],type:"string"};break;case 81:this.$={text:fe[me],type:"markdown"};break;case 82:var za=He.destructLink(fe[me]);this.$={type:za.type,stroke:za.stroke,length:za.length};break;case 83:this.$=fe[me-1];break;case 84:this.$={text:fe[me],type:"text"};break;case 85:this.$={text:fe[me-1].text+""+fe[me],type:fe[me-1].type};break;case 86:this.$={text:fe[me],type:"string"};break;case 87:case 102:this.$={text:fe[me],type:"markdown"};break;case 99:this.$={text:fe[me],type:"text"};break;case 100:this.$={text:fe[me-1].text+""+fe[me],type:fe[me-1].type};break;case 101:this.$={text:fe[me],type:"text"};break;case 103:this.$=fe[me-4],He.addClass(fe[me-2],fe[me]);break;case 104:this.$=fe[me-4],He.setClass(fe[me-2],fe[me]);break;case 105:case 113:this.$=fe[me-1],He.setClickEvent(fe[me-1],fe[me]);break;case 106:case 114:this.$=fe[me-3],He.setClickEvent(fe[me-3],fe[me-2]),He.setTooltip(fe[me-3],fe[me]);break;case 107:this.$=fe[me-2],He.setClickEvent(fe[me-2],fe[me-1],fe[me]);break;case 108:this.$=fe[me-4],He.setClickEvent(fe[me-4],fe[me-3],fe[me-2]),He.setTooltip(fe[me-4],fe[me]);break;case 109:this.$=fe[me-2],He.setLink(fe[me-2],fe[me]);break;case 110:this.$=fe[me-4],He.setLink(fe[me-4],fe[me-2]),He.setTooltip(fe[me-4],fe[me]);break;case 111:this.$=fe[me-4],He.setLink(fe[me-4],fe[me-2],fe[me]);break;case 112:this.$=fe[me-6],He.setLink(fe[me-6],fe[me-4],fe[me]),He.setTooltip(fe[me-6],fe[me-2]);break;case 115:this.$=fe[me-1],He.setLink(fe[me-1],fe[me]);break;case 116:this.$=fe[me-3],He.setLink(fe[me-3],fe[me-2]),He.setTooltip(fe[me-3],fe[me]);break;case 117:this.$=fe[me-3],He.setLink(fe[me-3],fe[me-2],fe[me]);break;case 118:this.$=fe[me-5],He.setLink(fe[me-5],fe[me-4],fe[me]),He.setTooltip(fe[me-5],fe[me-2]);break;case 119:this.$=fe[me-4],He.addVertex(fe[me-2],void 0,void 0,fe[me]);break;case 120:this.$=fe[me-4],He.updateLink([fe[me-2]],fe[me]);break;case 121:this.$=fe[me-4],He.updateLink(fe[me-2],fe[me]);break;case 122:this.$=fe[me-8],He.updateLinkInterpolate([fe[me-6]],fe[me-2]),He.updateLink([fe[me-6]],fe[me]);break;case 123:this.$=fe[me-8],He.updateLinkInterpolate(fe[me-6],fe[me-2]),He.updateLink(fe[me-6],fe[me]);break;case 124:this.$=fe[me-6],He.updateLinkInterpolate([fe[me-4]],fe[me]);break;case 125:this.$=fe[me-6],He.updateLinkInterpolate(fe[me-4],fe[me]);break;case 126:case 128:this.$=[fe[me]];break;case 127:case 129:fe[me-2].push(fe[me]),this.$=fe[me-2];break;case 131:this.$=fe[me-1]+fe[me];break;case 179:this.$=fe[me];break;case 180:this.$=fe[me-1]+""+fe[me];break;case 182:this.$=fe[me-1]+""+fe[me];break;case 183:this.$={stmt:"dir",value:"TB"};break;case 184:this.$={stmt:"dir",value:"BT"};break;case 185:this.$={stmt:"dir",value:"RL"};break;case 186:this.$={stmt:"dir",value:"LR"};break}},"anonymous"),table:[{3:1,4:2,9:e,10:r,12:n},{1:[3]},t(i,a,{5:6}),{4:7,9:e,10:r,12:n},{4:8,9:e,10:r,12:n},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,33:24,34:f,36:d,38:p,42:28,43:38,44:g,45:39,47:40,60:m,83:y,84:x,85:b,86:w,87:_,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I,120:A,121:D,122:N,123:O},t(i,[2,9]),t(i,[2,10]),t(i,[2,11]),{8:[1,54],9:[1,55],10:B,15:53,18:56},t(P,[2,3]),t(P,[2,4]),t(P,[2,5]),t(P,[2,6]),t(P,[2,7]),t(P,[2,8]),{8:$,9:z,11:H,21:58,41:59,72:63,75:[1,64],77:[1,65]},{8:$,9:z,11:H,21:66},{8:$,9:z,11:H,21:67},{8:$,9:z,11:H,21:68},{8:$,9:z,11:H,21:69},{8:$,9:z,11:H,21:70},{8:$,9:z,10:[1,71],11:H,21:72},t(P,[2,36]),{35:[1,73]},{37:[1,74]},t(P,[2,39]),t(J,[2,50],{18:75,39:76,10:B,40:X}),{10:[1,78]},{10:[1,79]},{10:[1,80]},{10:[1,81]},{14:oe,44:K,60:ee,79:[1,85],88:Q,94:[1,82],96:[1,83],100:84,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te,119:86},t(P,[2,183]),t(P,[2,184]),t(P,[2,185]),t(P,[2,186]),t(Ne,[2,51]),t(Ne,[2,54],{46:[1,98]}),t(ae,[2,72],{112:111,29:[1,99],44:g,48:[1,100],50:[1,101],52:[1,102],54:[1,103],56:[1,104],58:[1,105],60:m,63:[1,106],65:[1,107],67:[1,108],68:[1,109],70:[1,110],88:k,101:E,104:L,105:S,108:C,110:M,113:R,114:T,115:I}),t(we,[2,179]),t(we,[2,140]),t(we,[2,141]),t(we,[2,142]),t(we,[2,143]),t(we,[2,144]),t(we,[2,145]),t(we,[2,146]),t(we,[2,147]),t(we,[2,148]),t(we,[2,149]),t(we,[2,150]),t(i,[2,12]),t(i,[2,18]),t(i,[2,19]),{9:[1,112]},t(Ie,[2,26],{18:113,10:B}),t(P,[2,27]),{42:114,43:38,44:g,45:39,47:40,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},t(P,[2,40]),t(P,[2,41]),t(P,[2,42]),t(Ee,[2,76],{73:115,62:[1,117],74:[1,116]}),{76:118,78:119,79:[1,120],80:[1,121],115:Oe,118:De},t([44,60,62,74,88,101,104,105,108,110,113,114,115],[2,82]),t(P,[2,28]),t(P,[2,29]),t(P,[2,30]),t(P,[2,31]),t(P,[2,32]),{10:We,12:Re,14:Pe,27:xe,28:124,32:q,44:de,60:ie,75:he,79:[1,126],80:[1,127],82:137,83:U,84:ke,85:j,86:ye,87:Ae,88:Ge,89:Fe,90:125,104:ge,108:$e,110:Ce,113:qe,114:lt,115:xt},t(ft,a,{5:150}),t(P,[2,37]),t(P,[2,38]),t(J,[2,48],{44:Ze}),t(J,[2,49],{18:152,10:B,40:st}),t(Ne,[2,44]),{44:g,47:154,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},{101:[1,155],102:156,104:[1,157]},{44:g,47:158,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},{44:g,47:159,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},t(Ue,[2,105],{10:[1,160],95:[1,161]}),{79:[1,162]},t(Ue,[2,113],{119:164,10:[1,163],14:oe,44:K,60:ee,88:Q,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te}),t(Ue,[2,115],{10:[1,165]}),t(Ke,[2,181]),t(Ke,[2,168]),t(Ke,[2,169]),t(Ke,[2,170]),t(Ke,[2,171]),t(Ke,[2,172]),t(Ke,[2,173]),t(Ke,[2,174]),t(Ke,[2,175]),t(Ke,[2,176]),t(Ke,[2,177]),t(Ke,[2,178]),{44:g,47:166,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},{30:167,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:175,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:177,50:[1,176],67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:178,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:179,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:180,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{108:[1,181]},{30:182,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:183,65:[1,184],67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:185,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:186,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{30:187,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},t(we,[2,180]),t(i,[2,20]),t(Ie,[2,25]),t(J,[2,46],{39:188,18:189,10:B,40:X}),t(Ee,[2,73],{10:[1,190]}),{10:[1,191]},{30:192,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{77:[1,193],78:194,115:Oe,118:De},t(bt,[2,78]),t(bt,[2,80]),t(bt,[2,81]),t(bt,[2,166]),t(bt,[2,167]),{8:$,9:z,10:We,11:H,12:Re,14:Pe,21:196,27:xe,29:[1,195],32:q,44:de,60:ie,75:he,82:137,83:U,84:ke,85:j,86:ye,87:Ae,88:Ge,89:Fe,90:197,104:ge,108:$e,110:Ce,113:qe,114:lt,115:xt},t(tt,[2,99]),t(tt,[2,101]),t(tt,[2,102]),t(tt,[2,155]),t(tt,[2,156]),t(tt,[2,157]),t(tt,[2,158]),t(tt,[2,159]),t(tt,[2,160]),t(tt,[2,161]),t(tt,[2,162]),t(tt,[2,163]),t(tt,[2,164]),t(tt,[2,165]),t(tt,[2,88]),t(tt,[2,89]),t(tt,[2,90]),t(tt,[2,91]),t(tt,[2,92]),t(tt,[2,93]),t(tt,[2,94]),t(tt,[2,95]),t(tt,[2,96]),t(tt,[2,97]),t(tt,[2,98]),{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,198],33:24,34:f,36:d,38:p,42:28,43:38,44:g,45:39,47:40,60:m,83:y,84:x,85:b,86:w,87:_,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I,120:A,121:D,122:N,123:O},{10:B,18:199},{44:[1,200]},t(Ne,[2,43]),{10:[1,201],44:g,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:111,113:R,114:T,115:I},{10:[1,202]},{10:[1,203],105:[1,204]},t(_t,[2,126]),{10:[1,205],44:g,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:111,113:R,114:T,115:I},{10:[1,206],44:g,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:111,113:R,114:T,115:I},{79:[1,207]},t(Ue,[2,107],{10:[1,208]}),t(Ue,[2,109],{10:[1,209]}),{79:[1,210]},t(Ke,[2,182]),{79:[1,211],97:[1,212]},t(Ne,[2,55],{112:111,44:g,60:m,88:k,101:E,104:L,105:S,108:C,110:M,113:R,114:T,115:I}),{31:[1,213],67:it,81:214,115:ot,116:et,117:ht},t(ur,[2,84]),t(ur,[2,86]),t(ur,[2,87]),t(ur,[2,151]),t(ur,[2,152]),t(ur,[2,153]),t(ur,[2,154]),{49:[1,215],67:it,81:214,115:ot,116:et,117:ht},{30:216,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{51:[1,217],67:it,81:214,115:ot,116:et,117:ht},{53:[1,218],67:it,81:214,115:ot,116:et,117:ht},{55:[1,219],67:it,81:214,115:ot,116:et,117:ht},{57:[1,220],67:it,81:214,115:ot,116:et,117:ht},{60:[1,221]},{64:[1,222],67:it,81:214,115:ot,116:et,117:ht},{66:[1,223],67:it,81:214,115:ot,116:et,117:ht},{30:224,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},{31:[1,225],67:it,81:214,115:ot,116:et,117:ht},{67:it,69:[1,226],71:[1,227],81:214,115:ot,116:et,117:ht},{67:it,69:[1,229],71:[1,228],81:214,115:ot,116:et,117:ht},t(J,[2,45],{18:152,10:B,40:st}),t(J,[2,47],{44:Ze}),t(Ee,[2,75]),t(Ee,[2,74]),{62:[1,230],67:it,81:214,115:ot,116:et,117:ht},t(Ee,[2,77]),t(bt,[2,79]),{30:231,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},t(ft,a,{5:232}),t(tt,[2,100]),t(P,[2,35]),{43:233,44:g,45:39,47:40,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},{10:B,18:234},{10:Qt,60:Jt,83:en,91:235,104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},{10:Qt,60:Jt,83:en,91:246,103:[1,247],104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},{10:Qt,60:Jt,83:en,91:248,103:[1,249],104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},{104:[1,250]},{10:Qt,60:Jt,83:en,91:251,104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},{44:g,47:252,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},t(Ue,[2,106]),{79:[1,253]},{79:[1,254],97:[1,255]},t(Ue,[2,114]),t(Ue,[2,116],{10:[1,256]}),t(Ue,[2,117]),t(ae,[2,56]),t(ur,[2,85]),t(ae,[2,57]),{51:[1,257],67:it,81:214,115:ot,116:et,117:ht},t(ae,[2,64]),t(ae,[2,59]),t(ae,[2,60]),t(ae,[2,61]),{108:[1,258]},t(ae,[2,63]),t(ae,[2,65]),{66:[1,259],67:it,81:214,115:ot,116:et,117:ht},t(ae,[2,67]),t(ae,[2,68]),t(ae,[2,70]),t(ae,[2,69]),t(ae,[2,71]),t([10,44,60,88,101,104,105,108,110,113,114,115],[2,83]),{31:[1,260],67:it,81:214,115:ot,116:et,117:ht},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,261],33:24,34:f,36:d,38:p,42:28,43:38,44:g,45:39,47:40,60:m,83:y,84:x,85:b,86:w,87:_,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I,120:A,121:D,122:N,123:O},t(Ne,[2,53]),{43:262,44:g,45:39,47:40,60:m,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I},t(Ue,[2,119],{105:xi}),t(Fa,[2,128],{107:264,10:Qt,60:Jt,83:en,104:Cr,108:Kn,109:cn,110:Rn,111:Vr}),t(yn,[2,130]),t(yn,[2,132]),t(yn,[2,133]),t(yn,[2,134]),t(yn,[2,135]),t(yn,[2,136]),t(yn,[2,137]),t(yn,[2,138]),t(yn,[2,139]),t(Ue,[2,120],{105:xi}),{10:[1,265]},t(Ue,[2,121],{105:xi}),{10:[1,266]},t(_t,[2,127]),t(Ue,[2,103],{105:xi}),t(Ue,[2,104],{112:111,44:g,60:m,88:k,101:E,104:L,105:S,108:C,110:M,113:R,114:T,115:I}),t(Ue,[2,108]),t(Ue,[2,110],{10:[1,267]}),t(Ue,[2,111]),{97:[1,268]},{51:[1,269]},{62:[1,270]},{66:[1,271]},{8:$,9:z,11:H,21:272},t(P,[2,34]),t(Ne,[2,52]),{10:Qt,60:Jt,83:en,104:Cr,106:273,107:237,108:Kn,109:cn,110:Rn,111:Vr},t(yn,[2,131]),{14:oe,44:K,60:ee,88:Q,100:274,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te,119:86},{14:oe,44:K,60:ee,88:Q,100:275,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te,119:86},{97:[1,276]},t(Ue,[2,118]),t(ae,[2,58]),{30:277,67:it,79:mt,80:Ht,81:168,115:ot,116:et,117:ht},t(ae,[2,66]),t(ft,a,{5:278}),t(Fa,[2,129],{107:264,10:Qt,60:Jt,83:en,104:Cr,108:Kn,109:cn,110:Rn,111:Vr}),t(Ue,[2,124],{119:164,10:[1,279],14:oe,44:K,60:ee,88:Q,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te}),t(Ue,[2,125],{119:164,10:[1,280],14:oe,44:K,60:ee,88:Q,104:W,105:Y,108:Z,110:se,113:ce,114:ue,115:te}),t(Ue,[2,112]),{31:[1,281],67:it,81:214,115:ot,116:et,117:ht},{6:11,7:12,8:s,9:o,10:l,11:u,20:17,22:18,23:19,24:20,25:21,26:22,27:h,32:[1,282],33:24,34:f,36:d,38:p,42:28,43:38,44:g,45:39,47:40,60:m,83:y,84:x,85:b,86:w,87:_,88:k,101:E,104:L,105:S,108:C,110:M,112:41,113:R,114:T,115:I,120:A,121:D,122:N,123:O},{10:Qt,60:Jt,83:en,91:283,104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},{10:Qt,60:Jt,83:en,91:284,104:Cr,106:236,107:237,108:Kn,109:cn,110:Rn,111:Vr},t(ae,[2,62]),t(P,[2,33]),t(Ue,[2,122],{105:xi}),t(Ue,[2,123],{105:xi})],defaultActions:{},parseError:v(function(pt,Rt){if(Rt.recoverable)this.trace(pt);else{var wt=new Error(pt);throw wt.hash=Rt,wt}},"parseError"),parse:v(function(pt){var Rt=this,wt=[0],He=[],yt=[null],fe=[],un=this.table,me="",za=0,p1=0,g1=0,m1=2,v1=1,V0=fe.slice.call(arguments,1),Gn=Object.create(this.lexer),Qi={yy:{}};for(var Ul in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ul)&&(Qi.yy[Ul]=this.yy[Ul]);Gn.setInput(pt,Qi.yy),Qi.yy.lexer=Gn,Qi.yy.parser=this,typeof Gn.yylloc>"u"&&(Gn.yylloc={});var _f=Gn.yylloc;fe.push(_f);var y1=Gn.options&&Gn.options.ranges;typeof Qi.yy.parseError=="function"?this.parseError=Qi.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function AE($a){wt.length=wt.length-2*$a,yt.length=yt.length-$a,fe.length=fe.length-$a}v(AE,"popStack");function ih(){var $a;return $a=He.pop()||Gn.lex()||v1,typeof $a!="number"&&($a instanceof Array&&(He=$a,$a=He.pop()),$a=Rt.symbols_[$a]||$a),$a}v(ih,"lex");for(var Ji,x1,xn,bi,KO,W0,Vl={},Lf,po,tb,Rf;;){if(xn=wt[wt.length-1],this.defaultActions[xn]?bi=this.defaultActions[xn]:((Ji===null||typeof Ji>"u")&&(Ji=ih()),bi=un[xn]&&un[xn][Ji]),typeof bi>"u"||!bi.length||!bi[0]){var H0="";Rf=[];for(Lf in un[xn])this.terminals_[Lf]&&Lf>m1&&Rf.push("'"+this.terminals_[Lf]+"'");Gn.showPosition?H0="Parse error on line "+(za+1)+`: `+Gn.showPosition()+` Expecting `+Rf.join(", ")+", got '"+(this.terminals_[Ji]||Ji)+"'":H0="Parse error on line "+(za+1)+": Unexpected "+(Ji==v1?"end of input":"'"+(this.terminals_[Ji]||Ji)+"'"),this.parseError(H0,{text:Gn.match,token:this.terminals_[Ji]||Ji,line:Gn.yylineno,loc:_f,expected:Rf})}if(bi[0]instanceof Array&&bi.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xn+", token: "+Ji);switch(bi[0]){case 1:wt.push(Ji),yt.push(Gn.yytext),fe.push(Gn.yylloc),wt.push(bi[1]),Ji=null,x1?(Ji=x1,x1=null):(p1=Gn.yyleng,me=Gn.yytext,za=Gn.yylineno,_f=Gn.yylloc,g1>0&&g1--);break;case 2:if(po=this.productions_[bi[1]][1],Vl.$=yt[yt.length-po],Vl._$={first_line:fe[fe.length-(po||1)].first_line,last_line:fe[fe.length-1].last_line,first_column:fe[fe.length-(po||1)].first_column,last_column:fe[fe.length-1].last_column},y1&&(Vl._$.range=[fe[fe.length-(po||1)].range[0],fe[fe.length-1].range[1]]),W0=this.performAction.apply(Vl,[me,p1,za,Qi.yy,bi[1],yt,fe].concat(V0)),typeof W0<"u")return W0;po&&(wt=wt.slice(0,-1*po*2),yt=yt.slice(0,-1*po),fe=fe.slice(0,-1*po)),wt.push(this.productions_[bi[1]][0]),yt.push(Vl.$),fe.push(Vl._$),tb=un[wt[wt.length-2]][wt[wt.length-1]],wt.push(tb);break;case 3:return!0}}return!0},"parse")},fo=function(){var $i={EOF:1,parseError:v(function(Rt,wt){if(this.yy.parser)this.yy.parser.parseError(Rt,wt);else throw new Error(Rt)},"parseError"),setInput:v(function(pt,Rt){return this.yy=Rt||this.yy||{},this._input=pt,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var pt=this._input[0];this.yytext+=pt,this.yyleng++,this.offset++,this.match+=pt,this.matched+=pt;var Rt=pt.match(/(?:\r\n?|\n).*/g);return Rt?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),pt},"input"),unput:v(function(pt){var Rt=pt.length,wt=pt.split(/(?:\r\n?|\n)/g);this._input=pt+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Rt),this.offset-=Rt;var He=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),wt.length-1&&(this.yylineno-=wt.length-1);var yt=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:wt?(wt.length===He.length?this.yylloc.first_column:0)+He[He.length-wt.length].length-wt[0].length:this.yylloc.first_column-Rt},this.options.ranges&&(this.yylloc.range=[yt[0],yt[0]+this.yyleng-Rt]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(pt){this.unput(this.match.slice(pt))},"less"),pastInput:v(function(){var pt=this.matched.substr(0,this.matched.length-this.match.length);return(pt.length>20?"...":"")+pt.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var pt=this.match;return pt.length<20&&(pt+=this._input.substr(0,20-pt.length)),(pt.substr(0,20)+(pt.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var pt=this.pastInput(),Rt=new Array(pt.length+1).join("-");return pt+this.upcomingInput()+` `+Rt+"^"},"showPosition"),test_match:v(function(pt,Rt){var wt,He,yt;if(this.options.backtrack_lexer&&(yt={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(yt.yylloc.range=this.yylloc.range.slice(0))),He=pt[0].match(/(?:\r\n?|\n).*/g),He&&(this.yylineno+=He.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:He?He[He.length-1].length-He[He.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+pt[0].length},this.yytext+=pt[0],this.match+=pt[0],this.matches=pt,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(pt[0].length),this.matched+=pt[0],wt=this.performAction.call(this,this.yy,this,Rt,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),wt)return wt;if(this._backtrack){for(var fe in yt)this[fe]=yt[fe];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var pt,Rt,wt,He;this._more||(this.yytext="",this.match="");for(var yt=this._currentRules(),fe=0;feRt[0].length)){if(Rt=wt,He=fe,this.options.backtrack_lexer){if(pt=this.test_match(wt,yt[fe]),pt!==!1)return pt;if(this._backtrack){Rt=!1;continue}else return!1}else if(!this.options.flex)break}return Rt?(pt=this.test_match(Rt,yt[He]),pt!==!1?pt:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var Rt=this.next();return Rt||this.lex()},"lex"),begin:v(function(Rt){this.conditionStack.push(Rt)},"begin"),popState:v(function(){var Rt=this.conditionStack.length-1;return Rt>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(Rt){return Rt=this.conditionStack.length-1-Math.abs(Rt||0),Rt>=0?this.conditionStack[Rt]:"INITIAL"},"topState"),pushState:v(function(Rt){this.begin(Rt)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:v(function(Rt,wt,He,yt){var fe=yt;switch(He){case 0:return this.begin("acc_title"),34;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),36;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.pushState("shapeData"),wt.yytext="",40;break;case 8:return this.pushState("shapeDataStr"),40;break;case 9:return this.popState(),40;break;case 10:let un=/\n\s*/g;return wt.yytext=wt.yytext.replace(un,"
    "),40;break;case 11:return 40;case 12:this.popState();break;case 13:this.begin("callbackname");break;case 14:this.popState();break;case 15:this.popState(),this.begin("callbackargs");break;case 16:return 94;case 17:this.popState();break;case 18:return 95;case 19:return"MD_STR";case 20:this.popState();break;case 21:this.begin("md_string");break;case 22:return"STR";case 23:this.popState();break;case 24:this.pushState("string");break;case 25:return 83;case 26:return 101;case 27:return 84;case 28:return 103;case 29:return 85;case 30:return 86;case 31:return 96;case 32:this.begin("click");break;case 33:this.popState();break;case 34:return 87;case 35:return Rt.lex.firstGraph()&&this.begin("dir"),12;break;case 36:return Rt.lex.firstGraph()&&this.begin("dir"),12;break;case 37:return Rt.lex.firstGraph()&&this.begin("dir"),12;break;case 38:return 27;case 39:return 32;case 40:return 97;case 41:return 97;case 42:return 97;case 43:return 97;case 44:return this.popState(),13;break;case 45:return this.popState(),14;break;case 46:return this.popState(),14;break;case 47:return this.popState(),14;break;case 48:return this.popState(),14;break;case 49:return this.popState(),14;break;case 50:return this.popState(),14;break;case 51:return this.popState(),14;break;case 52:return this.popState(),14;break;case 53:return this.popState(),14;break;case 54:return this.popState(),14;break;case 55:return 120;case 56:return 121;case 57:return 122;case 58:return 123;case 59:return 104;case 60:return 110;case 61:return 46;case 62:return 60;case 63:return 44;case 64:return 8;case 65:return 105;case 66:return 114;case 67:return this.popState(),77;break;case 68:return this.pushState("edgeText"),75;break;case 69:return 118;case 70:return this.popState(),77;break;case 71:return this.pushState("thickEdgeText"),75;break;case 72:return 118;case 73:return this.popState(),77;break;case 74:return this.pushState("dottedEdgeText"),75;break;case 75:return 118;case 76:return 77;case 77:return this.popState(),53;break;case 78:return"TEXT";case 79:return this.pushState("ellipseText"),52;break;case 80:return this.popState(),55;break;case 81:return this.pushState("text"),54;break;case 82:return this.popState(),57;break;case 83:return this.pushState("text"),56;break;case 84:return 58;case 85:return this.pushState("text"),67;break;case 86:return this.popState(),64;break;case 87:return this.pushState("text"),63;break;case 88:return this.popState(),49;break;case 89:return this.pushState("text"),48;break;case 90:return this.popState(),69;break;case 91:return this.popState(),71;break;case 92:return 116;case 93:return this.pushState("trapText"),68;break;case 94:return this.pushState("trapText"),70;break;case 95:return 117;case 96:return 67;case 97:return 89;case 98:return"SEP";case 99:return 88;case 100:return 114;case 101:return 110;case 102:return 44;case 103:return 108;case 104:return 113;case 105:return 115;case 106:return this.popState(),62;break;case 107:return this.pushState("text"),62;break;case 108:return this.popState(),51;break;case 109:return this.pushState("text"),50;break;case 110:return this.popState(),31;break;case 111:return this.pushState("text"),29;break;case 112:return this.popState(),66;break;case 113:return this.pushState("text"),65;break;case 114:return"TEXT";case 115:return"QUOTE";case 116:return 9;case 117:return 10;case 118:return 11}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:[^=]|=(?!))/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:[^\.]|\.(?!))/,/^(?:\s*~~[\~]+\s*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/,/^(?:-)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:[^\[\]\(\)\{\}\|\"]+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},shapeData:{rules:[8,11,12,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},callbackargs:{rules:[17,18,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},callbackname:{rules:[14,15,16,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},href:{rules:[21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},click:{rules:[21,24,33,34,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},dottedEdgeText:{rules:[21,24,73,75,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},thickEdgeText:{rules:[21,24,70,72,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},edgeText:{rules:[21,24,67,69,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},trapText:{rules:[21,24,76,79,81,83,87,89,90,91,92,93,94,107,109,111,113],inclusive:!1},ellipseText:{rules:[21,24,76,77,78,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},text:{rules:[21,24,76,79,80,81,82,83,86,87,88,89,93,94,106,107,108,109,110,111,112,113,114],inclusive:!1},vertex:{rules:[21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},dir:{rules:[21,24,44,45,46,47,48,49,50,51,52,53,54,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},acc_descr:{rules:[3,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},acc_title:{rules:[1,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},md_string:{rules:[19,20,21,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},string:{rules:[21,22,23,24,76,79,81,83,87,89,93,94,107,109,111,113],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,73,74,76,79,81,83,84,85,87,89,93,94,95,96,97,98,99,100,101,102,103,104,105,107,109,111,113,115,116,117,118],inclusive:!0}}};return $i}();os.lexer=fo;function Zi(){this.yy={}}return v(Zi,"Parser"),Zi.prototype=os,os.Parser=Zi,new Zi}();b9.parser=b9;aRe=b9,sRe=v((t,e)=>{let r=S1,n=r(t,"r"),i=r(t,"g"),a=r(t,"b");return $s(n,i,a,e)},"fade"),oRe=v(t=>`.label { font-family: ${t.fontFamily}; color: ${t.nodeTextColor||t.textColor}; } .cluster-label text { fill: ${t.titleColor}; } .cluster-label span { color: ${t.titleColor}; } .cluster-label span p { background-color: transparent; } .label text,span { fill: ${t.nodeTextColor||t.textColor}; color: ${t.nodeTextColor||t.textColor}; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: 1px; } .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label { text-anchor: middle; } // .flowchart-label .text-outer-tspan { // text-anchor: middle; // } // .flowchart-label .text-inner-tspan { // text-anchor: start; // } .node .katex path { fill: #000; stroke: #000; stroke-width: 1px; } .rough-node .label,.node .label, .image-shape .label, .icon-shape .label { text-align: center; } .node.clickable { cursor: pointer; } .root .anchor path { fill: ${t.lineColor} !important; stroke-width: 0; stroke: ${t.lineColor}; } .arrowheadPath { fill: ${t.arrowheadColor}; } .edgePath .path { stroke: ${t.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${t.lineColor}; fill: none; } .edgeLabel { background-color: ${t.edgeLabelBackground}; p { background-color: ${t.edgeLabelBackground}; } rect { opacity: 0.5; background-color: ${t.edgeLabelBackground}; fill: ${t.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${sRe(t.edgeLabelBackground,.5)}; // background-color: } .cluster rect { fill: ${t.clusterBkg}; stroke: ${t.clusterBorder}; stroke-width: 1px; } .cluster text { fill: ${t.titleColor}; } .cluster span { color: ${t.titleColor}; } /* .cluster div { color: ${t.titleColor}; } */ div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${t.fontFamily}; font-size: 12px; background: ${t.tertiaryColor}; border: 1px solid ${t.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .flowchartTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } rect.text { fill: none; stroke-width: 0; } .icon-shape, .image-shape { background-color: ${t.edgeLabelBackground}; p { background-color: ${t.edgeLabelBackground}; padding: 2px; } rect { opacity: 0.5; background-color: ${t.edgeLabelBackground}; fill: ${t.edgeLabelBackground}; } text-align: center; } `,"getStyles"),lRe=oRe,cRe={parser:aRe,db:y9,renderer:iRe,styles:lRe,init:v(t=>{t.flowchart||(t.flowchart={}),t.layout&&VS({layout:t.layout}),t.flowchart.arrowMarkerAbsolute=t.arrowMarkerAbsolute,VS({flowchart:{arrowMarkerAbsolute:t.arrowMarkerAbsolute}}),y9.clear(),y9.setGen("gen-2")},"init")}});var Ane,_ne=F(()=>{Ane=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function uRe(t){return typeof t=="string"&&Ane.test(t)}var Lne,Rne=F(()=>{_ne();Lne=uRe});function Nne(t,e=0){return da[t[e+0]]+da[t[e+1]]+da[t[e+2]]+da[t[e+3]]+"-"+da[t[e+4]]+da[t[e+5]]+"-"+da[t[e+6]]+da[t[e+7]]+"-"+da[t[e+8]]+da[t[e+9]]+"-"+da[t[e+10]]+da[t[e+11]]+da[t[e+12]]+da[t[e+13]]+da[t[e+14]]+da[t[e+15]]}var da,Ine=F(()=>{da=[];for(let t=0;t<256;++t)da.push((t+256).toString(16).slice(1))});function hRe(t){if(!Lne(t))throw TypeError("Invalid UUID");let e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}var Mne,Dne=F(()=>{Rne();Mne=hRe});function fRe(t){t=unescape(encodeURIComponent(t));let e=[];for(let r=0;r{Ine();Dne();dRe="6ba7b810-9dad-11d1-80b4-00c04fd430c8",pRe="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});function gRe(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function S9(t,e){return t<>>32-e}function mRe(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){let s=unescape(encodeURIComponent(t));t=[];for(let o=0;o>>0;d=f,f=h,h=S9(u,30)>>>0,u=l,l=m}r[0]=r[0]+l>>>0,r[1]=r[1]+u>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+f>>>0,r[4]=r[4]+d>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var Pne,Bne=F(()=>{Pne=mRe});var vRe,C9,Fne=F(()=>{One();Bne();vRe=E9("v5",80,Pne),C9=vRe});var zne=F(()=>{Fne()});var Wne={};vr(Wne,{diagram:()=>$Re});function Vne(t="",e=""){let r=t.replace(_Re,"");return`${_9(e)}${_9(r)}${C9(t,PRe)}`}function _9(t=""){return t.length>0?`${t}-`:""}var A9,yRe,Od,L9,xRe,bRe,Gne,wRe,kRe,TRe,ERe,SRe,CRe,kl,ARe,Tl,_Re,Ai,wy,LRe,RRe,NRe,IRe,Une,MRe,$ne,DRe,ORe,PRe,BRe,FRe,zRe,$Re,Hne=F(()=>{kn();or();As();lr();uy();zne();A9=function(){var t=v(function(S,C,M,R){for(M=M||{},R=S.length;R--;M[S[R]]=C);return M},"o"),e=[6,8,10,20,22,24,26,27,28],r=[1,10],n=[1,11],i=[1,12],a=[1,13],s=[1,14],o=[1,15],l=[1,21],u=[1,22],h=[1,23],f=[1,24],d=[1,25],p=[6,8,10,13,15,18,19,20,22,24,26,27,28,41,42,43,44,45],g=[1,34],m=[27,28,46,47],y=[41,42,43,44,45],x=[17,34],b=[1,54],w=[1,53],_=[17,34,36,38],k={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,":":13,role:14,BLOCK_START:15,attributes:16,BLOCK_STOP:17,SQS:18,SQE:19,title:20,title_value:21,acc_title:22,acc_title_value:23,acc_descr:24,acc_descr_value:25,acc_descr_multiline_value:26,ALPHANUM:27,ENTITY_NAME:28,attribute:29,attributeType:30,attributeName:31,attributeKeyTypeList:32,attributeComment:33,ATTRIBUTE_WORD:34,attributeKeyType:35,COMMA:36,ATTRIBUTE_KEY:37,COMMENT:38,cardinality:39,relType:40,ZERO_OR_ONE:41,ZERO_OR_MORE:42,ONE_OR_MORE:43,ONLY_ONE:44,MD_PARENT:45,NON_IDENTIFYING:46,IDENTIFYING:47,WORD:48,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:":",15:"BLOCK_START",17:"BLOCK_STOP",18:"SQS",19:"SQE",20:"title",21:"title_value",22:"acc_title",23:"acc_title_value",24:"acc_descr",25:"acc_descr_value",26:"acc_descr_multiline_value",27:"ALPHANUM",28:"ENTITY_NAME",34:"ATTRIBUTE_WORD",36:"COMMA",37:"ATTRIBUTE_KEY",38:"COMMENT",41:"ZERO_OR_ONE",42:"ZERO_OR_MORE",43:"ONE_OR_MORE",44:"ONLY_ONE",45:"MD_PARENT",46:"NON_IDENTIFYING",47:"IDENTIFYING",48:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,4],[9,3],[9,1],[9,7],[9,6],[9,4],[9,2],[9,2],[9,2],[9,1],[11,1],[11,1],[16,1],[16,2],[29,2],[29,3],[29,3],[29,4],[30,1],[31,1],[32,1],[32,3],[35,1],[33,1],[12,3],[39,1],[39,1],[39,1],[39,1],[39,1],[40,1],[40,1],[14,1],[14,1],[14,1]],performAction:v(function(C,M,R,T,I,A,D){var N=A.length-1;switch(I){case 1:break;case 2:this.$=[];break;case 3:A[N-1].push(A[N]),this.$=A[N-1];break;case 4:case 5:this.$=A[N];break;case 6:case 7:this.$=[];break;case 8:T.addEntity(A[N-4]),T.addEntity(A[N-2]),T.addRelationship(A[N-4],A[N],A[N-2],A[N-3]);break;case 9:T.addEntity(A[N-3]),T.addAttributes(A[N-3],A[N-1]);break;case 10:T.addEntity(A[N-2]);break;case 11:T.addEntity(A[N]);break;case 12:T.addEntity(A[N-6],A[N-4]),T.addAttributes(A[N-6],A[N-1]);break;case 13:T.addEntity(A[N-5],A[N-3]);break;case 14:T.addEntity(A[N-3],A[N-1]);break;case 15:case 16:this.$=A[N].trim(),T.setAccTitle(this.$);break;case 17:case 18:this.$=A[N].trim(),T.setAccDescription(this.$);break;case 19:case 43:this.$=A[N];break;case 20:case 41:case 42:this.$=A[N].replace(/"/g,"");break;case 21:case 29:this.$=[A[N]];break;case 22:A[N].push(A[N-1]),this.$=A[N];break;case 23:this.$={attributeType:A[N-1],attributeName:A[N]};break;case 24:this.$={attributeType:A[N-2],attributeName:A[N-1],attributeKeyTypeList:A[N]};break;case 25:this.$={attributeType:A[N-2],attributeName:A[N-1],attributeComment:A[N]};break;case 26:this.$={attributeType:A[N-3],attributeName:A[N-2],attributeKeyTypeList:A[N-1],attributeComment:A[N]};break;case 27:case 28:case 31:this.$=A[N];break;case 30:A[N-2].push(A[N]),this.$=A[N-2];break;case 32:this.$=A[N].replace(/"/g,"");break;case 33:this.$={cardA:A[N],relType:A[N-1],cardB:A[N-2]};break;case 34:this.$=T.Cardinality.ZERO_OR_ONE;break;case 35:this.$=T.Cardinality.ZERO_OR_MORE;break;case 36:this.$=T.Cardinality.ONE_OR_MORE;break;case 37:this.$=T.Cardinality.ONLY_ONE;break;case 38:this.$=T.Cardinality.MD_PARENT;break;case 39:this.$=T.Identification.NON_IDENTIFYING;break;case 40:this.$=T.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,20:r,22:n,24:i,26:a,27:s,28:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:16,11:9,20:r,22:n,24:i,26:a,27:s,28:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,11],{12:17,39:20,15:[1,18],18:[1,19],41:l,42:u,43:h,44:f,45:d}),{21:[1,26]},{23:[1,27]},{25:[1,28]},t(e,[2,18]),t(p,[2,19]),t(p,[2,20]),t(e,[2,4]),{11:29,27:s,28:o},{16:30,17:[1,31],29:32,30:33,34:g},{11:35,27:s,28:o},{40:36,46:[1,37],47:[1,38]},t(m,[2,34]),t(m,[2,35]),t(m,[2,36]),t(m,[2,37]),t(m,[2,38]),t(e,[2,15]),t(e,[2,16]),t(e,[2,17]),{13:[1,39]},{17:[1,40]},t(e,[2,10]),{16:41,17:[2,21],29:32,30:33,34:g},{31:42,34:[1,43]},{34:[2,27]},{19:[1,44]},{39:45,41:l,42:u,43:h,44:f,45:d},t(y,[2,39]),t(y,[2,40]),{14:46,27:[1,49],28:[1,48],48:[1,47]},t(e,[2,9]),{17:[2,22]},t(x,[2,23],{32:50,33:51,35:52,37:b,38:w}),t([17,34,37,38],[2,28]),t(e,[2,14],{15:[1,55]}),t([27,28],[2,33]),t(e,[2,8]),t(e,[2,41]),t(e,[2,42]),t(e,[2,43]),t(x,[2,24],{33:56,36:[1,57],38:w}),t(x,[2,25]),t(_,[2,29]),t(x,[2,32]),t(_,[2,31]),{16:58,17:[1,59],29:32,30:33,34:g},t(x,[2,26]),{35:60,37:b},{17:[1,61]},t(e,[2,13]),t(_,[2,30]),t(e,[2,12])],defaultActions:{34:[2,27],41:[2,22]},parseError:v(function(C,M){if(M.recoverable)this.trace(C);else{var R=new Error(C);throw R.hash=M,R}},"parseError"),parse:v(function(C){var M=this,R=[0],T=[],I=[null],A=[],D=this.table,N="",O=0,B=0,P=0,$=2,z=1,H=A.slice.call(arguments,1),J=Object.create(this.lexer),X={yy:{}};for(var oe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,oe)&&(X.yy[oe]=this.yy[oe]);J.setInput(C,X.yy),X.yy.lexer=J,X.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var K=J.yylloc;A.push(K);var ee=J.options&&J.options.ranges;typeof X.yy.parseError=="function"?this.parseError=X.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Q(De){R.length=R.length-2*De,I.length=I.length-De,A.length=A.length-De}v(Q,"popStack");function W(){var De;return De=T.pop()||J.lex()||z,typeof De!="number"&&(De instanceof Array&&(T=De,De=T.pop()),De=M.symbols_[De]||De),De}v(W,"lex");for(var Y,Z,se,ce,ue,te,Ne={},ae,we,Ie,Ee;;){if(se=R[R.length-1],this.defaultActions[se]?ce=this.defaultActions[se]:((Y===null||typeof Y>"u")&&(Y=W()),ce=D[se]&&D[se][Y]),typeof ce>"u"||!ce.length||!ce[0]){var Oe="";Ee=[];for(ae in D[se])this.terminals_[ae]&&ae>$&&Ee.push("'"+this.terminals_[ae]+"'");J.showPosition?Oe="Parse error on line "+(O+1)+`: `+J.showPosition()+` Expecting `+Ee.join(", ")+", got '"+(this.terminals_[Y]||Y)+"'":Oe="Parse error on line "+(O+1)+": Unexpected "+(Y==z?"end of input":"'"+(this.terminals_[Y]||Y)+"'"),this.parseError(Oe,{text:J.match,token:this.terminals_[Y]||Y,line:J.yylineno,loc:K,expected:Ee})}if(ce[0]instanceof Array&&ce.length>1)throw new Error("Parse Error: multiple actions possible at state: "+se+", token: "+Y);switch(ce[0]){case 1:R.push(Y),I.push(J.yytext),A.push(J.yylloc),R.push(ce[1]),Y=null,Z?(Y=Z,Z=null):(B=J.yyleng,N=J.yytext,O=J.yylineno,K=J.yylloc,P>0&&P--);break;case 2:if(we=this.productions_[ce[1]][1],Ne.$=I[I.length-we],Ne._$={first_line:A[A.length-(we||1)].first_line,last_line:A[A.length-1].last_line,first_column:A[A.length-(we||1)].first_column,last_column:A[A.length-1].last_column},ee&&(Ne._$.range=[A[A.length-(we||1)].range[0],A[A.length-1].range[1]]),te=this.performAction.apply(Ne,[N,B,O,X.yy,ce[1],I,A].concat(H)),typeof te<"u")return te;we&&(R=R.slice(0,-1*we*2),I=I.slice(0,-1*we),A=A.slice(0,-1*we)),R.push(this.productions_[ce[1]][0]),I.push(Ne.$),A.push(Ne._$),Ie=D[R[R.length-2]][R[R.length-1]],R.push(Ie);break;case 3:return!0}}return!0},"parse")},E=function(){var S={EOF:1,parseError:v(function(M,R){if(this.yy.parser)this.yy.parser.parseError(M,R);else throw new Error(M)},"parseError"),setInput:v(function(C,M){return this.yy=M||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var M=C.match(/(?:\r\n?|\n).*/g);return M?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},"input"),unput:v(function(C){var M=C.length,R=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-M),this.offset-=M;var T=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),R.length-1&&(this.yylineno-=R.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:R?(R.length===T.length?this.yylloc.first_column:0)+T[T.length-R.length].length-R[0].length:this.yylloc.first_column-M},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-M]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(C){this.unput(this.match.slice(C))},"less"),pastInput:v(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var C=this.pastInput(),M=new Array(C.length+1).join("-");return C+this.upcomingInput()+` `+M+"^"},"showPosition"),test_match:v(function(C,M){var R,T,I;if(this.options.backtrack_lexer&&(I={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(I.yylloc.range=this.yylloc.range.slice(0))),T=C[0].match(/(?:\r\n?|\n).*/g),T&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],R=this.performAction.call(this,this.yy,this,M,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),R)return R;if(this._backtrack){for(var A in I)this[A]=I[A];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,M,R,T;this._more||(this.yytext="",this.match="");for(var I=this._currentRules(),A=0;AM[0].length)){if(M=R,T=A,this.options.backtrack_lexer){if(C=this.test_match(R,I[A]),C!==!1)return C;if(this._backtrack){M=!1;continue}else return!1}else if(!this.options.flex)break}return M?(C=this.test_match(M,I[T]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var M=this.next();return M||this.lex()},"lex"),begin:v(function(M){this.conditionStack.push(M)},"begin"),popState:v(function(){var M=this.conditionStack.length-1;return M>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(M){return M=this.conditionStack.length-1-Math.abs(M||0),M>=0?this.conditionStack[M]:"INITIAL"},"topState"),pushState:v(function(M){this.begin(M)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(M,R,T,I){var A=I;switch(T){case 0:return this.begin("acc_title"),22;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),24;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 10;case 8:break;case 9:return 8;case 10:return 28;case 11:return 48;case 12:return 4;case 13:return this.begin("block"),15;break;case 14:return 36;case 15:break;case 16:return 37;case 17:return 34;case 18:return 34;case 19:return 38;case 20:break;case 21:return this.popState(),17;break;case 22:return R.yytext[0];case 23:return 18;case 24:return 19;case 25:return 41;case 26:return 43;case 27:return 43;case 28:return 43;case 29:return 41;case 30:return 41;case 31:return 42;case 32:return 42;case 33:return 42;case 34:return 42;case 35:return 42;case 36:return 43;case 37:return 42;case 38:return 43;case 39:return 44;case 40:return 44;case 41:return 44;case 42:return 44;case 43:return 41;case 44:return 42;case 45:return 43;case 46:return 45;case 47:return 46;case 48:return 47;case 49:return 47;case 50:return 46;case 51:return 46;case 52:return 46;case 53:return 27;case 54:return R.yytext[0];case 55:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:,)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:1\b)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\s*u\b)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[14,15,16,17,18,19,20,21,22],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55],inclusive:!0}}};return S}();k.lexer=E;function L(){this.yy={}}return v(L,"Parser"),L.prototype=k,k.Parser=L,new L}();A9.parser=A9;yRe=A9,Od=new Map,L9=[],xRe={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},bRe={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},Gne=v(function(t,e=void 0){return Od.has(t)?!Od.get(t).alias&&e&&(Od.get(t).alias=e,re.info(`Add alias '${e}' to entity '${t}'`)):(Od.set(t,{attributes:[],alias:e}),re.info("Added new entity :",t)),Od.get(t)},"addEntity"),wRe=v(()=>Od,"getEntities"),kRe=v(function(t,e){let r=Gne(t),n;for(n=e.length-1;n>=0;n--)r.attributes.push(e[n]),re.debug("Added attribute ",e[n].attributeName)},"addAttributes"),TRe=v(function(t,e,r,n){let i={entityA:t,roleA:e,entityB:r,relSpec:n};L9.push(i),re.debug("Added new relationship :",i)},"addRelationship"),ERe=v(()=>L9,"getRelationships"),SRe=v(function(){Od=new Map,L9=[],xr()},"clear"),CRe={Cardinality:xRe,Identification:bRe,getConfig:v(()=>pe().er,"getConfig"),addEntity:Gne,addAttributes:kRe,getEntities:wRe,addRelationship:TRe,getRelationships:ERe,clear:SRe,setAccTitle:Tr,getAccTitle:_r,setAccDescription:Lr,getAccDescription:Rr,setDiagramTitle:tn,getDiagramTitle:qr},kl={ONLY_ONE_START:"ONLY_ONE_START",ONLY_ONE_END:"ONLY_ONE_END",ZERO_OR_ONE_START:"ZERO_OR_ONE_START",ZERO_OR_ONE_END:"ZERO_OR_ONE_END",ONE_OR_MORE_START:"ONE_OR_MORE_START",ONE_OR_MORE_END:"ONE_OR_MORE_END",ZERO_OR_MORE_START:"ZERO_OR_MORE_START",ZERO_OR_MORE_END:"ZERO_OR_MORE_END",MD_PARENT_END:"MD_PARENT_END",MD_PARENT_START:"MD_PARENT_START"},ARe=v(function(t,e){let r;t.append("defs").append("marker").attr("id",kl.MD_PARENT_START).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",kl.MD_PARENT_END).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",kl.ONLY_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18 M15,0 L15,18"),t.append("defs").append("marker").attr("id",kl.ONLY_ONE_END).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,0 L3,18 M9,0 L9,18"),r=t.append("defs").append("marker").attr("id",kl.ZERO_OR_ONE_START).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),r.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),r.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M9,0 L9,18"),r=t.append("defs").append("marker").attr("id",kl.ZERO_OR_ONE_END).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto"),r.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),r.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,0 L21,18"),t.append("defs").append("marker").attr("id",kl.ONE_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),t.append("defs").append("marker").attr("id",kl.ONE_OR_MORE_END).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"),r=t.append("defs").append("marker").attr("id",kl.ZERO_OR_MORE_START).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),r.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),r.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18"),r=t.append("defs").append("marker").attr("id",kl.ZERO_OR_MORE_END).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto"),r.append("circle").attr("stroke",e.stroke).attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),r.append("path").attr("stroke",e.stroke).attr("fill","none").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"insertMarkers"),Tl={ERMarkers:kl,insertMarkers:ARe},_Re=/[^\dA-Za-z](\W)*/g,Ai={},wy=new Map,LRe=v(function(t){let e=Object.keys(t);for(let r of e)Ai[r]=t[r]},"setConf"),RRe=v((t,e,r)=>{let n=Ai.entityPadding/3,i=Ai.entityPadding/3,a=Ai.fontSize*.85,s=e.node().getBBox(),o=[],l=!1,u=!1,h=0,f=0,d=0,p=0,g=s.height+n*2,m=1;r.forEach(w=>{w.attributeKeyTypeList!==void 0&&w.attributeKeyTypeList.length>0&&(l=!0),w.attributeComment!==void 0&&(u=!0)}),r.forEach(w=>{let _=`${e.node().id}-attr-${m}`,k=0,E=iu(w.attributeType),L=t.append("text").classed("er entityLabel",!0).attr("id",`${_}-type`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",pe().fontFamily).style("font-size",a+"px").text(E),S=t.append("text").classed("er entityLabel",!0).attr("id",`${_}-name`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",pe().fontFamily).style("font-size",a+"px").text(w.attributeName),C={};C.tn=L,C.nn=S;let M=L.node().getBBox(),R=S.node().getBBox();if(h=Math.max(h,M.width),f=Math.max(f,R.width),k=Math.max(M.height,R.height),l){let T=w.attributeKeyTypeList!==void 0?w.attributeKeyTypeList.join(","):"",I=t.append("text").classed("er entityLabel",!0).attr("id",`${_}-key`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",pe().fontFamily).style("font-size",a+"px").text(T);C.kn=I;let A=I.node().getBBox();d=Math.max(d,A.width),k=Math.max(k,A.height)}if(u){let T=t.append("text").classed("er entityLabel",!0).attr("id",`${_}-comment`).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","left").style("font-family",pe().fontFamily).style("font-size",a+"px").text(w.attributeComment||"");C.cn=T;let I=T.node().getBBox();p=Math.max(p,I.width),k=Math.max(k,I.height)}C.height=k,o.push(C),g+=k+n*2,m+=1});let y=4;l&&(y+=2),u&&(y+=2);let x=h+f+d+p,b={width:Math.max(Ai.minEntityWidth,Math.max(s.width+Ai.entityPadding*2,x+i*y)),height:r.length>0?g:Math.max(Ai.minEntityHeight,s.height+Ai.entityPadding*2)};if(r.length>0){let w=Math.max(0,(b.width-x-i*y)/(y/2));e.attr("transform","translate("+b.width/2+","+(n+s.height/2)+")");let _=s.height+n*2,k="attributeBoxOdd";o.forEach(E=>{let L=_+n+E.height/2;E.tn.attr("transform","translate("+i+","+L+")");let S=t.insert("rect","#"+E.tn.node().id).classed(`er ${k}`,!0).attr("x",0).attr("y",_).attr("width",h+i*2+w).attr("height",E.height+n*2),C=parseFloat(S.attr("x"))+parseFloat(S.attr("width"));E.nn.attr("transform","translate("+(C+i)+","+L+")");let M=t.insert("rect","#"+E.nn.node().id).classed(`er ${k}`,!0).attr("x",C).attr("y",_).attr("width",f+i*2+w).attr("height",E.height+n*2),R=parseFloat(M.attr("x"))+parseFloat(M.attr("width"));if(l){E.kn.attr("transform","translate("+(R+i)+","+L+")");let T=t.insert("rect","#"+E.kn.node().id).classed(`er ${k}`,!0).attr("x",R).attr("y",_).attr("width",d+i*2+w).attr("height",E.height+n*2);R=parseFloat(T.attr("x"))+parseFloat(T.attr("width"))}u&&(E.cn.attr("transform","translate("+(R+i)+","+L+")"),t.insert("rect","#"+E.cn.node().id).classed(`er ${k}`,"true").attr("x",R).attr("y",_).attr("width",p+i*2+w).attr("height",E.height+n*2)),_+=E.height+n*2,k=k==="attributeBoxOdd"?"attributeBoxEven":"attributeBoxOdd"})}else b.height=Math.max(Ai.minEntityHeight,g),e.attr("transform","translate("+b.width/2+","+b.height/2+")");return b},"drawAttributes"),NRe=v(function(t,e,r){let n=[...e.keys()],i;return n.forEach(function(a){let s=Vne(a,"entity");wy.set(a,s);let o=t.append("g").attr("id",s);i=i===void 0?s:i;let l="text-"+s,u=o.append("text").classed("er entityLabel",!0).attr("id",l).attr("x",0).attr("y",0).style("dominant-baseline","middle").style("text-anchor","middle").style("font-family",pe().fontFamily).style("font-size",Ai.fontSize+"px").text(e.get(a).alias??a),{width:h,height:f}=RRe(o,u,e.get(a).attributes),p=o.insert("rect","#"+l).classed("er entityBox",!0).attr("x",0).attr("y",0).attr("width",h).attr("height",f).node().getBBox();r.setNode(s,{width:p.width,height:p.height,shape:"rect",id:s})}),i},"drawEntities"),IRe=v(function(t,e){e.nodes().forEach(function(r){r!==void 0&&e.node(r)!==void 0&&t.select("#"+r).attr("transform","translate("+(e.node(r).x-e.node(r).width/2)+","+(e.node(r).y-e.node(r).height/2)+" )")})},"adjustEntities"),Une=v(function(t){return(t.entityA+t.roleA+t.entityB).replace(/\s/g,"")},"getEdgeName"),MRe=v(function(t,e){return t.forEach(function(r){e.setEdge(wy.get(r.entityA),wy.get(r.entityB),{relationship:r},Une(r))}),t},"addRelationships"),$ne=0,DRe=v(function(t,e,r,n,i){$ne++;let a=r.edge(wy.get(e.entityA),wy.get(e.entityB),Une(e)),s=ms().x(function(m){return m.x}).y(function(m){return m.y}).curve(gl),o=t.insert("path","#"+n).classed("er relationshipLine",!0).attr("d",s(a.points)).style("stroke",Ai.stroke).style("fill","none");e.relSpec.relType===i.db.Identification.NON_IDENTIFYING&&o.attr("stroke-dasharray","8,8");let l="";switch(Ai.arrowMarkerAbsolute&&(l=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,l=l.replace(/\(/g,"\\("),l=l.replace(/\)/g,"\\)")),e.relSpec.cardA){case i.db.Cardinality.ZERO_OR_ONE:o.attr("marker-end","url("+l+"#"+Tl.ERMarkers.ZERO_OR_ONE_END+")");break;case i.db.Cardinality.ZERO_OR_MORE:o.attr("marker-end","url("+l+"#"+Tl.ERMarkers.ZERO_OR_MORE_END+")");break;case i.db.Cardinality.ONE_OR_MORE:o.attr("marker-end","url("+l+"#"+Tl.ERMarkers.ONE_OR_MORE_END+")");break;case i.db.Cardinality.ONLY_ONE:o.attr("marker-end","url("+l+"#"+Tl.ERMarkers.ONLY_ONE_END+")");break;case i.db.Cardinality.MD_PARENT:o.attr("marker-end","url("+l+"#"+Tl.ERMarkers.MD_PARENT_END+")");break}switch(e.relSpec.cardB){case i.db.Cardinality.ZERO_OR_ONE:o.attr("marker-start","url("+l+"#"+Tl.ERMarkers.ZERO_OR_ONE_START+")");break;case i.db.Cardinality.ZERO_OR_MORE:o.attr("marker-start","url("+l+"#"+Tl.ERMarkers.ZERO_OR_MORE_START+")");break;case i.db.Cardinality.ONE_OR_MORE:o.attr("marker-start","url("+l+"#"+Tl.ERMarkers.ONE_OR_MORE_START+")");break;case i.db.Cardinality.ONLY_ONE:o.attr("marker-start","url("+l+"#"+Tl.ERMarkers.ONLY_ONE_START+")");break;case i.db.Cardinality.MD_PARENT:o.attr("marker-start","url("+l+"#"+Tl.ERMarkers.MD_PARENT_START+")");break}let u=o.node().getTotalLength(),h=o.node().getPointAtLength(u*.5),f="rel"+$ne,d=e.roleA.split(/
    /g),p=t.append("text").classed("er relationshipLabel",!0).attr("id",f).attr("x",h.x).attr("y",h.y).style("text-anchor","middle").style("dominant-baseline","middle").style("font-family",pe().fontFamily).style("font-size",Ai.fontSize+"px");if(d.length==1)p.text(e.roleA);else{let m=-(d.length-1)*.5;d.forEach((y,x)=>{p.append("tspan").attr("x",h.x).attr("dy",`${x===0?m:1}em`).text(y)})}let g=p.node().getBBox();t.insert("rect","#"+f).classed("er relationshipLabelBox",!0).attr("x",h.x-g.width/2).attr("y",h.y-g.height/2).attr("width",g.width).attr("height",g.height)},"drawRelationshipFromLayout"),ORe=v(function(t,e,r,n){Ai=pe().er,re.info("Drawing ER diagram");let i=pe().securityLevel,a;i==="sandbox"&&(a=Ve("#i"+e));let o=(i==="sandbox"?Ve(a.nodes()[0].contentDocument.body):Ve("body")).select(`[id='${e}']`);Tl.insertMarkers(o,Ai);let l;l=new Sr({multigraph:!0,directed:!0,compound:!1}).setGraph({rankdir:Ai.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel(function(){return{}});let u=NRe(o,n.db.getEntities(),l),h=MRe(n.db.getRelationships(),l);Ru(l),IRe(o,l),h.forEach(function(m){DRe(o,m,l,u,n)});let f=Ai.diagramPadding;Ut.insertTitle(o,"entityTitleText",Ai.titleTopMargin,n.db.getDiagramTitle());let d=o.node().getBBox(),p=d.width+f*2,g=d.height+f*2;Hr(o,g,p,Ai.useMaxWidth),o.attr("viewBox",`${d.x-f} ${d.y-f} ${p} ${g}`)},"draw"),PRe="28e9f9db-3c8d-5aa5-9faf-44286ae5937c";v(Vne,"generateId");v(_9,"strWithHyphen");BRe={setConf:LRe,draw:ORe},FRe=v(t=>` .entityBox { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; } .attributeBoxOdd { fill: ${t.attributeBackgroundColorOdd}; stroke: ${t.nodeBorder}; } .attributeBoxEven { fill: ${t.attributeBackgroundColorEven}; stroke: ${t.nodeBorder}; } .relationshipLabelBox { fill: ${t.tertiaryColor}; opacity: 0.7; background-color: ${t.tertiaryColor}; rect { opacity: 0.5; } } .relationshipLine { stroke: ${t.lineColor}; } .entityTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } #MD_PARENT_START { fill: #f5f5f5 !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #MD_PARENT_END { fill: #f5f5f5 !important; stroke: ${t.lineColor} !important; stroke-width: 1; } `,"getStyles"),zRe=FRe,$Re={parser:yRe,db:CRe,renderer:BRe,styles:zRe}});function Pu(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}var ky=F(()=>{or();v(Pu,"populateCommonDb")});var Rg,Hw=F(()=>{or();Rg=class{constructor(t){this.init=t,this.records=this.init()}static{v(this,"ImperativeState")}reset(){this.records=this.init()}}});function Xn(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function pa(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function R9(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Bd(t){return typeof t=="object"&&t!==null&&Xn(t.container)&&pa(t.reference)&&typeof t.message=="string"}function eo(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Qh(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Ty(t){return eo(t)&&typeof t.fullText=="string"}var Pd,$o=F(()=>{Pd=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,r){return Xn(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});let i=n[r];if(i!==void 0)return i;{let a=this.computeIsSubtype(e,r);return n[r]=a,a}}getAllSubTypes(e){let r=this.allSubtypes[e];if(r)return r;{let n=this.getAllTypes(),i=[];for(let a of n)this.isSubtype(a,e)&&i.push(a);return this.allSubtypes[e]=i,i}}}});function GRe(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function qw(t){return!!t&&typeof t[Symbol.iterator]=="function"}function Xr(...t){if(t.length===1){let e=t[0];if(e instanceof to)return e;if(qw(e))return new to(()=>e[Symbol.iterator](),r=>r.next());if(typeof e.length=="number")return new to(()=>({index:0}),r=>r.index1?new to(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){let r=e.iterator.next();if(!r.done)return r;e.iterator=void 0}if(e.array){if(e.arrIndex{to=class t{constructor(e,r){this.startFn=e,this.nextFn=r}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){let e=[],r=this.iterator(),n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){let n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){let r=e[Symbol.iterator]();return new t(()=>({first:this.startFn(),firstDone:!1}),n=>{let i;if(!n.firstDone){do if(i=this.nextFn(n.first),!i.done)return i;while(!i.done);n.firstDone=!0}do if(i=r.next(),!i.done)return i;while(!i.done);return Za})}join(e=","){let r=this.iterator(),n="",i,a=!1;do i=r.next(),i.done||(a&&(n+=e),n+=GRe(i.value)),a=!0;while(!i.done);return n}indexOf(e,r=0){let n=this.iterator(),i=0,a=n.next();for(;!a.done;){if(i>=r&&a.value===e)return i;a=n.next(),i++}return-1}every(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new t(this.startFn,r=>{let{done:n,value:i}=this.nextFn(r);return n?Za:{done:!1,value:e(i)}})}filter(e){return new t(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return Za})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){let n=this.iterator(),i=r,a=n.next();for(;!a.done;)i===void 0?i=a.value:i=e(i,a.value),a=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){let i=e.next();if(i.done)return n;let a=this.recursiveReduce(e,r,n);return a===void 0?i.value:r(a,i.value)}find(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}findIndex(e){let r=this.iterator(),n=0,i=r.next();for(;!i.done;){if(e(i.value))return n;i=r.next(),n++}return-1}includes(e){let r=this.iterator(),n=r.next();for(;!n.done;){if(n.value===e)return!0;n=r.next()}return!1}flatMap(e){return new t(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}let{done:n,value:i}=this.nextFn(r.this);if(!n){let a=e(i);if(qw(a))r.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}}while(r.iterator);return Za})}flat(e){if(e===void 0&&(e=1),e<=0)return this;let r=e>1?this.flat(e-1):this;return new t(()=>({this:r.startFn()}),n=>{do{if(n.iterator){let s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}let{done:i,value:a}=r.nextFn(n.this);if(!i)if(qw(a))n.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}while(n.iterator);return Za})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(e=1){return new t(()=>{let r=this.startFn();for(let n=0;n({size:0,state:this.startFn()}),r=>(r.size++,r.size>e?Za:this.nextFn(r.state)))}distinct(e){let r=new Set;return this.filter(n=>{let i=e?e(n):n;return r.has(i)?!1:(r.add(i),!0)})}exclude(e,r){let n=new Set;for(let i of e){let a=r?r(i):i;n.add(a)}return this.filter(i=>{let a=r?r(i):i;return!n.has(a)})}};Ey=new to(()=>{},()=>Za),Za=Object.freeze({done:!0,value:void 0});Cc=class extends to{constructor(e,r,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[r(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let s=i.iterators[i.iterators.length-1].next();if(s.done)i.iterators.pop();else return i.iterators.push(r(s.value)[Symbol.iterator]()),s}return Za})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}};(function(t){function e(a){return a.reduce((s,o)=>s+o,0)}t.sum=e;function r(a){return a.reduce((s,o)=>s*o,0)}t.product=r;function n(a){return a.reduce((s,o)=>Math.min(s,o))}t.min=n;function i(a){return a.reduce((s,o)=>Math.max(s,o))}t.max=i})(Ng||(Ng={}))});var Xw={};vr(Xw,{DefaultNameRegexp:()=>Yw,RangeComparison:()=>Bu,compareRange:()=>Yne,findCommentNode:()=>D9,findDeclarationNodeAtOffset:()=>VRe,findLeafNodeAtOffset:()=>O9,findLeafNodeBeforeOffset:()=>Xne,flattenCst:()=>URe,getInteriorNodes:()=>qRe,getNextNode:()=>WRe,getPreviousNode:()=>Kne,getStartlineNode:()=>HRe,inRange:()=>M9,isChildNode:()=>I9,isCommentNode:()=>N9,streamCst:()=>Fd,toDocumentSegment:()=>zd,tokenToRange:()=>Ig});function Fd(t){return new Cc(t,e=>eo(e)?e.content:[],{includeRoot:!0})}function URe(t){return Fd(t).filter(Qh)}function I9(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function Ig(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function zd(t){if(!t)return;let{offset:e,end:r,range:n}=t;return{range:n,offset:e,end:r,length:r-e}}function Yne(t,e){if(t.end.linee.end.line||t.start.line===e.end.line&&t.start.character>e.end.character)return Bu.After;let r=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,n=t.end.lineBu.After}function VRe(t,e,r=Yw){if(t){if(e>0){let n=e-t.offset,i=t.text.charAt(n);r.test(i)||e--}return O9(t,e)}}function D9(t,e){if(t){let r=Kne(t,!0);if(r&&N9(r,e))return r;if(Ty(t)){let n=t.content.findIndex(i=>!i.hidden);for(let i=n-1;i>=0;i--){let a=t.content[i];if(N9(a,e))return a}}}}function N9(t,e){return Qh(t)&&e.includes(t.tokenType.name)}function O9(t,e){if(Qh(t))return t;if(eo(t)){let r=jne(t,e,!1);if(r)return O9(r,e)}}function Xne(t,e){if(Qh(t))return t;if(eo(t)){let r=jne(t,e,!0);if(r)return Xne(r,e)}}function jne(t,e,r){let n=0,i=t.content.length-1,a;for(;n<=i;){let s=Math.floor((n+i)/2),o=t.content[s];if(o.offset<=e&&o.end>e)return o;o.end<=e?(a=r?o:void 0,n=s+1):i=s-1}return a}function Kne(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t);for(;n>0;){n--;let i=r.content[n];if(e||!i.hidden)return i}t=r}}function WRe(t,e=!0){for(;t.container;){let r=t.container,n=r.content.indexOf(t),i=r.content.length-1;for(;n{$o();Ls();(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside"})(Bu||(Bu={}));Yw=/^[\w\p{L}]$/u});function Jh(t){throw new Error("Error! The input value was not handled.")}var $d,jw=F(()=>{$d=class extends Error{constructor(e,r){super(e?`${r} at ${e.range.start.line}:${e.range.start.character}`:r)}}});var Ly={};vr(Ly,{AbstractElement:()=>B9,AbstractRule:()=>Sy,AbstractType:()=>Cy,Action:()=>hL,Alternatives:()=>fL,ArrayLiteral:()=>F9,ArrayType:()=>z9,Assignment:()=>dL,BooleanLiteral:()=>G9,CharacterRange:()=>pL,Condition:()=>Kw,Conjunction:()=>V9,CrossReference:()=>mL,Disjunction:()=>H9,EndOfFile:()=>vL,Grammar:()=>Y9,GrammarImport:()=>Qne,Group:()=>xL,InferredType:()=>X9,Interface:()=>j9,Keyword:()=>bL,LangiumGrammarAstReflection:()=>Mg,LangiumGrammarTerminals:()=>XRe,NamedArgument:()=>Jne,NegatedToken:()=>wL,Negation:()=>K9,NumberLiteral:()=>Q9,Parameter:()=>J9,ParameterReference:()=>eL,ParserRule:()=>rL,ReferenceType:()=>nL,RegexToken:()=>TL,ReturnType:()=>eie,RuleCall:()=>SL,SimpleType:()=>sL,StringLiteral:()=>oL,TerminalAlternatives:()=>CL,TerminalGroup:()=>_L,TerminalRule:()=>Qw,TerminalRuleCall:()=>RL,Type:()=>lL,TypeAttribute:()=>tie,TypeDefinition:()=>P9,UnionType:()=>cL,UnorderedGroup:()=>NL,UntilToken:()=>IL,ValueLiteral:()=>Zw,Wildcard:()=>DL,isAbstractElement:()=>Ay,isAbstractRule:()=>jRe,isAbstractType:()=>KRe,isAction:()=>Fu,isAlternatives:()=>rk,isArrayLiteral:()=>tNe,isArrayType:()=>$9,isAssignment:()=>Sl,isBooleanLiteral:()=>U9,isCharacterRange:()=>gL,isCondition:()=>ZRe,isConjunction:()=>W9,isCrossReference:()=>Gd,isDisjunction:()=>q9,isEndOfFile:()=>yL,isFeatureName:()=>QRe,isGrammar:()=>rNe,isGrammarImport:()=>nNe,isGroup:()=>ef,isInferredType:()=>Jw,isInterface:()=>ek,isKeyword:()=>Uo,isNamedArgument:()=>iNe,isNegatedToken:()=>kL,isNegation:()=>Z9,isNumberLiteral:()=>aNe,isParameter:()=>sNe,isParameterReference:()=>tL,isParserRule:()=>Ra,isPrimitiveType:()=>Zne,isReferenceType:()=>iL,isRegexToken:()=>EL,isReturnType:()=>aL,isRuleCall:()=>Cl,isSimpleType:()=>tk,isStringLiteral:()=>oNe,isTerminalAlternatives:()=>AL,isTerminalGroup:()=>LL,isTerminalRule:()=>Go,isTerminalRuleCall:()=>nk,isType:()=>_y,isTypeAttribute:()=>lNe,isTypeDefinition:()=>JRe,isUnionType:()=>uL,isUnorderedGroup:()=>ik,isUntilToken:()=>ML,isValueLiteral:()=>eNe,isWildcard:()=>OL,reflection:()=>nr});function jRe(t){return nr.isInstance(t,Sy)}function KRe(t){return nr.isInstance(t,Cy)}function ZRe(t){return nr.isInstance(t,Kw)}function QRe(t){return Zne(t)||t==="current"||t==="entry"||t==="extends"||t==="false"||t==="fragment"||t==="grammar"||t==="hidden"||t==="import"||t==="interface"||t==="returns"||t==="terminal"||t==="true"||t==="type"||t==="infer"||t==="infers"||t==="with"||typeof t=="string"&&/\^?[_a-zA-Z][\w_]*/.test(t)}function Zne(t){return t==="string"||t==="number"||t==="boolean"||t==="Date"||t==="bigint"}function JRe(t){return nr.isInstance(t,P9)}function eNe(t){return nr.isInstance(t,Zw)}function Ay(t){return nr.isInstance(t,B9)}function tNe(t){return nr.isInstance(t,F9)}function $9(t){return nr.isInstance(t,z9)}function U9(t){return nr.isInstance(t,G9)}function W9(t){return nr.isInstance(t,V9)}function q9(t){return nr.isInstance(t,H9)}function rNe(t){return nr.isInstance(t,Y9)}function nNe(t){return nr.isInstance(t,Qne)}function Jw(t){return nr.isInstance(t,X9)}function ek(t){return nr.isInstance(t,j9)}function iNe(t){return nr.isInstance(t,Jne)}function Z9(t){return nr.isInstance(t,K9)}function aNe(t){return nr.isInstance(t,Q9)}function sNe(t){return nr.isInstance(t,J9)}function tL(t){return nr.isInstance(t,eL)}function Ra(t){return nr.isInstance(t,rL)}function iL(t){return nr.isInstance(t,nL)}function aL(t){return nr.isInstance(t,eie)}function tk(t){return nr.isInstance(t,sL)}function oNe(t){return nr.isInstance(t,oL)}function Go(t){return nr.isInstance(t,Qw)}function _y(t){return nr.isInstance(t,lL)}function lNe(t){return nr.isInstance(t,tie)}function uL(t){return nr.isInstance(t,cL)}function Fu(t){return nr.isInstance(t,hL)}function rk(t){return nr.isInstance(t,fL)}function Sl(t){return nr.isInstance(t,dL)}function gL(t){return nr.isInstance(t,pL)}function Gd(t){return nr.isInstance(t,mL)}function yL(t){return nr.isInstance(t,vL)}function ef(t){return nr.isInstance(t,xL)}function Uo(t){return nr.isInstance(t,bL)}function kL(t){return nr.isInstance(t,wL)}function EL(t){return nr.isInstance(t,TL)}function Cl(t){return nr.isInstance(t,SL)}function AL(t){return nr.isInstance(t,CL)}function LL(t){return nr.isInstance(t,_L)}function nk(t){return nr.isInstance(t,RL)}function ik(t){return nr.isInstance(t,NL)}function ML(t){return nr.isInstance(t,IL)}function OL(t){return nr.isInstance(t,DL)}var XRe,Sy,Cy,Kw,P9,Zw,B9,F9,z9,G9,V9,H9,Y9,Qne,X9,j9,Jne,K9,Q9,J9,eL,rL,nL,eie,sL,oL,Qw,lL,tie,cL,hL,fL,dL,pL,mL,vL,xL,bL,wL,TL,SL,CL,_L,RL,NL,IL,DL,Mg,nr,Ac=F(()=>{$o();XRe={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},Sy="AbstractRule";Cy="AbstractType";Kw="Condition";P9="TypeDefinition";Zw="ValueLiteral";B9="AbstractElement";F9="ArrayLiteral";z9="ArrayType";G9="BooleanLiteral";V9="Conjunction";H9="Disjunction";Y9="Grammar";Qne="GrammarImport";X9="InferredType";j9="Interface";Jne="NamedArgument";K9="Negation";Q9="NumberLiteral";J9="Parameter";eL="ParameterReference";rL="ParserRule";nL="ReferenceType";eie="ReturnType";sL="SimpleType";oL="StringLiteral";Qw="TerminalRule";lL="Type";tie="TypeAttribute";cL="UnionType";hL="Action";fL="Alternatives";dL="Assignment";pL="CharacterRange";mL="CrossReference";vL="EndOfFile";xL="Group";bL="Keyword";wL="NegatedToken";TL="RegexToken";SL="RuleCall";CL="TerminalAlternatives";_L="TerminalGroup";RL="TerminalRuleCall";NL="UnorderedGroup";IL="UntilToken";DL="Wildcard";Mg=class extends Pd{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayLiteral","ArrayType","Assignment","BooleanLiteral","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","NamedArgument","NegatedToken","Negation","NumberLiteral","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","StringLiteral","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","ValueLiteral","Wildcard"]}computeIsSubtype(e,r){switch(e){case hL:case fL:case dL:case pL:case mL:case vL:case xL:case bL:case wL:case TL:case SL:case CL:case _L:case RL:case NL:case IL:case DL:return this.isSubtype(B9,r);case F9:case Q9:case oL:return this.isSubtype(Zw,r);case z9:case nL:case sL:case cL:return this.isSubtype(P9,r);case G9:return this.isSubtype(Kw,r)||this.isSubtype(Zw,r);case V9:case H9:case K9:case eL:return this.isSubtype(Kw,r);case X9:case j9:case lL:return this.isSubtype(Cy,r);case rL:return this.isSubtype(Sy,r)||this.isSubtype(Cy,r);case Qw:return this.isSubtype(Sy,r);default:return!1}}getReferenceType(e){let r=`${e.container.$type}:${e.property}`;switch(r){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Cy;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Sy;case"Grammar:usedGrammars":return Y9;case"NamedArgument:parameter":case"ParameterReference:parameter":return J9;case"TerminalRuleCall:rule":return Qw;default:throw new Error(`${r} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"AbstractElement":return{name:"AbstractElement",properties:[{name:"cardinality"},{name:"lookahead"}]};case"ArrayLiteral":return{name:"ArrayLiteral",properties:[{name:"elements",defaultValue:[]}]};case"ArrayType":return{name:"ArrayType",properties:[{name:"elementType"}]};case"BooleanLiteral":return{name:"BooleanLiteral",properties:[{name:"true",defaultValue:!1}]};case"Conjunction":return{name:"Conjunction",properties:[{name:"left"},{name:"right"}]};case"Disjunction":return{name:"Disjunction",properties:[{name:"left"},{name:"right"}]};case"Grammar":return{name:"Grammar",properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case"GrammarImport":return{name:"GrammarImport",properties:[{name:"path"}]};case"InferredType":return{name:"InferredType",properties:[{name:"name"}]};case"Interface":return{name:"Interface",properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case"NamedArgument":return{name:"NamedArgument",properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case"Negation":return{name:"Negation",properties:[{name:"value"}]};case"NumberLiteral":return{name:"NumberLiteral",properties:[{name:"value"}]};case"Parameter":return{name:"Parameter",properties:[{name:"name"}]};case"ParameterReference":return{name:"ParameterReference",properties:[{name:"parameter"}]};case"ParserRule":return{name:"ParserRule",properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case"ReferenceType":return{name:"ReferenceType",properties:[{name:"referenceType"}]};case"ReturnType":return{name:"ReturnType",properties:[{name:"name"}]};case"SimpleType":return{name:"SimpleType",properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case"StringLiteral":return{name:"StringLiteral",properties:[{name:"value"}]};case"TerminalRule":return{name:"TerminalRule",properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case"Type":return{name:"Type",properties:[{name:"name"},{name:"type"}]};case"TypeAttribute":return{name:"TypeAttribute",properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case"UnionType":return{name:"UnionType",properties:[{name:"types",defaultValue:[]}]};case"Action":return{name:"Action",properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case"Alternatives":return{name:"Alternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"Assignment":return{name:"Assignment",properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case"CharacterRange":return{name:"CharacterRange",properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case"CrossReference":return{name:"CrossReference",properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case"EndOfFile":return{name:"EndOfFile",properties:[{name:"cardinality"},{name:"lookahead"}]};case"Group":return{name:"Group",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case"Keyword":return{name:"Keyword",properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case"NegatedToken":return{name:"NegatedToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"RegexToken":return{name:"RegexToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case"RuleCall":return{name:"RuleCall",properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalGroup":return{name:"TerminalGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalRuleCall":return{name:"TerminalRuleCall",properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"UnorderedGroup":return{name:"UnorderedGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"UntilToken":return{name:"UntilToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"Wildcard":return{name:"Wildcard",properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}},nr=new Mg});var sk={};vr(sk,{assignMandatoryProperties:()=>FL,copyAstNode:()=>BL,findLocalReferences:()=>uNe,findRootNode:()=>rie,getContainerOfType:()=>Ud,getDocument:()=>_i,hasContainerOfType:()=>cNe,linkContentToContainer:()=>ak,streamAllContents:()=>_c,streamAst:()=>Vo,streamContents:()=>Ry,streamReferences:()=>Dg});function ak(t){for(let[e,r]of Object.entries(t))e.startsWith("$")||(Array.isArray(r)?r.forEach((n,i)=>{Xn(n)&&(n.$container=t,n.$containerProperty=e,n.$containerIndex=i)}):Xn(r)&&(r.$container=t,r.$containerProperty=e))}function Ud(t,e){let r=t;for(;r;){if(e(r))return r;r=r.$container}}function cNe(t,e){let r=t;for(;r;){if(e(r))return!0;r=r.$container}return!1}function _i(t){let r=rie(t).$document;if(!r)throw new Error("AST node has no document.");return r}function rie(t){for(;t.$container;)t=t.$container;return t}function Ry(t,e){if(!t)throw new Error("Node must be an AstNode.");let r=e?.range;return new to(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),n=>{for(;n.keyIndexRy(r,e))}function Vo(t,e){if(t){if(e?.range&&!PL(t,e.range))return new Cc(t,()=>[])}else throw new Error("Root node must be an AstNode.");return new Cc(t,r=>Ry(r,e),{includeRoot:!0})}function PL(t,e){var r;if(!e)return!0;let n=(r=t.$cstNode)===null||r===void 0?void 0:r.range;return n?M9(n,e):!1}function Dg(t){return new to(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex{Dg(n).forEach(i=>{i.reference.ref===t&&r.push(i.reference)})}),Xr(r)}function FL(t,e){let r=t.getTypeMetaData(e.$type),n=e;for(let i of r.properties)i.defaultValue!==void 0&&n[i.name]===void 0&&(n[i.name]=nie(i.defaultValue))}function nie(t){return Array.isArray(t)?[...t.map(nie)]:t}function BL(t,e){let r={$type:t.$type};for(let[n,i]of Object.entries(t))if(!n.startsWith("$"))if(Xn(i))r[n]=BL(i,e);else if(pa(i))r[n]=e(r,n,i.$refNode,i.$refText);else if(Array.isArray(i)){let a=[];for(let s of i)Xn(s)?a.push(BL(s,e)):pa(s)?a.push(e(r,n,s.$refNode,s.$refText)):a.push(s);r[n]=a}else r[n]=i;return ak(r),r}var Qa=F(()=>{$o();Ls();El()});function Zt(t){return t.charCodeAt(0)}function ok(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function Og(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Vd(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Ny(){throw Error("Internal Error - Should never get here!")}function zL(t){return t.type==="Character"}var $L=F(()=>{});var Iy,My,GL,iie=F(()=>{$L();Iy=[];for(let t=Zt("0");t<=Zt("9");t++)Iy.push(t);My=[Zt("_")].concat(Iy);for(let t=Zt("a");t<=Zt("z");t++)My.push(t);for(let t=Zt("A");t<=Zt("Z");t++)My.push(t);GL=[Zt(" "),Zt("\f"),Zt(` `),Zt("\r"),Zt(" "),Zt("\v"),Zt(" "),Zt("\xA0"),Zt("\u1680"),Zt("\u2000"),Zt("\u2001"),Zt("\u2002"),Zt("\u2003"),Zt("\u2004"),Zt("\u2005"),Zt("\u2006"),Zt("\u2007"),Zt("\u2008"),Zt("\u2009"),Zt("\u200A"),Zt("\u2028"),Zt("\u2029"),Zt("\u202F"),Zt("\u205F"),Zt("\u3000"),Zt("\uFEFF")]});var hNe,lk,fNe,Wd,aie=F(()=>{$L();iie();hNe=/[0-9a-fA-F]/,lk=/[0-9]/,fNe=/[1-9]/,Wd=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Og(n,"global");break;case"i":Og(n,"ignoreCase");break;case"m":Og(n,"multiLine");break;case"u":Og(n,"unicode");break;case"y":Og(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}Vd(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return Ny()}quantifier(e=!1){let r,n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),r={atLeast:i,atMost:a}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Vd(r);break}if(!(e===!0&&r===void 0)&&Vd(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Vd(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Ny()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[Zt(` `),Zt("\r"),Zt("\u2028"),Zt("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=Iy;break;case"D":e=Iy,r=!0;break;case"s":e=GL;break;case"S":e=GL,r=!0;break;case"w":e=My;break;case"W":e=My,r=!0;break}return Vd(e)?{type:"Set",value:e,complement:r}:Ny()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=Zt("\f");break;case"n":e=Zt(` `);break;case"r":e=Zt("\r");break;case"t":e=Zt(" ");break;case"v":e=Zt("\v");break}return Vd(e)?{type:"Character",value:e}:Ny()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:Zt("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:Zt(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case` `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:Zt(e)}}}characterClass(){let e=[],r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){let n=this.classAtom(),i=n.type==="Character";if(zL(n)&&this.isRangeDash()){this.consumeChar("-");let a=this.classAtom(),s=a.type==="Character";if(zL(a)){if(a.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}});var Lc,sie=F(()=>{Lc=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}});var Dy=F(()=>{aie();sie()});var uk={};vr(uk,{NEWLINE_REGEXP:()=>VL,escapeRegExp:()=>qd,getCaseInsensitivePattern:()=>HL,getTerminalParts:()=>dNe,isMultilineComment:()=>WL,isWhitespace:()=>ck,partialMatches:()=>qL,partialRegExp:()=>lie});function dNe(t){try{typeof t!="string"&&(t=t.source),t=`/${t}/`;let e=oie.pattern(t),r=[];for(let n of e.value.value)Hd.reset(t),Hd.visit(n),r.push({start:Hd.startRegexp,end:Hd.endRegex});return r}catch{return[]}}function WL(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Hd.reset(t),Hd.visit(oie.pattern(t)),Hd.multiline}catch{return!1}}function ck(t){return(typeof t=="string"?new RegExp(t):t).test(" ")}function qd(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function HL(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:qd(e)).join("")}function qL(t,e){let r=lie(t),n=e.match(r);return!!n&&n[0].length>0}function lie(t){typeof t=="string"&&(t=new RegExp(t));let e=t,r=t.source,n=0;function i(){let a="",s;function o(u){a+=r.substr(n,u),n+=u}function l(u){a+="(?:"+r.substr(n,u)+"|$)",n+=u}for(;n",n)-n+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?o(s[0].length):l(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":a+="(?:",n+=3,a+=i()+"|$)";break;case"=":a+="(?=",n+=3,a+=i()+")";break;case"!":s=n,n+=3,i(),a+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),a+=r.substr(s,n-s);break;default:o(r.indexOf(">",n)-n+1),a+=i()+"|$)";break}break}else o(1),a+=i()+"|$)";break;case")":return++n,a;default:l(1);break}return a}return new RegExp(i(),t.flags)}var VL,oie,UL,Hd,Pg=F(()=>{Dy();VL=/\r?\n/gm,oie=new Wd,UL=class extends Lc{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let r=String.fromCharCode(e.value);if(!this.multiline&&r===` `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let n=qd(r);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){let r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!` `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},Hd=new UL});var fk={};vr(fk,{findAssignment:()=>tR,findNameAssignment:()=>hk,findNodeForKeyword:()=>JL,findNodeForProperty:()=>Py,findNodesForKeyword:()=>pNe,findNodesForKeywordInternal:()=>eR,findNodesForProperty:()=>ZL,getActionAtElement:()=>die,getActionType:()=>gie,getAllReachableRules:()=>Oy,getCrossReferenceTerminal:()=>jL,getEntryRule:()=>cie,getExplicitRuleType:()=>rR,getHiddenRules:()=>uie,getRuleType:()=>nR,getTypeName:()=>Yd,isArrayCardinality:()=>mNe,isArrayOperator:()=>vNe,isCommentTerminal:()=>KL,isDataType:()=>yNe,isDataTypeRule:()=>By,isOptionalCardinality:()=>gNe,terminalRegex:()=>Bg});function cie(t){return t.rules.find(e=>Ra(e)&&e.entry)}function uie(t){return t.rules.filter(e=>Go(e)&&e.hidden)}function Oy(t,e){let r=new Set,n=cie(t);if(!n)return new Set(t.rules);let i=[n].concat(uie(t));for(let s of i)hie(s,r,e);let a=new Set;for(let s of t.rules)(r.has(s.name)||Go(s)&&s.hidden)&&a.add(s);return a}function hie(t,e,r){e.add(t.name),_c(t).forEach(n=>{if(Cl(n)||r&&nk(n)){let i=n.rule.ref;i&&!e.has(i.name)&&hie(i,e,r)}})}function jL(t){if(t.terminal)return t.terminal;if(t.type.ref){let e=hk(t.type.ref);return e?.terminal}}function KL(t){return t.hidden&&!Bg(t).test(" ")}function ZL(t,e){return!t||!e?[]:QL(t,e,t.astNode,!0)}function Py(t,e,r){if(!t||!e)return;let n=QL(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function QL(t,e,r,n){if(!n){let i=Ud(t.grammarSource,Sl);if(i&&i.feature===e)return[t]}return eo(t)&&t.astNode===r?t.content.flatMap(i=>QL(i,e,r,!1)):[]}function pNe(t,e){return t?eR(t,e,t?.astNode):[]}function JL(t,e,r){if(!t)return;let n=eR(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function eR(t,e,r){if(t.astNode!==r)return[];if(Uo(t.grammarSource)&&t.grammarSource.value===e)return[t];let n=Fd(t).iterator(),i,a=[];do if(i=n.next(),!i.done){let s=i.value;s.astNode===r?Uo(s.grammarSource)&&s.grammarSource.value===e&&a.push(s):n.prune()}while(!i.done);return a}function tR(t){var e;let r=t.astNode;for(;r===((e=t.container)===null||e===void 0?void 0:e.astNode);){let n=Ud(t.grammarSource,Sl);if(n)return n;t=t.container}}function hk(t){let e=t;return Jw(e)&&(Fu(e.$container)?e=e.$container.$container:Ra(e.$container)?e=e.$container:Jh(e.$container)),fie(t,e,new Map)}function fie(t,e,r){var n;function i(a,s){let o;return Ud(a,Sl)||(o=fie(s,s,r)),r.set(t,o),o}if(r.has(t))return r.get(t);r.set(t,void 0);for(let a of _c(e)){if(Sl(a)&&a.feature.toLowerCase()==="name")return r.set(t,a),a;if(Cl(a)&&Ra(a.rule.ref))return i(a,a.rule.ref);if(tk(a)&&(!((n=a.typeRef)===null||n===void 0)&&n.ref))return i(a,a.typeRef.ref)}}function die(t){let e=t.$container;if(ef(e)){let r=e.elements,n=r.indexOf(t);for(let i=n-1;i>=0;i--){let a=r[i];if(Fu(a))return a;{let s=_c(r[i]).find(Fu);if(s)return s}}}if(Ay(e))return die(e)}function gNe(t,e){return t==="?"||t==="*"||ef(e)&&!!e.guardCondition}function mNe(t){return t==="*"||t==="+"}function vNe(t){return t==="+="}function By(t){return pie(t,new Set)}function pie(t,e){if(e.has(t))return!0;e.add(t);for(let r of _c(t))if(Cl(r)){if(!r.rule.ref||Ra(r.rule.ref)&&!pie(r.rule.ref,e))return!1}else{if(Sl(r))return!1;if(Fu(r))return!1}return!!t.definition}function yNe(t){return XL(t.type,new Set)}function XL(t,e){if(e.has(t))return!0;if(e.add(t),$9(t))return!1;if(iL(t))return!1;if(uL(t))return t.types.every(r=>XL(r,e));if(tk(t)){if(t.primitiveType!==void 0)return!0;if(t.stringType!==void 0)return!0;if(t.typeRef!==void 0){let r=t.typeRef.ref;return _y(r)?XL(r.type,e):!1}else return!1}else return!1}function rR(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){let e=t.returnType.ref;if(e){if(Ra(e))return e.name;if(ek(e)||_y(e))return e.name}}}function Yd(t){var e;if(Ra(t))return By(t)?t.name:(e=rR(t))!==null&&e!==void 0?e:t.name;if(ek(t)||_y(t)||aL(t))return t.name;if(Fu(t)){let r=gie(t);if(r)return r}else if(Jw(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function gie(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return Yd(t.type.ref)}function nR(t){var e,r,n;return Go(t)?(r=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:"string":By(t)?t.name:(n=rR(t))!==null&&n!==void 0?n:t.name}function Bg(t){let e={s:!1,i:!1,u:!1},r=Fg(t.definition,e),n=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(r,n)}function Fg(t,e){if(AL(t))return xNe(t);if(LL(t))return bNe(t);if(gL(t))return TNe(t);if(nk(t)){let r=t.rule.ref;if(!r)throw new Error("Missing rule reference.");return zu(Fg(r.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(kL(t))return kNe(t);if(ML(t))return wNe(t);if(EL(t)){let r=t.regex.lastIndexOf("/"),n=t.regex.substring(1,r),i=t.regex.substring(r+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),zu(n,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(OL(t))return zu(iR,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t?.$type}`)}}}function xNe(t){return zu(t.elements.map(e=>Fg(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function bNe(t){return zu(t.elements.map(e=>Fg(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function wNe(t){return zu(`${iR}*?${Fg(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function kNe(t){return zu(`(?!${Fg(t.terminal)})${iR}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function TNe(t){return t.right?zu(`[${YL(t.left)}-${YL(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):zu(YL(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function YL(t){return qd(t.value)}function zu(t,e){var r;return(e.wrap!==!1||e.lookahead)&&(t=`(${(r=e.lookahead)!==null&&r!==void 0?r:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}var iR,Al=F(()=>{jw();Ac();$o();Qa();El();Pg();iR=/[\s\S]/.source});function aR(t){let e=[],r=t.Grammar;for(let n of r.rules)Go(n)&&KL(n)&&WL(Bg(n))&&e.push(n.name);return{multilineCommentRules:e,nameRegexp:Yw}}var sR=F(()=>{El();Al();Pg();Ac()});var oR=F(()=>{});function zg(t){console&&console.error&&console.error(`Error: ${t}`)}function Fy(t){console&&console.warn&&console.warn(`Warning: ${t}`)}var mie=F(()=>{});function zy(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}var vie=F(()=>{});function $y(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}var yie=F(()=>{});var $g=F(()=>{mie();vie();yie()});function ENe(t){return SNe(t)?t.LABEL:t.name}function SNe(t){return ci(t.LABEL)&&t.LABEL!==""}function dk(t){return je(t,Gg)}function Gg(t){function e(r){return je(r,Gg)}if(t instanceof Kr){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ci(t.label)&&(r.label=t.label),r}else{if(t instanceof En)return{type:"Alternative",definition:e(t.definition)};if(t instanceof Zr)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Sn)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Cn)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Gg(new pr({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof pn)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Gg(new pr({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof br)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof gn)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof pr){let r={type:"Terminal",name:t.terminalType.name,label:ENe(t.terminalType),idx:t.idx};ci(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Io(n)?n.source:n),r}else{if(t instanceof Ja)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ro,Kr,Ja,En,Zr,Sn,Cn,br,pn,gn,pr,pk=F(()=>{Ot();ro=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Te(this.definition,r=>{r.accept(e)})}},Kr=class extends ro{constructor(e){super([]),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Ja=class extends ro{constructor(e){super(e.definition),this.orgText="",ua(this,Cs(e,r=>r!==void 0))}},En=class extends ro{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,ua(this,Cs(e,r=>r!==void 0))}},Zr=class extends ro{constructor(e){super(e.definition),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}},Sn=class extends ro{constructor(e){super(e.definition),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}},Cn=class extends ro{constructor(e){super(e.definition),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}},br=class extends ro{constructor(e){super(e.definition),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}},pn=class extends ro{constructor(e){super(e.definition),this.idx=1,ua(this,Cs(e,r=>r!==void 0))}},gn=class extends ro{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,ua(this,Cs(e,r=>r!==void 0))}},pr=class{constructor(e){this.idx=1,ua(this,Cs(e,r=>r!==void 0))}accept(e){e.visit(this)}}});var es,xie=F(()=>{pk();es=class{visit(e){let r=e;switch(r.constructor){case Kr:return this.visitNonTerminal(r);case En:return this.visitAlternative(r);case Zr:return this.visitOption(r);case Sn:return this.visitRepetitionMandatory(r);case Cn:return this.visitRepetitionMandatoryWithSeparator(r);case pn:return this.visitRepetitionWithSeparator(r);case br:return this.visitRepetition(r);case gn:return this.visitAlternation(r);case pr:return this.visitTerminal(r);case Ja:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}});function lR(t){return t instanceof En||t instanceof Zr||t instanceof br||t instanceof Sn||t instanceof Cn||t instanceof pn||t instanceof pr||t instanceof Ja}function Xd(t,e=[]){return t instanceof Zr||t instanceof br||t instanceof pn?!0:t instanceof gn?sy(t.definition,n=>Xd(n,e)):t instanceof Kr&&Bn(e,t)?!1:t instanceof ro?(t instanceof Kr&&e.push(t),_a(t.definition,n=>Xd(n,e))):!1}function cR(t){return t instanceof gn}function Rs(t){if(t instanceof Kr)return"SUBRULE";if(t instanceof Zr)return"OPTION";if(t instanceof gn)return"OR";if(t instanceof Sn)return"AT_LEAST_ONE";if(t instanceof Cn)return"AT_LEAST_ONE_SEP";if(t instanceof pn)return"MANY_SEP";if(t instanceof br)return"MANY";if(t instanceof pr)return"CONSUME";throw Error("non exhaustive match")}var bie=F(()=>{Ot();pk()});var ts=F(()=>{pk();xie();bie()});function wie(t,e,r){return[new Zr({definition:[new pr({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}var $u,gk=F(()=>{Ot();ts();$u=class{walk(e,r=[]){Te(e.definition,(n,i)=>{let a=li(e.definition,i+1);if(n instanceof Kr)this.walkProdRef(n,a,r);else if(n instanceof pr)this.walkTerminal(n,a,r);else if(n instanceof En)this.walkFlat(n,a,r);else if(n instanceof Zr)this.walkOption(n,a,r);else if(n instanceof Sn)this.walkAtLeastOne(n,a,r);else if(n instanceof Cn)this.walkAtLeastOneSep(n,a,r);else if(n instanceof pn)this.walkManySep(n,a,r);else if(n instanceof br)this.walkMany(n,a,r);else if(n instanceof gn)this.walkOr(n,a,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new Zr({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=wie(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new Zr({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=wie(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);Te(e.definition,a=>{let s=new En({definition:[a]});this.walk(s,i)})}}});function jd(t){if(t instanceof Kr)return jd(t.referencedRule);if(t instanceof pr)return _Ne(t);if(lR(t))return CNe(t);if(cR(t))return ANe(t);throw Error("non exhaustive match")}function CNe(t){let e=[],r=t.definition,n=0,i=r.length>n,a,s=!0;for(;i&&s;)a=r[n],s=Xd(a),e=e.concat(jd(a)),n=n+1,i=r.length>n;return bg(e)}function ANe(t){let e=je(t.definition,r=>jd(r));return bg(Br(e))}function _Ne(t){return[t.terminalType]}var uR=F(()=>{Ot();ts()});var mk,hR=F(()=>{mk="_~IN~_"});function kie(t){let e={};return Te(t,r=>{let n=new fR(r).startWalking();ua(e,n)}),e}function LNe(t,e){return t.name+e+mk}var fR,Tie=F(()=>{gk();uR();Ot();hR();ts();fR=class extends $u{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=LNe(e.referencedRule,e.idx)+this.topProd.name,a=r.concat(n),s=new En({definition:a}),o=jd(s);this.follows[i]=o}}});function Ug(t){let e=t.toString();if(vk.hasOwnProperty(e))return vk[e];{let r=RNe.pattern(e);return vk[e]=r,r}}function Eie(){vk={}}var vk,RNe,yk=F(()=>{Dy();vk={},RNe=new Wd});function Aie(t,e=!1){try{let r=Ug(t);return dR(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===Cie)e&&Fy(`${Gy} Unable to optimize: < ${t.toString()} > Complement Sets cannot be automatically optimized. This will disable the lexer's first char optimizations. See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=` This will disable the lexer's first char optimizations. See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),zg(`${Gy} Failed parsing: < ${t.toString()} > Using the @chevrotain/regexp-to-ast library Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function dR(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i{if(typeof l=="number")xk(l,e,r);else{let u=l;if(r===!0)for(let h=u.from;h<=u.to;h++)xk(h,e,r);else{for(let h=u.from;h<=u.to&&h=Vg){let h=u.from>=Vg?u.from:Vg,f=u.to,d=Rc(h),p=Rc(f);for(let g=d;g<=p;g++)e[g]=g}}}});break;case"Group":dR(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}let o=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&pR(s)===!1||s.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return fr(e)}function xk(t,e,r){let n=Rc(t);e[n]=n,r===!0&&NNe(t,e)}function NNe(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=Rc(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let a=Rc(i.charCodeAt(0));e[a]=a}}}function Sie(t,e){return ja(t.value,r=>{if(typeof r=="number")return Bn(e,r);{let n=r;return ja(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function pR(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?Et(t.value)?_a(t.value,pR):pR(t.value):!1}function bk(t,e){if(e instanceof RegExp){let r=Ug(e),n=new gR(t);return n.visit(r),n.found}else return ja(e,r=>Bn(t,r.charCodeAt(0)))!==void 0}var Cie,Gy,gR,_ie=F(()=>{Dy();Ot();$g();yk();mR();Cie="Complement Sets are not supported for first char optimization",Gy=`Unable to use "first char" lexer optimizations: `;gR=class extends Lc{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Bn(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Sie(e,this.targetCharCodes)===void 0&&(this.found=!0):Sie(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}});function Nie(t,e){e=Gh(e,{useSticky:yR,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` `],tracer:(b,w)=>w()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{jNe()});let n;r("Reject Lexer.NA",()=>{n=Vh(t,b=>b[Kd]===ei.NA)});let i=!1,a;r("Transform Patterns",()=>{i=!1,a=je(n,b=>{let w=b[Kd];if(Io(w)){let _=w.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!w.ignoreCase?_:_.length===2&&_[0]==="\\"&&!Bn(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?Rie(w):Lie(w)}else{if(gi(w))return i=!0,{exec:w};if(typeof w=="object")return i=!0,w;if(typeof w=="string"){if(w.length===1)return w;{let _=w.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),k=new RegExp(_);return e.useSticky?Rie(k):Lie(k)}}else throw Error("non exhaustive match")}})});let s,o,l,u,h;r("misc mapping",()=>{s=je(n,b=>b.tokenTypeIdx),o=je(n,b=>{let w=b.GROUP;if(w!==ei.SKIPPED){if(ci(w))return w;if(ar(w))return!1;throw Error("non exhaustive match")}}),l=je(n,b=>{let w=b.LONGER_ALT;if(w)return Et(w)?je(w,k=>nw(n,k)):[nw(n,w)]}),u=je(n,b=>b.PUSH_MODE),h=je(n,b=>St(b,"POP_MODE"))});let f;r("Line Terminator Handling",()=>{let b=zie(e.lineTerminatorCharacters);f=je(n,w=>!1),e.positionTracking!=="onlyOffset"&&(f=je(n,w=>St(w,"LINE_BREAKS")?!!w.LINE_BREAKS:Fie(w,b)===!1&&bk(b,w.PATTERN)))});let d,p,g,m;r("Misc Mapping #2",()=>{d=je(n,Pie),p=je(a,YNe),g=zr(n,(b,w)=>{let _=w.GROUP;return ci(_)&&_!==ei.SKIPPED&&(b[_]=[]),b},{}),m=je(a,(b,w)=>({pattern:a[w],longerAlt:l[w],canLineTerminator:f[w],isCustom:d[w],short:p[w],group:o[w],push:u[w],pop:h[w],tokenTypeIdx:s[w],tokenType:n[w]}))});let y=!0,x=[];return e.safeMode||r("First Char Optimization",()=>{x=zr(n,(b,w,_)=>{if(typeof w.PATTERN=="string"){let k=w.PATTERN.charCodeAt(0),E=Rc(k);vR(b,E,m[_])}else if(Et(w.START_CHARS_HINT)){let k;Te(w.START_CHARS_HINT,E=>{let L=typeof E=="string"?E.charCodeAt(0):E,S=Rc(L);k!==S&&(k=S,vR(b,S,m[_]))})}else if(Io(w.PATTERN))if(w.PATTERN.unicode)y=!1,e.ensureOptimizations&&zg(`${Gy} Unable to analyze < ${w.PATTERN.toString()} > pattern. The regexp unicode flag is not currently supported by the regexp-to-ast library. This will disable the lexer's first char optimizations. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let k=Aie(w.PATTERN,e.ensureOptimizations);ir(k)&&(y=!1),Te(k,E=>{vR(b,E,m[_])})}else e.ensureOptimizations&&zg(`${Gy} TokenType: <${w.name}> is using a custom token pattern without providing parameter. This will disable the lexer's first char optimizations. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return b},[])}),{emptyGroups:g,patternIdxToConfig:m,charCodeToPatternIdxToConfig:x,hasCustom:i,canBeOptimized:y}}function Iie(t,e){let r=[],n=MNe(t);r=r.concat(n.errors);let i=DNe(n.valid),a=i.valid;return r=r.concat(i.errors),r=r.concat(INe(a)),r=r.concat(UNe(a)),r=r.concat(VNe(a,e)),r=r.concat(WNe(a)),r}function INe(t){let e=[],r=Fr(t,n=>Io(n[Kd]));return e=e.concat(PNe(r)),e=e.concat(zNe(r)),e=e.concat($Ne(r)),e=e.concat(GNe(r)),e=e.concat(BNe(r)),e}function MNe(t){let e=Fr(t,i=>!St(i,Kd)),r=je(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Fn.MISSING_PATTERN,tokenTypes:[i]})),n=Uh(t,e);return{errors:r,valid:n}}function DNe(t){let e=Fr(t,i=>{let a=i[Kd];return!Io(a)&&!gi(a)&&!St(a,"exec")&&!ci(a)}),r=je(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Fn.INVALID_PATTERN,tokenTypes:[i]})),n=Uh(t,e);return{errors:r,valid:n}}function PNe(t){class e extends Lc{constructor(){super(...arguments),this.found=!1}visitEndAnchor(a){this.found=!0}}let r=Fr(t,i=>{let a=i.PATTERN;try{let s=Ug(a),o=new e;return o.visit(s),o.found}catch{return ONe.test(a.source)}});return je(r,i=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$' See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Fn.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function BNe(t){let e=Fr(t,n=>n.PATTERN.test(""));return je(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Fn.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}function zNe(t){class e extends Lc{constructor(){super(...arguments),this.found=!1}visitStartAnchor(a){this.found=!0}}let r=Fr(t,i=>{let a=i.PATTERN;try{let s=Ug(a),o=new e;return o.visit(s),o.found}catch{return FNe.test(a.source)}});return je(r,i=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^' See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Fn.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function $Ne(t){let e=Fr(t,n=>{let i=n[Kd];return i instanceof RegExp&&(i.multiline||i.global)});return je(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Fn.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function GNe(t){let e=[],r=je(t,a=>zr(t,(s,o)=>(a.PATTERN.source===o.PATTERN.source&&!Bn(e,o)&&o.PATTERN!==ei.NA&&(e.push(o),s.push(o)),s),[]));r=xc(r);let n=Fr(r,a=>a.length>1);return je(n,a=>{let s=je(a,l=>l.name);return{message:`The same RegExp pattern ->${Yi(a).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Fn.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})}function UNe(t){let e=Fr(t,n=>{if(!St(n,"GROUP"))return!1;let i=n.GROUP;return i!==ei.SKIPPED&&i!==ei.NA&&!ci(i)});return je(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Fn.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function VNe(t,e){let r=Fr(t,i=>i.PUSH_MODE!==void 0&&!Bn(e,i.PUSH_MODE));return je(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Fn.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function WNe(t){let e=[],r=zr(t,(n,i,a)=>{let s=i.PATTERN;return s===ei.NA||(ci(s)?n.push({str:s,idx:a,tokenType:i}):Io(s)&&qNe(s)&&n.push({str:s.source,idx:a,tokenType:i})),n},[]);return Te(t,(n,i)=>{Te(r,({str:a,idx:s,tokenType:o})=>{if(i${o.name}<- can never be matched. Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition. See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:Fn.UNREACHABLE_PATTERN,tokenTypes:[n,o]})}})}),e}function HNe(t,e){if(Io(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(gi(e))return e(t,0,[],{});if(St(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function qNe(t){return ja([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function Lie(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Rie(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function Mie(t,e,r){let n=[];return St(t,Wg)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Wg+`> property in its definition `,type:Fn.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),St(t,wk)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+wk+`> property in its definition `,type:Fn.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),St(t,wk)&&St(t,Wg)&&!St(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Wg}: <${t.defaultMode}>which does not exist `,type:Fn.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),St(t,wk)&&Te(t.modes,(i,a)=>{Te(i,(s,o)=>{if(ar(s))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${a}> at index: <${o}> `,type:Fn.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(St(s,"LONGER_ALT")){let l=Et(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];Te(l,u=>{!ar(u)&&!Bn(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${s.name}> outside of mode <${a}> `,type:Fn.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function Die(t,e,r){let n=[],i=!1,a=xc(Br(fr(t.modes))),s=Vh(a,l=>l[Kd]===ei.NA),o=zie(r);return e&&Te(s,l=>{let u=Fie(l,o);if(u!==!1){let f={message:XNe(l,u),type:u.issue,tokenType:l};n.push(f)}else St(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):bk(o,l.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found. This Lexer has been defined to track line and column information, But none of the Token Types can be identified as matching a line terminator. See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS for details.`,type:Fn.NO_LINE_BREAKS_FLAGS}),n}function Oie(t){let e={},r=Nr(t);return Te(r,n=>{let i=t[n];if(Et(i))e[n]=[];else throw Error("non exhaustive match")}),e}function Pie(t){let e=t.PATTERN;if(Io(e))return!1;if(gi(e))return!0;if(St(e,"exec"))return!0;if(ci(e))return!1;throw Error("non exhaustive match")}function YNe(t){return ci(t)&&t.length===1?t.charCodeAt(0):!1}function Fie(t,e){if(St(t,"LINE_BREAKS"))return!1;if(Io(t.PATTERN)){try{bk(e,t.PATTERN)}catch(r){return{issue:Fn.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(ci(t.PATTERN))return!1;if(Pie(t))return{issue:Fn.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function XNe(t,e){if(e.issue===Fn.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern. The problem is in the <${t.name}> Token Type Root cause: ${e.errMsg}. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Fn.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. The problem is in the <${t.name}> Token Type For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function zie(t){return je(t,r=>ci(r)?r.charCodeAt(0):r)}function vR(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function Rc(t){return t255?255+~~(t/255):t}}var Kd,Wg,wk,yR,ONe,FNe,Bie,Vg,kk,mR=F(()=>{Dy();Uy();Ot();$g();_ie();yk();Kd="PATTERN",Wg="defaultMode",wk="modes",yR=typeof new RegExp("(?:)").sticky=="boolean";ONe=/[^\\][$]/;FNe=/[^\\[][\^]|^\^/;Bie={test:function(t){let e=t.length;for(let r=this.lastIndex;r{r.isParent=r.categoryMatches.length>0})}function KNe(t){let e=jr(t),r=t,n=!0;for(;n;){r=xc(Br(je(r,a=>a.CATEGORIES)));let i=Uh(r,e);e=e.concat(i),ir(i)?n=!1:r=i}return e}function ZNe(t){Te(t,e=>{xR(e)||(Uie[$ie]=e,e.tokenTypeIdx=$ie++),Gie(e)&&!Et(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Gie(e)||(e.CATEGORIES=[]),eIe(e)||(e.categoryMatches=[]),tIe(e)||(e.categoryMatchesMap={})})}function QNe(t){Te(t,e=>{e.categoryMatches=[],Te(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(Uie[n].tokenTypeIdx)})})}function JNe(t){Te(t,e=>{Vie([],e)})}function Vie(t,e){Te(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),Te(e.CATEGORIES,r=>{let n=t.concat(e);Bn(n,r)||Vie(n,r)})}function xR(t){return St(t,"tokenTypeIdx")}function Gie(t){return St(t,"CATEGORIES")}function eIe(t){return St(t,"categoryMatches")}function tIe(t){return St(t,"categoryMatchesMap")}function Wie(t){return St(t,"tokenTypeIdx")}var $ie,Uie,Zd=F(()=>{Ot();$ie=1,Uie={}});var bR,wR=F(()=>{bR={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}}});var Fn,Vy,ei,Uy=F(()=>{mR();Ot();$g();Zd();wR();yk();(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Fn||(Fn={}));Vy={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:bR,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Vy);ei=class{constructor(e,r=Vy){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,a)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${i}>`);let{time:o,value:l}=zy(a),u=o>10?console.warn:console.log;return this.traceInitIndent time: ${o}ms`),this.traceInitIndent--,l}else return a()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. a boolean 2nd argument is no longer supported`);this.config=ua({},Vy,r);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,a=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Vy.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Bie;else if(this.config.lineTerminatorCharacters===Vy.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Et(e)?i={modes:{defaultMode:jr(e)},defaultMode:Wg}:(a=!1,i=jr(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Mie(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Die(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Te(i.modes,(o,l)=>{i.modes[l]=Vh(o,u=>ar(u))});let s=Nr(i.modes);if(Te(i.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Iie(o,s))}),ir(this.lexerDefinitionErrors)){Uu(o);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=Nie(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=u.charCodeToPatternIdxToConfig,this.emptyGroups=ua({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ir(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let l=je(this.lexerDefinitionErrors,u=>u.message).join(`----------------------- `);throw new Error(`Errors detected in definition of Lexer: `+l)}Te(this.lexerDefinitionWarning,o=>{Fy(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(yR?(this.chopInput=qi,this.match=this.matchWithTest):(this.updateLastIndex=Yn,this.match=this.matchWithExec),a&&(this.handleModes=Yn),this.trackStartLines===!1&&(this.computeNewColumn=qi),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Yn),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let o=zr(this.canModeBeOptimized,(l,u,h)=>(u===!1&&l.push(h),l),[]);if(r.ensureOptimizations&&!ir(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized. Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{Eie()}),this.TRACE_INIT("toFastProperties",()=>{$y(this)})})}tokenize(e,r=this.defaultMode){if(!ir(this.lexerDefinitionErrors)){let i=je(this.lexerDefinitionErrors,a=>a.message).join(`----------------------- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: `+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,a,s,o,l,u,h,f,d,p,g,m,y,x,b,w=e,_=w.length,k=0,E=0,L=this.hasCustom?0:Math.floor(e.length/10),S=new Array(L),C=[],M=this.trackStartLines?1:void 0,R=this.trackStartLines?1:void 0,T=Oie(this.emptyGroups),I=this.trackStartLines,A=this.config.lineTerminatorsPattern,D=0,N=[],O=[],B=[],P=[];Object.freeze(P);let $;function z(){return N}function H(ee){let Q=Rc(ee),W=O[Q];return W===void 0?P:W}let J=ee=>{if(B.length===1&&ee.tokenType.PUSH_MODE===void 0){let Q=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ee);C.push({offset:ee.startOffset,line:ee.startLine,column:ee.startColumn,length:ee.image.length,message:Q})}else{B.pop();let Q=ha(B);N=this.patternIdxToConfig[Q],O=this.charCodeToPatternIdxToConfig[Q],D=N.length;let W=this.canModeBeOptimized[Q]&&this.config.safeMode===!1;O&&W?$=H:$=z}};function X(ee){B.push(ee),O=this.charCodeToPatternIdxToConfig[ee],N=this.patternIdxToConfig[ee],D=N.length,D=N.length;let Q=this.canModeBeOptimized[ee]&&this.config.safeMode===!1;O&&Q?$=H:$=z}X.call(this,r);let oe,K=this.config.recoveryEnabled;for(;k<_;){l=null;let ee=w.charCodeAt(k),Q=$(ee),W=Q.length;for(n=0;nl.length){l=s,u=h,oe=ce;break}}}break}}if(l!==null){if(f=l.length,d=oe.group,d!==void 0&&(p=oe.tokenTypeIdx,g=this.createTokenInstance(l,k,p,oe.tokenType,M,R,f),this.handlePayload(g,u),d===!1?E=this.addToken(S,E,g):T[d].push(g)),e=this.chopInput(e,f),k=k+f,R=this.computeNewColumn(R,f),I===!0&&oe.canLineTerminator===!0){let Y=0,Z,se;A.lastIndex=0;do Z=A.test(l),Z===!0&&(se=A.lastIndex-1,Y++);while(Z===!0);Y!==0&&(M=M+Y,R=f-se,this.updateTokenEndLineColumnLocation(g,d,se,Y,M,R,f))}this.handleModes(oe,J,X,g)}else{let Y=k,Z=M,se=R,ce=K===!1;for(;ce===!1&&k<_;)for(e=this.chopInput(e,1),k++,i=0;i{Ot();Uy();Zd();rIe="parent",Hie="categories",qie="label",Yie="group",Xie="push_mode",jie="pop_mode",Kie="longer_alt",Zie="line_breaks",Qie="start_chars_hint";no=Tk({name:"EOF",pattern:ei.NA});Uu([no])});var Wu,Jie,_l,qg=F(()=>{Jd();Ot();ts();Wu={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${kR(t)?`--> ${Vu(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:i}){let a="Expecting: ",o=` but found: '`+Yi(e).image+"'";if(n)return a+n+o;{let l=zr(t,(d,p)=>d.concat(p),[]),u=je(l,d=>`[${je(d,p=>Vu(p)).join(", ")}]`),f=`one of these possible Token sequences: ${je(u,(d,p)=>` ${p+1}. ${d}`).join(` `)}`;return a+f+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){let i="Expecting: ",s=` but found: '`+Yi(e).image+"'";if(r)return i+r+s;{let l=`expecting at least one iteration which starts with one of these possible Token sequences:: <${je(t,u=>`[${je(u,h=>Vu(h)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(Wu);Jie={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- inside top level rule: ->`+t.name+"<-"}},_l={buildDuplicateFoundError(t,e){function r(h){return h instanceof pr?h.terminalType.name:h instanceof Kr?h.nonTerminalName:""}let n=t.name,i=Yi(e),a=i.idx,s=Rs(i),o=r(i),l=a>0,u=`->${s}${l?a:""}<- ${o?`with argument: ->${o}<-`:""} appears more than once (${e.length} times) in the top level rule: ->${n}<-. For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,` `),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar. The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>. To resolve this make sure each Terminal and Non-Terminal names are unique This is easy to accomplish by using the convention that Terminal names start with an uppercase letter and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let e=je(t.prefixPath,i=>Vu(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix in inside <${t.topLevelRule.name}> Rule, <${e}> may appears as a prefix path in all these alternatives. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX For Further details.`},buildAlternationAmbiguityError(t){let e=je(t.prefixPath,i=>Vu(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in inside <${t.topLevelRule.name}> Rule, <${e}> may appears as a prefix path in all these alternatives. `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES For Further details.`,n},buildEmptyRepetitionError(t){let e=Rs(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens. This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in inside <${t.topLevelRule.name}> Rule. Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives: inside <${t.topLevelRule.name}> Rule. has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){let e=t.topLevelRule.name,r=je(t.leftRecursionPath,a=>a.name),n=`${e} --> ${r.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar. rule: <${e}> can be invoked from itself (directly or indirectly) without consuming any Tokens. The grammar path that causes this is: ${n} To fix this refactor your grammar to remove the left recursion. see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Ja?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}}});function eae(t,e){let r=new TR(t,e);return r.resolveRefs(),r.errors}var TR,tae=F(()=>{Ns();Ot();ts();TR=class extends es{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){Te(fr(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:Li.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}});function Ak(t,e,r=[]){r=jr(r);let n=[],i=0;function a(o){return o.concat(li(t,i+1))}function s(o){let l=Ak(a(o),e,r);return n.concat(l)}for(;r.length{ir(l.definition)===!1&&(n=s(l.definition))}),n;if(o instanceof pr)r.push(o.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:li(t,i)}),n}function _k(t,e,r,n){let i="EXIT_NONE_TERMINAL",a=[i],s="EXIT_ALTERNATIVE",o=!1,l=e.length,u=l-n-1,h=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!ir(f);){let d=f.pop();if(d===s){o&&ha(f).idx<=u&&f.pop();continue}let p=d.def,g=d.idx,m=d.ruleStack,y=d.occurrenceStack;if(ir(p))continue;let x=p[0];if(x===i){let b={idx:g,def:li(p),ruleStack:Lu(m),occurrenceStack:Lu(y)};f.push(b)}else if(x instanceof pr)if(g=0;b--){let w=x.definition[b],_={idx:g,def:w.definition.concat(li(p)),ruleStack:m,occurrenceStack:y};f.push(_),f.push(s)}else if(x instanceof En)f.push({idx:g,def:x.definition.concat(li(p)),ruleStack:m,occurrenceStack:y});else if(x instanceof Ja)f.push(iIe(x,g,m,y));else throw Error("non exhaustive match")}return h}function iIe(t,e,r,n){let i=jr(r);i.push(t.name);let a=jr(n);return a.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:a}}var ER,Ek,Yg,Sk,Hy,Ck,qy,Yy=F(()=>{Ot();uR();gk();ts();ER=class extends $u{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=jr(this.path.ruleStack).reverse(),this.occurrenceStack=jr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ir(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Ek=class extends ER{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=r.concat(n),a=new En({definition:i});this.possibleTokTypes=jd(a),this.found=!0}}},Yg=class extends $u{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Sk=class extends Yg{walkMany(e,r,n){if(e.idx===this.occurrence){let i=Yi(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof pr&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},Hy=class extends Yg{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=Yi(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof pr&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},Ck=class extends Yg{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=Yi(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof pr&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},qy=class extends Yg{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=Yi(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof pr&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}}});function Xy(t){if(t instanceof Zr||t==="Option")return zn.OPTION;if(t instanceof br||t==="Repetition")return zn.REPETITION;if(t instanceof Sn||t==="RepetitionMandatory")return zn.REPETITION_MANDATORY;if(t instanceof Cn||t==="RepetitionMandatoryWithSeparator")return zn.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof pn||t==="RepetitionWithSeparator")return zn.REPETITION_WITH_SEPARATOR;if(t instanceof gn||t==="Alternation")return zn.ALTERNATION;throw Error("non exhaustive match")}function Rk(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:i}=t,a=Xy(n);return a===zn.ALTERNATION?Xg(e,r,i):jg(e,r,a,i)}function nae(t,e,r,n,i,a){let s=Xg(t,e,r),o=cae(s)?Hg:Gu;return a(s,n,o,i)}function iae(t,e,r,n,i,a){let s=jg(t,e,i,r),o=cae(s)?Hg:Gu;return a(s[0],o,n)}function aae(t,e,r,n){let i=t.length,a=_a(t,s=>_a(s,o=>o.length===1));if(e)return function(s){let o=je(s,l=>l.GATE);for(let l=0;lBr(l)),o=zr(s,(l,u,h)=>(Te(u,f=>{St(l,f.tokenTypeIdx)||(l[f.tokenTypeIdx]=h),Te(f.categoryMatches,d=>{St(l,d)||(l[d]=h)})}),l),{});return function(){let l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let s=0;sa.length===1),i=t.length;if(n&&!r){let a=Br(t);if(a.length===1&&ir(a[0].categoryMatches)){let o=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{let s=zr(a,(o,l,u)=>(o[l.tokenTypeIdx]=!0,Te(l.categoryMatches,h=>{o[h]=!0}),o),[]);return function(){let o=this.LA(1);return s[o.tokenTypeIdx]===!0}}}else return function(){e:for(let a=0;aAk([s],1)),n=rae(r.length),i=je(r,s=>{let o={};return Te(s,l=>{let u=SR(l.partialPath);Te(u,h=>{o[h]=!0})}),o}),a=r;for(let s=1;s<=e;s++){let o=a;a=rae(o.length);for(let l=0;l{let x=SR(y.partialPath);Te(x,b=>{i[l][b]=!0})})}}}}return n}function Xg(t,e,r,n){let i=new Lk(t,zn.ALTERNATION,n);return e.accept(i),oae(i.result,r)}function jg(t,e,r,n){let i=new Lk(t,r);e.accept(i);let a=i.result,o=new CR(e,t,r).startWalking(),l=new En({definition:a}),u=new En({definition:o});return oae([l,u],n)}function Nk(t,e){e:for(let r=0;r{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function cae(t){return _a(t,e=>_a(e,r=>_a(r,n=>ir(n.categoryMatches))))}var zn,CR,Lk,Kg=F(()=>{Ot();Yy();gk();Zd();ts();(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(zn||(zn={}));CR=class extends $u{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,zn.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,zn.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,zn.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,zn.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,zn.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},Lk=class extends es{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,zn.OPTION)}visitRepetition(e){this.checkIsTarget(e,zn.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,zn.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,zn.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,zn.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,zn.ALTERNATION)}}});function uae(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return je(e,r=>Object.assign({type:Li.CUSTOM_LOOKAHEAD_VALIDATION},r))}function hae(t,e,r,n){let i=fa(t,l=>sIe(l,r)),a=fIe(t,e,r),s=fa(t,l=>cIe(l,r)),o=fa(t,l=>lIe(l,t,n,r));return i.concat(a,s,o)}function sIe(t,e){let r=new AR;t.accept(r);let n=r.allProductions,i=T_(n,oIe),a=Cs(i,o=>o.length>1);return je(fr(a),o=>{let l=Yi(o),u=e.buildDuplicateFoundError(t,o),h=Rs(l),f={message:u,type:Li.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:h,occurrence:l.idx},d=fae(l);return d&&(f.parameter=d),f})}function oIe(t){return`${Rs(t)}_#_${t.idx}_#_${fae(t)}`}function fae(t){return t instanceof pr?t.terminalType.name:t instanceof Kr?t.nonTerminalName:""}function lIe(t,e,r,n){let i=[];if(zr(e,(s,o)=>o.name===t.name?s+1:s,0)>1){let s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:Li.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function dae(t,e,r){let n=[],i;return Bn(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:Li.INVALID_RULE_OVERRIDE,ruleName:t})),n}function LR(t,e,r,n=[]){let i=[],a=Ik(e.definition);if(ir(a))return[];{let s=t.name;Bn(a,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:Li.LEFT_RECURSION,ruleName:s});let l=Uh(a,n.concat([t])),u=fa(l,h=>{let f=jr(n);return f.push(h),LR(t,h,r,f)});return i.concat(u)}}function Ik(t){let e=[];if(ir(t))return e;let r=Yi(t);if(r instanceof Kr)e.push(r.referencedRule);else if(r instanceof En||r instanceof Zr||r instanceof Sn||r instanceof Cn||r instanceof pn||r instanceof br)e=e.concat(Ik(r.definition));else if(r instanceof gn)e=Br(je(r.definition,a=>Ik(a.definition)));else if(!(r instanceof pr))throw Error("non exhaustive match");let n=Xd(r),i=t.length>1;if(n&&i){let a=li(t);return e.concat(Ik(a))}else return e}function pae(t,e){let r=new jy;t.accept(r);let n=r.alternations;return fa(n,a=>{let s=Lu(a.definition);return fa(s,(o,l)=>{let u=_k([o],[],Gu,1);return ir(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:a,emptyChoiceIdx:l}),type:Li.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:a.idx,alternative:l+1}]:[]})})}function gae(t,e,r){let n=new jy;t.accept(n);let i=n.alternations;return i=Vh(i,s=>s.ignoreAmbiguities===!0),fa(i,s=>{let o=s.idx,l=s.maxLookahead||e,u=Xg(o,t,l,s),h=uIe(u,s,t,r),f=hIe(u,s,t,r);return h.concat(f)})}function cIe(t,e){let r=new jy;t.accept(r);let n=r.alternations;return fa(n,a=>a.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:a}),type:Li.TOO_MANY_ALTS,ruleName:t.name,occurrence:a.idx}]:[])}function mae(t,e,r){let n=[];return Te(t,i=>{let a=new _R;i.accept(a);let s=a.allProductions;Te(s,o=>{let l=Xy(o),u=o.maxLookahead||e,h=o.idx,d=jg(h,i,l,u)[0];if(ir(Br(d))){let p=r.buildEmptyRepetitionError({topLevelRule:i,repetition:o});n.push({message:p,type:Li.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function uIe(t,e,r,n){let i=[],a=zr(t,(o,l,u)=>(e.definition[u].ignoreAmbiguities===!0||Te(l,h=>{let f=[u];Te(t,(d,p)=>{u!==p&&Nk(d,h)&&e.definition[p].ignoreAmbiguities!==!0&&f.push(p)}),f.length>1&&!Nk(i,h)&&(i.push(h),o.push({alts:f,path:h}))}),o),[]);return je(a,o=>{let l=je(o.alts,h=>h+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:l,prefixPath:o.path}),type:Li.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:o.alts}})}function hIe(t,e,r,n){let i=zr(t,(s,o,l)=>{let u=je(o,h=>({idx:l,path:h}));return s.concat(u)},[]);return xc(fa(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];let l=s.idx,u=s.path,h=Fr(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx{let p=[d.idx+1,l+1],g=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:p,prefixPath:d.path}),type:Li.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:g,alternatives:p}})}))}function fIe(t,e,r){let n=[],i=je(e,a=>a.name);return Te(t,a=>{let s=a.name;if(Bn(i,s)){let o=r.buildNamespaceConflictError(a);n.push({message:o,type:Li.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),n}var AR,jy,_R,Ky=F(()=>{Ot();Ns();ts();Kg();Yy();Zd();AR=class extends es{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};jy=class extends es{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};_R=class extends es{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}});function vae(t){let e=Gh(t,{errMsgProvider:Jie}),r={};return Te(t.rules,n=>{r[n.name]=n}),eae(r,e.errMsgProvider)}function yae(t){return t=Gh(t,{errMsgProvider:_l}),hae(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var xae=F(()=>{Ot();tae();Ky();qg()});function tf(t){return Bn(Eae,t.name)}var bae,wae,kae,Tae,Eae,Zg,e0,Zy,Qy,Jy,Qg=F(()=>{Ot();bae="MismatchedTokenException",wae="NoViableAltException",kae="EarlyExitException",Tae="NotAllInputParsedException",Eae=[bae,wae,kae,Tae];Object.freeze(Eae);Zg=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},e0=class extends Zg{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=bae}},Zy=class extends Zg{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=wae}},Qy=class extends Zg{constructor(e,r){super(e,r),this.name=Tae}},Jy=class extends Zg{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=kae}}});function dIe(t,e,r,n,i,a,s){let o=this.getKeyForAutomaticLookahead(n,i),l=this.firstAfterRepMap[o];if(l===void 0){let d=this.getCurrRuleFullName(),p=this.getGAstProductions()[d];l=new a(p,i).startWalking(),this.firstAfterRepMap[o]=l}let u=l.token,h=l.occurrence,f=l.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=no,h=1),!(u===void 0||h===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,h,s)&&this.tryInRepetitionRecovery(t,e,r,u)}var RR,IR,NR,Mk,MR=F(()=>{Jd();Ot();Qg();hR();Ns();RR={},IR="InRuleRecoveryException",NR=class extends Error{constructor(e){super(e),this.name=IR}},Mk=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=St(e,"recoveryEnabled")?e.recoveryEnabled:rs.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=dIe)}getTokenToInsert(e){let r=Qd(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let a=this.findReSyncTokenType(),s=this.exportLexerState(),o=[],l=!1,u=this.LA(1),h=this.LA(1),f=()=>{let d=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:d,ruleName:this.getCurrRuleFullName()}),g=new e0(p,u,this.LA(0));g.resyncedTokens=Lu(o),this.SAVE_ERROR(g)};for(;!l;)if(this.tokenMatcher(h,i)){f();return}else if(n.call(this)){f(),e.apply(this,r);return}else this.tokenMatcher(h,a)?l=!0:(h=this.SKIP_TOKEN(),this.addToResyncTokens(h,o));this.importLexerState(s)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new NR("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||ir(r))return!1;let n=this.LA(1);return ja(r,a=>this.tokenMatcher(n,a))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return Bn(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=ja(e,a=>Wy(r,a));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return RR;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return je(e,(n,i)=>i===0?RR:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=je(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return Br(e)}getFollowSetFromFollowKey(e){if(e===RR)return[no];let r=e.ruleName+e.idxInCallingRule+mk+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,no)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return Lu(r)}attemptInRepetitionRecovery(e,r,n,i,a,s,o){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=jr(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return je(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}});function Dk(t,e,r){return r|e|t}var Ok=F(()=>{});var Hu,DR=F(()=>{Ot();qg();Ns();Ky();Kg();Hu=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:rs.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(ir(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),a=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...a]}return r}validateNoLeftRecursion(e){return fa(e,r=>LR(r,r,_l))}validateEmptyOrAlternatives(e){return fa(e,r=>pae(r,_l))}validateAmbiguousAlternationAlternatives(e,r){return fa(e,n=>gae(n,r,_l))}validateSomeNonEmptyLookaheadPath(e,r){return mae(e,r,_l)}buildLookaheadForAlternation(e){return nae(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,aae)}buildLookaheadForOptional(e){return iae(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Xy(e.prodType),sae)}}});function pIe(t){Pk.reset(),t.accept(Pk);let e=Pk.dslMethods;return Pk.reset(),e}var Bk,OR,Pk,Sae=F(()=>{Ot();Ns();Ok();ts();DR();Bk=class{initLooksAhead(e){this.dynamicTokensEnabled=St(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:rs.dynamicTokensEnabled,this.maxLookahead=St(e,"maxLookahead")?e.maxLookahead:rs.maxLookahead,this.lookaheadStrategy=St(e,"lookaheadStrategy")?e.lookaheadStrategy:new Hu({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){Te(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:a,repetitionMandatory:s,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=pIe(r);Te(n,u=>{let h=u.idx===0?"":u.idx;this.TRACE_INIT(`${Rs(u)}${h}`,()=>{let f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Dk(this.fullRuleNameToShort[r.name],256,u.idx);this.setLaFuncCache(d,f)})}),Te(i,u=>{this.computeLookaheadFunc(r,u.idx,768,"Repetition",u.maxLookahead,Rs(u))}),Te(a,u=>{this.computeLookaheadFunc(r,u.idx,512,"Option",u.maxLookahead,Rs(u))}),Te(s,u=>{this.computeLookaheadFunc(r,u.idx,1024,"RepetitionMandatory",u.maxLookahead,Rs(u))}),Te(o,u=>{this.computeLookaheadFunc(r,u.idx,1536,"RepetitionMandatoryWithSeparator",u.maxLookahead,Rs(u))}),Te(l,u=>{this.computeLookaheadFunc(r,u.idx,1280,"RepetitionWithSeparator",u.maxLookahead,Rs(u))})})})}computeLookaheadFunc(e,r,n,i,a,s){this.TRACE_INIT(`${s}${r===0?"":r}`,()=>{let o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:a||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=Dk(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return Dk(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},OR=class extends es{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},Pk=new OR});function FR(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset{});function $R(t,e){Object.defineProperty(t,gIe,{enumerable:!1,configurable:!0,writable:!1,value:e})}var gIe,Lae=F(()=>{gIe="name"});function mIe(t,e){let r=Nr(t),n=r.length;for(let i=0;is.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: ${a.join(` `).replace(/\n/g,` `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function Nae(t,e,r){let n=function(){};$R(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return Te(e,a=>{i[a]=mIe}),n.prototype=i,n.prototype.constructor=n,n}function vIe(t,e){return yIe(t,e)}function yIe(t,e){let r=Fr(e,i=>gi(t[i])===!1),n=je(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:GR.MISSING_METHOD,methodName:i}));return xc(n)}var GR,Iae=F(()=>{Ot();Lae();(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(GR||(GR={}))});var Gk,Mae=F(()=>{_ae();Ot();Iae();Ns();Gk=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=St(e,"nodeLocationTracking")?e.nodeLocationTracking:rs.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Yn,this.cstFinallyStateUpdate=Yn,this.cstPostTerminal=Yn,this.cstPostNonTerminal=Yn,this.cstPostRule=Yn;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zR,this.setNodeLocationFromNode=zR,this.cstPostRule=Yn,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Yn,this.setNodeLocationFromNode=Yn,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=FR,this.setNodeLocationFromNode=FR,this.cstPostRule=Yn,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Yn,this.setNodeLocationFromNode=Yn,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Yn,this.setNodeLocationFromNode=Yn,this.cstPostRule=Yn,this.setInitialNodeLocation=Yn;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];Cae(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];Aae(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(ar(this.baseCstVisitorConstructor)){let e=Rae(this.className,Nr(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ar(this.baseCstVisitorWithDefaultsConstructor)){let e=Nae(this.className,Nr(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}});var Uk,Dae=F(()=>{Ns();Uk=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Jg}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Jg:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}});var Vk,Oae=F(()=>{Ot();Qg();Ns();qg();Ky();ts();Vk=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=em){if(Bn(this.definedRulesNames,e)){let s={message:_l.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Li.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=em){let i=dae(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let a=this.defineRule(e,r,n);return this[e]=a,a}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(tf(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return dk(fr(this.gastProductionsCache))}}});var Wk,Pae=F(()=>{Ot();Ok();Qg();Kg();Yy();Ns();MR();Jd();Zd();Wk=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Hg,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},St(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 For Further details.`);if(Et(e)){if(ir(e))throw Error(`A Token Vocabulary cannot be empty. Note that the first argument for the parser constructor is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 For Further details.`)}if(Et(e))this.tokensMap=zr(e,(a,s)=>(a[s.name]=s,a),{});else if(St(e,"modes")&&_a(Br(fr(e.modes)),Wie)){let a=Br(fr(e.modes)),s=bg(a);this.tokensMap=zr(s,(o,l)=>(o[l.name]=l,o),{})}else if(dn(e))this.tokensMap=jr(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=no;let n=St(e,"modes")?Br(fr(e.modes)):fr(e),i=_a(n,a=>ir(a.categoryMatches));this.tokenMatcher=i?Hg:Gu,Uu(fr(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=St(n,"resyncEnabled")?n.resyncEnabled:em.resyncEnabled,a=St(n,"recoveryValueFunc")?n.recoveryValueFunc:em.recoveryValueFunc,s=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let o;return this.outputCst===!0?o=function(...h){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,h);let f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,a)}finally{this.ruleFinallyStateUpdate()}}:o=function(...h){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,h)}catch(f){return this.invokeRuleCatch(f,i,a)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){let i=this.RULE_STACK.length===1,a=r&&!this.isBackTracking()&&this.recoveryEnabled;if(tf(e)){let s=e;if(a){let o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(s.resyncedTokens=this.reSyncTo(o),this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return n(e);else{if(this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,s.partialCstResult=l}throw s}}else{if(i)return this.moveToTerminatedState(),n(e);throw s}}else throw e}optionInternal(e,r){let n=this.getKeyForAutomaticLookahead(512,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof e!="function"){a=e.DEF;let s=e.GATE;if(s!==void 0){let o=i;i=()=>s.call(this)&&o.call(this)}}else a=e;if(i.call(this)===!0)return a.call(this)}atLeastOneInternal(e,r){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof r!="function"){a=r.DEF;let s=r.GATE;if(s!==void 0){let o=i;i=()=>s.call(this)&&o.call(this)}}else a=r;if(i.call(this)===!0){let s=this.doSingleRepetition(a);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a)}else throw this.raiseEarlyExitException(e,zn.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,1024,e,Ck)}atLeastOneSepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){let i=r.DEF,a=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let o=()=>this.tokenMatcher(this.LA(1),a);for(;this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,qy],o,1536,e,qy)}else throw this.raiseEarlyExitException(e,zn.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof r!="function"){a=r.DEF;let o=r.GATE;if(o!==void 0){let l=i;i=()=>o.call(this)&&l.call(this)}}else a=r;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,768,e,Sk,s)}manySepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){let i=r.DEF,a=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);let o=()=>this.tokenMatcher(this.LA(1),a);for(;this.tokenMatcher(this.LA(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,Hy],o,1280,e,Hy)}}repetitionSepSecondInternal(e,r,n,i,a){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,a],n,1536,e,a)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let n=this.getKeyForAutomaticLookahead(256,r),i=Et(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Qy(r,e))}}subruleInternal(e,r,n){let i;try{let a=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,i=e.apply(this,a),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(a){throw this.subruleInternalError(a,n,e.ruleName)}}subruleInternalError(e,r,n){throw tf(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let i;try{let a=this.LA(1);this.tokenMatcher(a,e)===!0?(this.consumeToken(),i=a):this.consumeInternalError(e,a,n)}catch(a){i=this.consumeInternalRecovery(e,r,a)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,r,n){let i,a=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:a,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new e0(i,r,a))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,i)}catch(a){throw a.name===IR?n:a}}else throw n}saveRecogState(){let e=this.errors,r=jr(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),no)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}});var Hk,Bae=F(()=>{Qg();Ot();Kg();Ns();Hk=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=St(e,"errorMessageProvider")?e.errorMessageProvider:rs.errorMessageProvider}SAVE_ERROR(e){if(tf(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:jr(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return jr(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let i=this.getCurrRuleFullName(),a=this.getGAstProductions()[i],o=jg(e,a,r,this.maxLookahead)[0],l=[];for(let h=1;h<=this.maxLookahead;h++)l.push(this.LA(h));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:l,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new Jy(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],a=Xg(e,i,this.maxLookahead),s=[];for(let u=1;u<=this.maxLookahead;u++)s.push(this.LA(u));let o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:a,actual:s,previous:o,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Zy(l,this.LA(1),o))}}});var qk,Fae=F(()=>{Yy();Ot();qk=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(ar(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return _k([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=Yi(e.ruleStack),i=this.getGAstProductions()[r];return new Ek(i,e).startWalking()}}});function t2(t,e,r,n=!1){Xk(r);let i=ha(this.recordingProdStack),a=gi(e)?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),St(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),i.definition.push(s),this.recordingProdStack.pop(),jk}function wIe(t,e){Xk(e);let r=ha(this.recordingProdStack),n=Et(t)===!1,i=n===!1?t:t.DEF,a=new gn({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});St(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD);let s=sy(i,o=>gi(o.GATE));return a.hasPredicates=s,r.definition.push(a),Te(i,o=>{let l=new En({definition:[]});a.definition.push(l),St(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:St(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),jk}function Gae(t){return t===0?"":`${t}`}function Xk(t){if(t<0||t>$ae){let e=new Error(`Invalid DSL Method idx value: <${t}> Idx value must be a none negative value smaller than ${$ae+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var jk,zae,$ae,Uae,Vae,bIe,Yk,Wae=F(()=>{Ot();ts();Uy();Zd();Jd();Ns();Ok();jk={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(jk);zae=!0,$ae=Math.pow(2,8)-1,Uae=Tk({name:"RECORDING_PHASE_TOKEN",pattern:ei.NA});Uu([Uae]);Vae=Qd(Uae,`This IToken indicates the Parser is in Recording Phase See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Vae);bIe={name:`This CSTNode indicates the Parser is in Recording Phase See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Yk=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let r=0;r<10;r++){let n=r>0?r:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return Jg}topLevelRuleRecord(e,r){try{let n=new Ja({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+` This error was thrown during the "grammar recording phase" For more info see: https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return t2.call(this,Zr,e,r)}atLeastOneInternalRecord(e,r){t2.call(this,Sn,r,e)}atLeastOneSepFirstInternalRecord(e,r){t2.call(this,Cn,r,e,zae)}manyInternalRecord(e,r){t2.call(this,br,r,e)}manySepFirstInternalRecord(e,r){t2.call(this,pn,r,e,zae)}orInternalRecord(e,r){return wIe.call(this,e,r)}subruleInternalRecord(e,r,n){if(Xk(r),!e||St(e,"ruleName")===!1){let o=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}let i=ha(this.recordingProdStack),a=e.ruleName,s=new Kr({idx:r,nonTerminalName:a,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?bIe:jk}consumeInternalRecord(e,r,n){if(Xk(r),!xR(e)){let s=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=ha(this.recordingProdStack),a=new pr({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(a),Vae}}});var Kk,Hae=F(()=>{Ot();$g();Ns();Kk=class{initPerformanceTracer(e){if(St(e,"traceInitPerf")){let r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=rs.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);let{time:i,value:a}=zy(r),s=i>10?console.warn:console.log;return this.traceInitIndent time: ${i}ms`),this.traceInitIndent--,a}else return r()}}});function qae(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let a=Object.getOwnPropertyDescriptor(n,i);a&&(a.get||a.set)?Object.defineProperty(t.prototype,i,a):t.prototype[i]=r.prototype[i]})})}var Yae=F(()=>{});function Zk(t=void 0){return function(){return t}}var Jg,rs,em,Li,r2,n2,Ns=F(()=>{Ot();$g();Tie();Jd();qg();xae();MR();Sae();Mae();Dae();Oae();Pae();Bae();Fae();Wae();Hae();Yae();Ky();Jg=Qd(no,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Jg);rs=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Wu,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),em=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Li||(Li={}));r2=class t{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{$y(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),Te(this.definedRulesNames,i=>{let s=this[i].originalGrammarAction,o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=vae({rules:fr(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(ir(n)&&this.skipValidations===!1){let i=yae({rules:fr(this.gastProductionsCache),tokenTypes:fr(this.tokensMap),errMsgProvider:_l,grammarName:r}),a=uae({lookaheadStrategy:this.lookaheadStrategy,rules:fr(this.gastProductionsCache),tokenTypes:fr(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,a)}}),ir(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=kie(fr(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,a;(a=(i=this.lookaheadStrategy).initialize)===null||a===void 0||a.call(i,{rules:fr(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(fr(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!ir(this.definitionErrors))throw e=je(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected: ${e.join(` ------------------------------- `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),St(r,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. Please use the flag on the relevant DSL method instead. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES For further details.`);this.skipValidations=St(r,"skipValidations")?r.skipValidations:rs.skipValidations}};r2.DEFER_DEFINITION_ERRORS_HANDLING=!1;qae(r2,[Mk,Bk,Gk,Uk,Wk,Vk,Hk,qk,Yk,Kk]);n2=class extends r2{constructor(e,r=rs){let n=jr(r);n.outputCst=!1,super(e,n)}}});var Xae=F(()=>{ts()});var jae=F(()=>{});var Kae=F(()=>{Xae();jae()});var Zae=F(()=>{oR()});var t0=F(()=>{oR();Ns();Uy();Jd();Kg();DR();qg();Qg();wR();ts();ts();Kae();Zae()});function r0(t,e,r){return`${t.name}_${e}_${r}`}function tse(t){let e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};_Ie(e,t);let r=t.length;for(let n=0;nrse(t,e,s));return im(t,e,n,r,...i)}function DIe(t,e,r){let n=Xi(t,e,r,{type:rf});nf(t,n);let i=im(t,e,n,r,n0(t,e,r));return OIe(t,e,r,i)}function n0(t,e,r){let n=Fr(je(r.definition,i=>rse(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:BIe(t,n)}function nse(t,e,r,n,i){let a=n.left,s=n.right,o=Xi(t,e,r,{type:AIe});nf(t,o);let l=Xi(t,e,r,{type:ese});return a.loopback=o,l.loopback=o,t.decisionMap[r0(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=o,yi(s,o),i===void 0?(yi(o,a),yi(o,l)):(yi(o,l),yi(o,i.left),yi(i.right,a)),{left:a,right:l}}function ise(t,e,r,n,i){let a=n.left,s=n.right,o=Xi(t,e,r,{type:CIe});nf(t,o);let l=Xi(t,e,r,{type:ese}),u=Xi(t,e,r,{type:SIe});return o.loopback=u,l.loopback=u,yi(o,a),yi(o,l),yi(s,u),i!==void 0?(yi(u,l),yi(u,i.left),yi(i.right,a)):yi(u,o),t.decisionMap[r0(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=o,{left:o,right:l}}function OIe(t,e,r,n){let i=n.left,a=n.right;return yi(i,a),t.decisionMap[r0(e,"Option",r.idx)]=i,n}function nf(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function im(t,e,r,n,...i){let a=Xi(t,e,n,{type:EIe,start:r});r.end=a;for(let o of i)o!==void 0?(yi(r,o.left),yi(o.right,a)):yi(r,a);let s={left:r,right:a};return t.decisionMap[r0(e,PIe(n),n.idx)]=r,s}function PIe(t){if(t instanceof gn)return"Alternation";if(t instanceof Zr)return"Option";if(t instanceof br)return"Repetition";if(t instanceof pn)return"RepetitionWithSeparator";if(t instanceof Sn)return"RepetitionMandatory";if(t instanceof Cn)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function BIe(t,e){let r=e.length;for(let a=0;a{vg();y_();t0();rf=1,TIe=2,Qae=4,Jae=5,nm=7,EIe=8,SIe=9,CIe=10,AIe=11,ese=12,i2=class{constructor(e){this.target=e}isEpsilon(){return!1}},tm=class extends i2{constructor(e,r){super(e),this.tokenType=r}},a2=class extends i2{constructor(e){super(e)}isEpsilon(){return!0}},rm=class extends i2{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}}});function HR(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(r=>r.stateNumber.toString()).join("_")}`}var s2,am,sse=F(()=>{vg();s2={},am=class{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let r=HR(e);r in this.map||(this.map[r]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return je(this.configs,e=>e.alt)}get key(){let e="";for(let r in this.map)e+=r+":";return e}}});function GIe(t,e){let r={};return n=>{let i=n.toString(),a=r[i];return a!==void 0||(a={atnStartState:t,decision:e,states:{}},r[i]=a),a}}function lse(t,e=!0){let r=new Set;for(let n of t){let i=new Set;for(let a of n){if(a===void 0){if(e)break;return!1}let s=[a.tokenTypeIdx].concat(a.categoryMatches);for(let o of s)if(r.has(o)){if(!i.has(o))return!1}else r.add(o),i.add(o)}}return!0}function UIe(t){let e=t.decisionStates.length,r=Array(e);for(let n=0;nVu(i)).join(", "),r=t.production.idx===0?"":t.production.idx,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${YIe(t.production)}${r}> inside <${t.topLevelRule.name}> Rule, <${e}> may appears as a prefix path in all these alternatives. `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES For Further details.`,n}function YIe(t){if(t instanceof Kr)return"SUBRULE";if(t instanceof Zr)return"OPTION";if(t instanceof gn)return"OR";if(t instanceof Sn)return"AT_LEAST_ONE";if(t instanceof Cn)return"AT_LEAST_ONE_SEP";if(t instanceof pn)return"MANY_SEP";if(t instanceof br)return"MANY";if(t instanceof pr)return"CONSUME";throw Error("non exhaustive match")}function XIe(t,e,r){let n=fa(e.configs.elements,a=>a.state.transitions),i=Zee(n.filter(a=>a instanceof tm).map(a=>a.tokenType),a=>a.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function jIe(t,e){return t.edges[e.tokenTypeIdx]}function KIe(t,e,r){let n=new am,i=[];for(let s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===nm){i.push(s);continue}let o=s.state.transitions.length;for(let l=0;l0&&!tMe(a))for(let s of i)a.add(s);return a}function ZIe(t,e){if(t instanceof tm&&Wy(e,t.tokenType))return t.target}function QIe(t,e){let r;for(let n of t.elements)if(e.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function use(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function cse(t,e,r,n){return n=hse(t,n),e.edges[r.tokenTypeIdx]=n,n}function hse(t,e){if(e===s2)return e;let r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function JIe(t){let e=new am,r=t.transitions.length;for(let n=0;n0){let i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};Jk(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);let n=r.transitions.length;for(let i=0;i1)return!0;return!1}function sMe(t){for(let e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Qk,ose,o2,fse=F(()=>{t0();ase();sse();C_();b_();Qee();vg();E5();J5();iw();R_();Qk=class{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,r){this.predicates[e]=r}toString(){let e="",r=this.predicates.length;for(let n=0;nconsole.log(n)}initialize(e){this.atn=tse(e.rules),this.dfas=UIe(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:r,rule:n,hasPredicates:i,dynamicTokensEnabled:a}=e,s=this.dfas,o=this.logging,l=r0(n,"Alternation",r),h=this.atn.decisionMap[l].decision,f=je(Rk({maxLookahead:1,occurrence:r,prodType:"Alternation",rule:n}),d=>je(d,p=>p[0]));if(lse(f,!1)&&!a){let d=zr(f,(p,g,m)=>(Te(g,y=>{y&&(p[y.tokenTypeIdx]=m,Te(y.categoryMatches,x=>{p[x]=m}))}),p),{});return i?function(p){var g;let m=this.LA(1),y=d[m.tokenTypeIdx];if(p!==void 0&&y!==void 0){let x=(g=p[y])===null||g===void 0?void 0:g.GATE;if(x!==void 0&&x.call(this)===!1)return}return y}:function(){let p=this.LA(1);return d[p.tokenTypeIdx]}}else return i?function(d){let p=new Qk,g=d===void 0?0:d.length;for(let y=0;yje(d,p=>p[0]));if(lse(f)&&f[0][0]&&!a){let d=f[0],p=Br(d);if(p.length===1&&ir(p[0].categoryMatches)){let m=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===m}}else{let g=zr(p,(m,y)=>(y!==void 0&&(m[y.tokenTypeIdx]=!0,Te(y.categoryMatches,x=>{m[x]=!0})),m),{});return function(){let m=this.LA(1);return g[m.tokenTypeIdx]===!0}}}return function(){let d=qR.call(this,s,h,ose,o);return typeof d=="object"?!1:d===0}}}});var dse=F(()=>{fse()});var pse,YR,gse,eT,$r,wr,tT,mse,XR,vse,yse,xse,bse,jR,wse,kse,Tse,rT,sm,om,KR,lm,Ese,ZR,QR,JR,eN,tN,Sse,Cse,rN,Ase,nN,l2,_se,Lse,Rse,Nse,Ise,Mse,Dse,Ose,nT,Pse,Bse,Fse,zse,$se,Gse,Use,Vse,Wse,Hse,qse,iT,Yse,Xse,jse,Kse,Zse,Qse,Jse,eoe,toe,roe,noe,ioe,aoe,iN,aN,soe,ooe,loe,coe,uoe,hoe,foe,doe,poe,sN,ze,oN=F(()=>{"use strict";(function(t){function e(r){return typeof r=="string"}t.is=e})(pse||(pse={}));(function(t){function e(r){return typeof r=="string"}t.is=e})(YR||(YR={}));(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(gse||(gse={}));(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(eT||(eT={}));(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=eT.MAX_VALUE),i===Number.MAX_VALUE&&(i=eT.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&ze.uinteger(i.line)&&ze.uinteger(i.character)}t.is=r})($r||($r={}));(function(t){function e(n,i,a,s){if(ze.uinteger(n)&&ze.uinteger(i)&&ze.uinteger(a)&&ze.uinteger(s))return{start:$r.create(n,i),end:$r.create(a,s)};if($r.is(n)&&$r.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${a}, ${s}]`)}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&$r.is(i.start)&&$r.is(i.end)}t.is=r})(wr||(wr={}));(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&wr.is(i.range)&&(ze.string(i.uri)||ze.undefined(i.uri))}t.is=r})(tT||(tT={}));(function(t){function e(n,i,a,s){return{targetUri:n,targetRange:i,targetSelectionRange:a,originSelectionRange:s}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&wr.is(i.targetRange)&&ze.string(i.targetUri)&&wr.is(i.targetSelectionRange)&&(wr.is(i.originSelectionRange)||ze.undefined(i.originSelectionRange))}t.is=r})(mse||(mse={}));(function(t){function e(n,i,a,s){return{red:n,green:i,blue:a,alpha:s}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&ze.numberRange(i.red,0,1)&&ze.numberRange(i.green,0,1)&&ze.numberRange(i.blue,0,1)&&ze.numberRange(i.alpha,0,1)}t.is=r})(XR||(XR={}));(function(t){function e(n,i){return{range:n,color:i}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&wr.is(i.range)&&XR.is(i.color)}t.is=r})(vse||(vse={}));(function(t){function e(n,i,a){return{label:n,textEdit:i,additionalTextEdits:a}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&ze.string(i.label)&&(ze.undefined(i.textEdit)||om.is(i))&&(ze.undefined(i.additionalTextEdits)||ze.typedArray(i.additionalTextEdits,om.is))}t.is=r})(yse||(yse={}));(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(xse||(xse={}));(function(t){function e(n,i,a,s,o,l){let u={startLine:n,endLine:i};return ze.defined(a)&&(u.startCharacter=a),ze.defined(s)&&(u.endCharacter=s),ze.defined(o)&&(u.kind=o),ze.defined(l)&&(u.collapsedText=l),u}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&ze.uinteger(i.startLine)&&ze.uinteger(i.startLine)&&(ze.undefined(i.startCharacter)||ze.uinteger(i.startCharacter))&&(ze.undefined(i.endCharacter)||ze.uinteger(i.endCharacter))&&(ze.undefined(i.kind)||ze.string(i.kind))}t.is=r})(bse||(bse={}));(function(t){function e(n,i){return{location:n,message:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&tT.is(i.location)&&ze.string(i.message)}t.is=r})(jR||(jR={}));(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(wse||(wse={}));(function(t){t.Unnecessary=1,t.Deprecated=2})(kse||(kse={}));(function(t){function e(r){let n=r;return ze.objectLiteral(n)&&ze.string(n.href)}t.is=e})(Tse||(Tse={}));(function(t){function e(n,i,a,s,o,l){let u={range:n,message:i};return ze.defined(a)&&(u.severity=a),ze.defined(s)&&(u.code=s),ze.defined(o)&&(u.source=o),ze.defined(l)&&(u.relatedInformation=l),u}t.create=e;function r(n){var i;let a=n;return ze.defined(a)&&wr.is(a.range)&&ze.string(a.message)&&(ze.number(a.severity)||ze.undefined(a.severity))&&(ze.integer(a.code)||ze.string(a.code)||ze.undefined(a.code))&&(ze.undefined(a.codeDescription)||ze.string((i=a.codeDescription)===null||i===void 0?void 0:i.href))&&(ze.string(a.source)||ze.undefined(a.source))&&(ze.undefined(a.relatedInformation)||ze.typedArray(a.relatedInformation,jR.is))}t.is=r})(rT||(rT={}));(function(t){function e(n,i,...a){let s={title:n,command:i};return ze.defined(a)&&a.length>0&&(s.arguments=a),s}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.string(i.title)&&ze.string(i.command)}t.is=r})(sm||(sm={}));(function(t){function e(a,s){return{range:a,newText:s}}t.replace=e;function r(a,s){return{range:{start:a,end:a},newText:s}}t.insert=r;function n(a){return{range:a,newText:""}}t.del=n;function i(a){let s=a;return ze.objectLiteral(s)&&ze.string(s.newText)&&wr.is(s.range)}t.is=i})(om||(om={}));(function(t){function e(n,i,a){let s={label:n};return i!==void 0&&(s.needsConfirmation=i),a!==void 0&&(s.description=a),s}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&ze.string(i.label)&&(ze.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(ze.string(i.description)||i.description===void 0)}t.is=r})(KR||(KR={}));(function(t){function e(r){let n=r;return ze.string(n)}t.is=e})(lm||(lm={}));(function(t){function e(a,s,o){return{range:a,newText:s,annotationId:o}}t.replace=e;function r(a,s,o){return{range:{start:a,end:a},newText:s,annotationId:o}}t.insert=r;function n(a,s){return{range:a,newText:"",annotationId:s}}t.del=n;function i(a){let s=a;return om.is(s)&&(KR.is(s.annotationId)||lm.is(s.annotationId))}t.is=i})(Ese||(Ese={}));(function(t){function e(n,i){return{textDocument:n,edits:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&rN.is(i.textDocument)&&Array.isArray(i.edits)}t.is=r})(ZR||(ZR={}));(function(t){function e(n,i,a){let s={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}t.create=e;function r(n){let i=n;return i&&i.kind==="create"&&ze.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||ze.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ze.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||lm.is(i.annotationId))}t.is=r})(QR||(QR={}));(function(t){function e(n,i,a,s){let o={kind:"rename",oldUri:n,newUri:i};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}t.create=e;function r(n){let i=n;return i&&i.kind==="rename"&&ze.string(i.oldUri)&&ze.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||ze.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||ze.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||lm.is(i.annotationId))}t.is=r})(JR||(JR={}));(function(t){function e(n,i,a){let s={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(s.options=i),a!==void 0&&(s.annotationId=a),s}t.create=e;function r(n){let i=n;return i&&i.kind==="delete"&&ze.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||ze.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||ze.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||lm.is(i.annotationId))}t.is=r})(eN||(eN={}));(function(t){function e(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(i=>ze.string(i.kind)?QR.is(i)||JR.is(i)||eN.is(i):ZR.is(i)))}t.is=e})(tN||(tN={}));(function(t){function e(n){return{uri:n}}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.string(i.uri)}t.is=r})(Sse||(Sse={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.string(i.uri)&&ze.integer(i.version)}t.is=r})(Cse||(Cse={}));(function(t){function e(n,i){return{uri:n,version:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.string(i.uri)&&(i.version===null||ze.integer(i.version))}t.is=r})(rN||(rN={}));(function(t){function e(n,i,a,s){return{uri:n,languageId:i,version:a,text:s}}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.string(i.uri)&&ze.string(i.languageId)&&ze.integer(i.version)&&ze.string(i.text)}t.is=r})(Ase||(Ase={}));(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(r){let n=r;return n===t.PlainText||n===t.Markdown}t.is=e})(nN||(nN={}));(function(t){function e(r){let n=r;return ze.objectLiteral(r)&&nN.is(n.kind)&&ze.string(n.value)}t.is=e})(l2||(l2={}));(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(_se||(_se={}));(function(t){t.PlainText=1,t.Snippet=2})(Lse||(Lse={}));(function(t){t.Deprecated=1})(Rse||(Rse={}));(function(t){function e(n,i,a){return{newText:n,insert:i,replace:a}}t.create=e;function r(n){let i=n;return i&&ze.string(i.newText)&&wr.is(i.insert)&&wr.is(i.replace)}t.is=r})(Nse||(Nse={}));(function(t){t.asIs=1,t.adjustIndentation=2})(Ise||(Ise={}));(function(t){function e(r){let n=r;return n&&(ze.string(n.detail)||n.detail===void 0)&&(ze.string(n.description)||n.description===void 0)}t.is=e})(Mse||(Mse={}));(function(t){function e(r){return{label:r}}t.create=e})(Dse||(Dse={}));(function(t){function e(r,n){return{items:r||[],isIncomplete:!!n}}t.create=e})(Ose||(Ose={}));(function(t){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function r(n){let i=n;return ze.string(i)||ze.objectLiteral(i)&&ze.string(i.language)&&ze.string(i.value)}t.is=r})(nT||(nT={}));(function(t){function e(r){let n=r;return!!n&&ze.objectLiteral(n)&&(l2.is(n.contents)||nT.is(n.contents)||ze.typedArray(n.contents,nT.is))&&(r.range===void 0||wr.is(r.range))}t.is=e})(Pse||(Pse={}));(function(t){function e(r,n){return n?{label:r,documentation:n}:{label:r}}t.create=e})(Bse||(Bse={}));(function(t){function e(r,n,...i){let a={label:r};return ze.defined(n)&&(a.documentation=n),ze.defined(i)?a.parameters=i:a.parameters=[],a}t.create=e})(Fse||(Fse={}));(function(t){t.Text=1,t.Read=2,t.Write=3})(zse||(zse={}));(function(t){function e(r,n){let i={range:r};return ze.number(n)&&(i.kind=n),i}t.create=e})($se||($se={}));(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(Gse||(Gse={}));(function(t){t.Deprecated=1})(Use||(Use={}));(function(t){function e(r,n,i,a,s){let o={name:r,kind:n,location:{uri:a,range:i}};return s&&(o.containerName=s),o}t.create=e})(Vse||(Vse={}));(function(t){function e(r,n,i,a){return a!==void 0?{name:r,kind:n,location:{uri:i,range:a}}:{name:r,kind:n,location:{uri:i}}}t.create=e})(Wse||(Wse={}));(function(t){function e(n,i,a,s,o,l){let u={name:n,detail:i,kind:a,range:s,selectionRange:o};return l!==void 0&&(u.children=l),u}t.create=e;function r(n){let i=n;return i&&ze.string(i.name)&&ze.number(i.kind)&&wr.is(i.range)&&wr.is(i.selectionRange)&&(i.detail===void 0||ze.string(i.detail))&&(i.deprecated===void 0||ze.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=r})(Hse||(Hse={}));(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(qse||(qse={}));(function(t){t.Invoked=1,t.Automatic=2})(iT||(iT={}));(function(t){function e(n,i,a){let s={diagnostics:n};return i!=null&&(s.only=i),a!=null&&(s.triggerKind=a),s}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.typedArray(i.diagnostics,rT.is)&&(i.only===void 0||ze.typedArray(i.only,ze.string))&&(i.triggerKind===void 0||i.triggerKind===iT.Invoked||i.triggerKind===iT.Automatic)}t.is=r})(Yse||(Yse={}));(function(t){function e(n,i,a){let s={title:n},o=!0;return typeof i=="string"?(o=!1,s.kind=i):sm.is(i)?s.command=i:s.edit=i,o&&a!==void 0&&(s.kind=a),s}t.create=e;function r(n){let i=n;return i&&ze.string(i.title)&&(i.diagnostics===void 0||ze.typedArray(i.diagnostics,rT.is))&&(i.kind===void 0||ze.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||sm.is(i.command))&&(i.isPreferred===void 0||ze.boolean(i.isPreferred))&&(i.edit===void 0||tN.is(i.edit))}t.is=r})(Xse||(Xse={}));(function(t){function e(n,i){let a={range:n};return ze.defined(i)&&(a.data=i),a}t.create=e;function r(n){let i=n;return ze.defined(i)&&wr.is(i.range)&&(ze.undefined(i.command)||sm.is(i.command))}t.is=r})(jse||(jse={}));(function(t){function e(n,i){return{tabSize:n,insertSpaces:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&ze.uinteger(i.tabSize)&&ze.boolean(i.insertSpaces)}t.is=r})(Kse||(Kse={}));(function(t){function e(n,i,a){return{range:n,target:i,data:a}}t.create=e;function r(n){let i=n;return ze.defined(i)&&wr.is(i.range)&&(ze.undefined(i.target)||ze.string(i.target))}t.is=r})(Zse||(Zse={}));(function(t){function e(n,i){return{range:n,parent:i}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&wr.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=r})(Qse||(Qse={}));(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Jse||(Jse={}));(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(eoe||(eoe={}));(function(t){function e(r){let n=r;return ze.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}t.is=e})(toe||(toe={}));(function(t){function e(n,i){return{range:n,text:i}}t.create=e;function r(n){let i=n;return i!=null&&wr.is(i.range)&&ze.string(i.text)}t.is=r})(roe||(roe={}));(function(t){function e(n,i,a){return{range:n,variableName:i,caseSensitiveLookup:a}}t.create=e;function r(n){let i=n;return i!=null&&wr.is(i.range)&&ze.boolean(i.caseSensitiveLookup)&&(ze.string(i.variableName)||i.variableName===void 0)}t.is=r})(noe||(noe={}));(function(t){function e(n,i){return{range:n,expression:i}}t.create=e;function r(n){let i=n;return i!=null&&wr.is(i.range)&&(ze.string(i.expression)||i.expression===void 0)}t.is=r})(ioe||(ioe={}));(function(t){function e(n,i){return{frameId:n,stoppedLocation:i}}t.create=e;function r(n){let i=n;return ze.defined(i)&&wr.is(n.stoppedLocation)}t.is=r})(aoe||(aoe={}));(function(t){t.Type=1,t.Parameter=2;function e(r){return r===1||r===2}t.is=e})(iN||(iN={}));(function(t){function e(n){return{value:n}}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&(i.tooltip===void 0||ze.string(i.tooltip)||l2.is(i.tooltip))&&(i.location===void 0||tT.is(i.location))&&(i.command===void 0||sm.is(i.command))}t.is=r})(aN||(aN={}));(function(t){function e(n,i,a){let s={position:n,label:i};return a!==void 0&&(s.kind=a),s}t.create=e;function r(n){let i=n;return ze.objectLiteral(i)&&$r.is(i.position)&&(ze.string(i.label)||ze.typedArray(i.label,aN.is))&&(i.kind===void 0||iN.is(i.kind))&&i.textEdits===void 0||ze.typedArray(i.textEdits,om.is)&&(i.tooltip===void 0||ze.string(i.tooltip)||l2.is(i.tooltip))&&(i.paddingLeft===void 0||ze.boolean(i.paddingLeft))&&(i.paddingRight===void 0||ze.boolean(i.paddingRight))}t.is=r})(soe||(soe={}));(function(t){function e(r){return{kind:"snippet",value:r}}t.createSnippet=e})(ooe||(ooe={}));(function(t){function e(r,n,i,a){return{insertText:r,filterText:n,range:i,command:a}}t.create=e})(loe||(loe={}));(function(t){function e(r){return{items:r}}t.create=e})(coe||(coe={}));(function(t){t.Invoked=0,t.Automatic=1})(uoe||(uoe={}));(function(t){function e(r,n){return{range:r,text:n}}t.create=e})(hoe||(hoe={}));(function(t){function e(r,n){return{triggerKind:r,selectedCompletionInfo:n}}t.create=e})(foe||(foe={}));(function(t){function e(r){let n=r;return ze.objectLiteral(n)&&YR.is(n.uri)&&ze.string(n.name)}t.is=e})(doe||(doe={}));(function(t){function e(a,s,o,l){return new sN(a,s,o,l)}t.create=e;function r(a){let s=a;return!!(ze.defined(s)&&ze.string(s.uri)&&(ze.undefined(s.languageId)||ze.string(s.languageId))&&ze.uinteger(s.lineCount)&&ze.func(s.getText)&&ze.func(s.positionAt)&&ze.func(s.offsetAt))}t.is=r;function n(a,s){let o=a.getText(),l=i(s,(h,f)=>{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),u=o.length;for(let h=l.length-1;h>=0;h--){let f=l[h],d=a.offsetAt(f.range.start),p=a.offsetAt(f.range.end);if(p<=u)o=o.substring(0,d)+f.newText+o.substring(p,o.length);else throw new Error("Overlapping edit");u=d}return o}t.applyEdits=n;function i(a,s){if(a.length<=1)return a;let o=a.length/2|0,l=a.slice(0,o),u=a.slice(o);i(l,s),i(u,s);let h=0,f=0,d=0;for(;h0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return $r.create(0,e);for(;ne?i=s:n=s+1}let a=n-1;return $r.create(a,e-r[a])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function a(p){return e.call(p)==="[object String]"}t.string=a;function s(p){return e.call(p)==="[object Number]"}t.number=s;function o(p,g,m){return e.call(p)==="[object Number]"&&g<=p&&p<=m}t.numberRange=o;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=l;function u(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=u;function h(p){return e.call(p)==="[object Function]"}t.func=h;function f(p){return p!==null&&typeof p=="object"}t.objectLiteral=f;function d(p,g){return Array.isArray(p)&&p.every(g)}t.typedArray=d})(ze||(ze={}))});var c2,u2,i0,a0,lN,cm,aT=F(()=>{oN();$o();El();c2=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new cm(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let r=new a0;return r.grammarSource=e,r.root=this.rootNode,this.current.content.push(r),this.nodeStack.push(r),r}buildLeafNode(e,r){let n=new i0(e.startOffset,e.image.length,Ig(e),e.tokenType,!1);return n.grammarSource=r,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let r=e.container;if(r){let n=r.content.indexOf(e);n>=0&&r.content.splice(n,1)}}construct(e){let r=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=r;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}addHiddenTokens(e){for(let r of e){let n=new i0(r.startOffset,r.image.length,Ig(r),r.tokenType,!0);n.root=this.rootNode,this.addHiddenToken(this.rootNode,n)}}addHiddenToken(e,r){let{offset:n,end:i}=r;for(let a=0;ao&&i=0;e--){let r=this.content[e];if(!r.hidden)return r}return this.content[this.content.length-1]}},lN=class t extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,t.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,r,...n){return this.addParents(n),super.splice(e,r,...n)}addParents(e){for(let r of e)r.container=this.parent}},cm=class extends a0{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}});function cN(t){return t.$type===sT}var sT,goe,moe,h2,f2,oT,um,d2,oMe,uN,p2=F(()=>{t0();dse();Ac();Al();Qa();aT();sT=Symbol("Datatype");goe="\u200B",moe=t=>t.endsWith(goe)?t:t+goe,h2=class{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;let r=this.lexer.definition;this.wrapper=new uN(r,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,r){this.wrapper.wrapOr(e,r)}optional(e,r){this.wrapper.wrapOption(e,r)}many(e,r){this.wrapper.wrapMany(e,r)}atLeastOne(e,r){this.wrapper.wrapAtLeastOne(e,r)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},f2=class extends h2{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new c2,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,r){let n=e.fragment?void 0:By(e)?sT:Yd(e),i=this.wrapper.DEFINE_RULE(moe(e.name),this.startImplementation(n,r).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);let r=this.lexer.tokenize(e);this.wrapper.input=r.tokens;let n=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(r.hidden),this.unorderedGroups.clear(),{value:n,lexerErrors:r.errors,parserErrors:this.wrapper.errors}}startImplementation(e,r){return n=>{if(!this.isRecording()){let a={$type:e};this.stack.push(a),e===sT&&(a.value="")}let i;try{i=r(n)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,r,n){let i=this.wrapper.wrapConsume(e,r);if(!this.isRecording()&&this.isValidToken(i)){let a=this.nodeBuilder.buildLeafNode(i,n),{assignment:s,isCrossRef:o}=this.getAssignment(n),l=this.current;if(s){let u=Uo(n)?i.image:this.converter.convert(i.image,a);this.assign(s.operator,s.feature,u,a,o)}else if(cN(l)){let u=i.image;Uo(n)||(u=this.converter.convert(u,a).toString()),l.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,r,n,i){let a;this.isRecording()||(a=this.nodeBuilder.buildCompositeNode(n));let s=this.wrapper.wrapSubrule(e,r,i);!this.isRecording()&&a&&a.length>0&&this.performSubruleAssignment(s,n,a)}performSubruleAssignment(e,r,n){let{assignment:i,isCrossRef:a}=this.getAssignment(r);if(i)this.assign(i.operator,i.feature,e,n,a);else if(!i){let s=this.current;if(cN(s))s.value+=e.toString();else if(typeof e=="object"&&e){let o=e.$type,l=this.assignWithoutOverride(e,s);o&&(l.$type=o);let u=l;this.stack.pop(),this.stack.push(u)}}}action(e,r){if(!this.isRecording()){let n=this.current;if(!n.$cstNode&&r.feature&&r.operator){n=this.construct(!1);let a=n.$cstNode.feature;this.nodeBuilder.buildCompositeNode(a)}let i={$type:e};this.stack.pop(),this.stack.push(i),r.feature&&r.operator&&this.assign(r.operator,r.feature,n,n.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;let r=this.current;return ak(r),this.nodeBuilder.construct(r),e&&this.stack.pop(),cN(r)?this.converter.convert(r.value,r.$cstNode):(FL(this.astReflection,r),r)}getAssignment(e){if(!this.assignmentMap.has(e)){let r=Ud(e,Sl);this.assignmentMap.set(e,{assignment:r,isCrossRef:r?Gd(r.terminal):!1})}return this.assignmentMap.get(e)}assign(e,r,n,i,a){let s=this.current,o;switch(a&&typeof n=="string"?o=this.linker.buildReference(s,r,i,n):o=n,e){case"=":{s[r]=o;break}case"?=":{s[r]=!0;break}case"+=":Array.isArray(s[r])||(s[r]=[]),s[r].push(o)}}assignWithoutOverride(e,r){for(let[n,i]of Object.entries(r)){let a=e[n];a===void 0?e[n]=i:Array.isArray(a)&&Array.isArray(i)&&(i.push(...a),e[n]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}},oT=class{buildMismatchTokenMessage(e){return Wu.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Wu.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Wu.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Wu.buildEarlyExitMessage(e)}},um=class extends oT{buildMismatchTokenMessage({expected:e,actual:r}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${r.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},d2=class extends h2{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let r=this.lexer.tokenize(e);return this.tokens=r.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,r){let n=this.wrapper.DEFINE_RULE(moe(e.name),this.startImplementation(r).bind(this));return e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return r=>{let n=this.keepStackSize();try{e(r)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,r,n){this.wrapper.wrapConsume(e,r),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,r,n,i){this.before(n),this.wrapper.wrapSubrule(e,r,i),this.after(n)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let r=this.elementStack.lastIndexOf(e);r>=0&&this.elementStack.splice(r)}}get currIdx(){return this.wrapper.currIdx}},oMe={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new um},uN=class extends n2{constructor(e,r){let n=r&&"maxLookahead"in r;super(e,Object.assign(Object.assign(Object.assign({},oMe),{lookaheadStrategy:n?new Hu({maxLookahead:r.maxLookahead}):new o2}),r))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,r){return this.RULE(e,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,r){return this.consume(e,r)}wrapSubrule(e,r,n){return this.subrule(e,r,{ARGS:[n]})}wrapOr(e,r){this.or(e,r)}wrapOption(e,r){this.option(e,r)}wrapMany(e,r){this.many(e,r)}wrapAtLeastOne(e,r){this.atLeastOne(e,r)}}});function cT(t,e,r){return lMe({parser:e,tokens:r,rules:new Map,ruleNames:new Map},t),e}function lMe(t,e){let r=Oy(e,!1),n=Xr(e.rules).filter(Ra).filter(i=>r.has(i));for(let i of n){let a=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});a.rules.set(i.name,t.parser.rule(i,s0(a,i.definition)))}}function s0(t,e,r=!1){let n;if(Uo(e))n=gMe(t,e);else if(Fu(e))n=cMe(t,e);else if(Sl(e))n=s0(t,e.terminal);else if(Gd(e))n=voe(t,e);else if(Cl(e))n=uMe(t,e);else if(rk(e))n=fMe(t,e);else if(ik(e))n=dMe(t,e);else if(ef(e))n=pMe(t,e);else if(yL(e)){let i=t.consume++;n=()=>t.parser.consume(i,no,e)}else throw new $d(e.$cstNode,`Unexpected element type: ${e.$type}`);return yoe(t,r?void 0:lT(e),n,e.cardinality)}function cMe(t,e){let r=Yd(e);return()=>t.parser.action(r,e)}function uMe(t,e){let r=e.rule.ref;if(Ra(r)){let n=t.subrule++,i=e.arguments.length>0?hMe(r,e.arguments):()=>({});return a=>t.parser.subrule(n,xoe(t,r),e,i(a))}else if(Go(r)){let n=t.consume++,i=hN(t,r.name);return()=>t.parser.consume(n,i,e)}else if(r)Jh(r);else throw new $d(e.$cstNode,`Undefined rule type: ${e.$type}`)}function hMe(t,e){let r=e.map(n=>qu(n.value));return n=>{let i={};for(let a=0;ae(n)||r(n)}else if(W9(t)){let e=qu(t.left),r=qu(t.right);return n=>e(n)&&r(n)}else if(Z9(t)){let e=qu(t.value);return r=>!e(r)}else if(tL(t)){let e=t.parameter.ref.name;return r=>r!==void 0&&r[e]===!0}else if(U9(t)){let e=!!t.true;return()=>e}Jh(t)}function fMe(t,e){if(e.elements.length===1)return s0(t,e.elements[0]);{let r=[];for(let i of e.elements){let a={ALT:s0(t,i,!0)},s=lT(i);s&&(a.GATE=qu(s)),r.push(a)}let n=t.or++;return i=>t.parser.alternatives(n,r.map(a=>{let s={ALT:()=>a.ALT(i)},o=a.GATE;return o&&(s.GATE=()=>o(i)),s}))}}function dMe(t,e){if(e.elements.length===1)return s0(t,e.elements[0]);let r=[];for(let o of e.elements){let l={ALT:s0(t,o,!0)},u=lT(o);u&&(l.GATE=qu(u)),r.push(l)}let n=t.or++,i=(o,l)=>{let u=l.getRuleStack().join("-");return`uGroup_${o}_${u}`},a=o=>t.parser.alternatives(n,r.map((l,u)=>{let h={ALT:()=>!0},f=t.parser;h.ALT=()=>{if(l.ALT(o),!f.isRecording()){let p=i(n,f);f.unorderedGroups.get(p)||f.unorderedGroups.set(p,[]);let g=f.unorderedGroups.get(p);typeof g?.[u]>"u"&&(g[u]=!0)}};let d=l.GATE;return d?h.GATE=()=>d(o):h.GATE=()=>{let p=f.unorderedGroups.get(i(n,f));return!p?.[u]},h})),s=yoe(t,lT(e),a,"*");return o=>{s(o),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(n,t.parser))}}function pMe(t,e){let r=e.elements.map(n=>s0(t,n));return n=>r.forEach(i=>i(n))}function lT(t){if(ef(t))return t.guardCondition}function voe(t,e,r=e.terminal){if(r)if(Cl(r)&&Ra(r.rule.ref)){let n=t.subrule++;return i=>t.parser.subrule(n,xoe(t,r.rule.ref),e,i)}else if(Cl(r)&&Go(r.rule.ref)){let n=t.consume++,i=hN(t,r.rule.ref.name);return()=>t.parser.consume(n,i,e)}else if(Uo(r)){let n=t.consume++,i=hN(t,r.value);return()=>t.parser.consume(n,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);let n=hk(e.type.ref),i=n?.terminal;if(!i)throw new Error("Could not find name assignment for type: "+Yd(e.type.ref));return voe(t,e,i)}}function gMe(t,e){let r=t.consume++,n=t.tokens[e.value];if(!n)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(r,n,e)}function yoe(t,e,r,n){let i=e&&qu(e);if(!n)if(i){let a=t.or++;return s=>t.parser.alternatives(a,[{ALT:()=>r(s),GATE:()=>i(s)},{ALT:Zk(),GATE:()=>!i(s)}])}else return r;if(n==="*"){let a=t.many++;return s=>t.parser.many(a,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else if(n==="+"){let a=t.many++;if(i){let s=t.or++;return o=>t.parser.alternatives(s,[{ALT:()=>t.parser.atLeastOne(a,{DEF:()=>r(o)}),GATE:()=>i(o)},{ALT:Zk(),GATE:()=>!i(o)}])}else return s=>t.parser.atLeastOne(a,{DEF:()=>r(s)})}else if(n==="?"){let a=t.optional++;return s=>t.parser.optional(a,{DEF:()=>r(s),GATE:i?()=>i(s):void 0})}else Jh(n)}function xoe(t,e){let r=mMe(t,e),n=t.rules.get(r);if(!n)throw new Error(`Rule "${r}" not found."`);return n}function mMe(t,e){if(Ra(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let r=e,n=r.$container,i=e.$type;for(;!Ra(n);)(ef(n)||rk(n)||ik(n))&&(i=n.elements.indexOf(r).toString()+":"+i),r=n,n=n.$container;return i=n.name+":"+i,t.ruleNames.set(e,i),i}}function hN(t,e){let r=t.tokens[e];if(!r)throw new Error(`Token "${e}" not found."`);return r}var fN=F(()=>{t0();Ac();jw();Ls();Al()});function dN(t){let e=t.Grammar,r=t.parser.Lexer,n=new d2(t);return cT(e,n,r.definition),n.finalize(),n}var pN=F(()=>{p2();fN()});function gN(t){let e=boe(t);return e.finalize(),e}function boe(t){let e=t.Grammar,r=t.parser.Lexer,n=new f2(t);return cT(e,n,r.definition)}var mN=F(()=>{p2();fN()});var o0,vN=F(()=>{t0();Ac();Qa();Al();Pg();Ls();o0=class{buildTokens(e,r){let n=Xr(Oy(e,!1)),i=this.buildTerminalTokens(n),a=this.buildKeywordTokens(n,i,r);return i.forEach(s=>{let o=s.PATTERN;typeof o=="object"&&o&&"test"in o&&ck(o)?a.unshift(s):a.push(s)}),a}buildTerminalTokens(e){return e.filter(Go).filter(r=>!r.fragment).map(r=>this.buildTerminalToken(r)).toArray()}buildTerminalToken(e){let r=Bg(e),n=this.requiresCustomPattern(r)?this.regexPatternFunction(r):r,i={name:e.name,PATTERN:n,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=ck(r)?ei.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")?!0:!!(e.source.includes("?<=")||e.source.includes("?(r.lastIndex=i,r.exec(n))}buildKeywordTokens(e,r,n){return e.filter(Ra).flatMap(i=>_c(i).filter(Uo)).distinct(i=>i.value).toArray().sort((i,a)=>a.value.length-i.value.length).map(i=>this.buildKeywordToken(i,r,!!n?.caseInsensitive))}buildKeywordToken(e,r,n){return{name:e.value,PATTERN:this.buildKeywordPattern(e,n),LONGER_ALT:this.findLongerAlt(e,r)}}buildKeywordPattern(e,r){return r?new RegExp(HL(e.value)):e.value}findLongerAlt(e,r){return r.reduce((n,i)=>{let a=i?.PATTERN;return a?.source&&qL("^"+a.source+"$",e.value)&&n.push(i),n},[])}}});var l0,Nc,yN=F(()=>{Ac();Al();l0=class{convert(e,r){let n=r.grammarSource;if(Gd(n)&&(n=jL(n)),Cl(n)){let i=n.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,r)}return e}runConverter(e,r,n){var i;switch(e.name.toUpperCase()){case"INT":return Nc.convertInt(r);case"STRING":return Nc.convertString(r);case"ID":return Nc.convertID(r)}switch((i=nR(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return Nc.convertNumber(r);case"boolean":return Nc.convertBoolean(r);case"bigint":return Nc.convertBigint(r);case"date":return Nc.convertDate(r);default:return r}}};(function(t){function e(u){let h="";for(let f=1;f{"use strict";Object.defineProperty(wN,"__esModule",{value:!0});var xN;function bN(){if(xN===void 0)throw new Error("No runtime abstraction layer installed");return xN}(function(t){function e(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");xN=r}t.install=e})(bN||(bN={}));wN.default=bN});var Toe=di(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.stringArray=Na.array=Na.func=Na.error=Na.number=Na.string=Na.boolean=void 0;function vMe(t){return t===!0||t===!1}Na.boolean=vMe;function woe(t){return typeof t=="string"||t instanceof String}Na.string=woe;function yMe(t){return typeof t=="number"||t instanceof Number}Na.number=yMe;function xMe(t){return t instanceof Error}Na.error=xMe;function bMe(t){return typeof t=="function"}Na.func=bMe;function koe(t){return Array.isArray(t)}Na.array=koe;function wMe(t){return koe(t)&&t.every(e=>woe(e))}Na.stringArray=wMe});var EN=di(hm=>{"use strict";Object.defineProperty(hm,"__esModule",{value:!0});hm.Emitter=hm.Event=void 0;var kMe=kN(),Eoe;(function(t){let e={dispose(){}};t.None=function(){return e}})(Eoe||(hm.Event=Eoe={}));var TN=class{add(e,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,r)})}remove(e,r=null){if(!this._callbacks)return;let n=!1;for(let i=0,a=this._callbacks.length;i{this._callbacks||(this._callbacks=new TN),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,r);let i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,r),i.dispose=t._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};hm.Emitter=uT;uT._noop=function(){}});var Soe=di(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});fm.CancellationTokenSource=fm.CancellationToken=void 0;var TMe=kN(),EMe=Toe(),SN=EN(),hT;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:SN.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:SN.Event.None});function e(r){let n=r;return n&&(n===t.None||n===t.Cancelled||EMe.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}t.is=e})(hT||(fm.CancellationToken=hT={}));var SMe=Object.freeze(function(t,e){let r=(0,TMe.default)().timer.setTimeout(t.bind(e),0);return{dispose(){r.dispose()}}}),fT=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?SMe:(this._emitter||(this._emitter=new SN.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},CN=class{get token(){return this._token||(this._token=new fT),this._token}cancel(){this._token?this._token.cancel():this._token=hT.Cancelled}dispose(){this._token?this._token instanceof fT&&this._token.dispose():this._token=hT.None}};fm.CancellationTokenSource=CN});var mr={};var Wo=F(()=>{gr(mr,Gi(Soe(),1))});function _N(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}function Aoe(){return AN=Date.now(),new mr.CancellationTokenSource}function _oe(t){Coe=t}function af(t){return t===Ic}async function Ri(t){if(t===mr.CancellationToken.None)return;let e=Date.now();if(e-AN>=Coe&&(AN=e,await _N()),t.isCancellationRequested)throw Ic}var AN,Coe,Ic,ns,Ho=F(()=>{Wo();AN=0,Coe=10;Ic=Symbol("OperationCancelled");ns=class{constructor(){this.promise=new Promise((e,r)=>{this.resolve=n=>(e(n),this),this.reject=n=>(r(n),this)})}}});function LN(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);LN(n,e),LN(i,e);let a=0,s=0,o=0;for(;ar.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function CMe(t){let e=Noe(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var dT,dm,Ioe=F(()=>{"use strict";dT=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=Noe(n.range),a=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,a)+n.text+this._content.substring(s,this._content.length);let o=Math.max(i.start.line,0),l=Math.max(i.end.line,0),u=this._lineOffsets,h=Loe(n.text,!1,a);if(l-o===h.length)for(let d=0,p=h.length;de?i=s:n=s+1}let a=n-1;return e=this.ensureBeforeEOL(e,r[a]),{line:a,character:e-r[a]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line];if(e.character<=0)return n;let i=e.line+1r&&Roe(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}};(function(t){function e(i,a,s,o){return new dT(i,a,s,o)}t.create=e;function r(i,a,s){if(i instanceof dT)return i.update(a,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,a){let s=i.getText(),o=LN(a.map(CMe),(h,f)=>{let d=h.range.start.line-f.range.start.line;return d===0?h.range.start.character-f.range.start.character:d}),l=0,u=[];for(let h of o){let f=i.offsetAt(h.range.start);if(fl&&u.push(s.substring(l,f)),h.newText.length&&u.push(h.newText),l=i.offsetAt(h.range.end)}return u.push(s.substr(l)),u.join("")}t.applyEdits=n})(dm||(dm={}))});var Moe,Is,pm,RN=F(()=>{(()=>{"use strict";var t={470:i=>{function a(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function s(l,u){for(var h,f="",d=0,p=-1,g=0,m=0;m<=l.length;++m){if(m2){var y=f.lastIndexOf("/");if(y!==f.length-1){y===-1?(f="",d=0):d=(f=f.slice(0,y)).length-1-f.lastIndexOf("/"),p=m,g=0;continue}}else if(f.length===2||f.length===1){f="",d=0,p=m,g=0;continue}}u&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+l.slice(p+1,m):f=l.slice(p+1,m),d=m-p-1;p=m,g=0}else h===46&&g!==-1?++g:g=-1}return f}var o={resolve:function(){for(var l,u="",h=!1,f=arguments.length-1;f>=-1&&!h;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=process.cwd()),d=l),a(d),d.length!==0&&(u=d+"/"+u,h=d.charCodeAt(0)===47)}return u=s(u,!h),h?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(l){if(a(l),l.length===0)return".";var u=l.charCodeAt(0)===47,h=l.charCodeAt(l.length-1)===47;return(l=s(l,!u)).length!==0||u||(l="."),l.length>0&&h&&(l+="/"),u?"/"+l:l},isAbsolute:function(l){return a(l),l.length>0&&l.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var l,u=0;u0&&(l===void 0?l=h:l+="/"+h)}return l===void 0?".":o.normalize(l)},relative:function(l,u){if(a(l),a(u),l===u||(l=o.resolve(l))===(u=o.resolve(u)))return"";for(var h=1;hm){if(u.charCodeAt(p+x)===47)return u.slice(p+x+1);if(x===0)return u.slice(p+x)}else d>m&&(l.charCodeAt(h+x)===47?y=x:x===0&&(y=0));break}var b=l.charCodeAt(h+x);if(b!==u.charCodeAt(p+x))break;b===47&&(y=x)}var w="";for(x=h+y+1;x<=f;++x)x!==f&&l.charCodeAt(x)!==47||(w.length===0?w+="..":w+="/..");return w.length>0?w+u.slice(p+y):(p+=y,u.charCodeAt(p)===47&&++p,u.slice(p))},_makeLong:function(l){return l},dirname:function(l){if(a(l),l.length===0)return".";for(var u=l.charCodeAt(0),h=u===47,f=-1,d=!0,p=l.length-1;p>=1;--p)if((u=l.charCodeAt(p))===47){if(!d){f=p;break}}else d=!1;return f===-1?h?"/":".":h&&f===1?"//":l.slice(0,f)},basename:function(l,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');a(l);var h,f=0,d=-1,p=!0;if(u!==void 0&&u.length>0&&u.length<=l.length){if(u.length===l.length&&u===l)return"";var g=u.length-1,m=-1;for(h=l.length-1;h>=0;--h){var y=l.charCodeAt(h);if(y===47){if(!p){f=h+1;break}}else m===-1&&(p=!1,m=h+1),g>=0&&(y===u.charCodeAt(g)?--g==-1&&(d=h):(g=-1,d=m))}return f===d?d=m:d===-1&&(d=l.length),l.slice(f,d)}for(h=l.length-1;h>=0;--h)if(l.charCodeAt(h)===47){if(!p){f=h+1;break}}else d===-1&&(p=!1,d=h+1);return d===-1?"":l.slice(f,d)},extname:function(l){a(l);for(var u=-1,h=0,f=-1,d=!0,p=0,g=l.length-1;g>=0;--g){var m=l.charCodeAt(g);if(m!==47)f===-1&&(d=!1,f=g+1),m===46?u===-1?u=g:p!==1&&(p=1):u!==-1&&(p=-1);else if(!d){h=g+1;break}}return u===-1||f===-1||p===0||p===1&&u===f-1&&u===h+1?"":l.slice(u,f)},format:function(l){if(l===null||typeof l!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof l);return function(u,h){var f=h.dir||h.root,d=h.base||(h.name||"")+(h.ext||"");return f?f===h.root?f+d:f+"/"+d:d}(0,l)},parse:function(l){a(l);var u={root:"",dir:"",base:"",ext:"",name:""};if(l.length===0)return u;var h,f=l.charCodeAt(0),d=f===47;d?(u.root="/",h=1):h=0;for(var p=-1,g=0,m=-1,y=!0,x=l.length-1,b=0;x>=h;--x)if((f=l.charCodeAt(x))!==47)m===-1&&(y=!1,m=x+1),f===46?p===-1?p=x:b!==1&&(b=1):p!==-1&&(b=-1);else if(!y){g=x+1;break}return p===-1||m===-1||b===0||b===1&&p===m-1&&p===g+1?m!==-1&&(u.base=u.name=g===0&&d?l.slice(1,m):l.slice(g,m)):(g===0&&d?(u.name=l.slice(1,p),u.base=l.slice(1,m)):(u.name=l.slice(g,p),u.base=l.slice(g,m)),u.ext=l.slice(p,m)),g>0?u.dir=l.slice(0,g-1):d&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function r(i){var a=e[i];if(a!==void 0)return a.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.d=(i,a)=>{for(var s in a)r.o(a,s)&&!r.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:a[s]})},r.o=(i,a)=>Object.prototype.hasOwnProperty.call(i,a),r.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var n={};(()=>{let i;r.r(n),r.d(n,{URI:()=>d,Utils:()=>M}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);let a=/^\w[\w\d+.-]*$/,s=/^\//,o=/^\/\//;function l(R,T){if(!R.scheme&&T)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${R.authority}", path: "${R.path}", query: "${R.query}", fragment: "${R.fragment}"}`);if(R.scheme&&!a.test(R.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(R.path){if(R.authority){if(!s.test(R.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test(R.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}let u="",h="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(T){return T instanceof d||!!T&&typeof T.authority=="string"&&typeof T.fragment=="string"&&typeof T.path=="string"&&typeof T.query=="string"&&typeof T.scheme=="string"&&typeof T.fsPath=="string"&&typeof T.with=="function"&&typeof T.toString=="function"}scheme;authority;path;query;fragment;constructor(T,I,A,D,N,O=!1){typeof T=="object"?(this.scheme=T.scheme||u,this.authority=T.authority||u,this.path=T.path||u,this.query=T.query||u,this.fragment=T.fragment||u):(this.scheme=function(B,P){return B||P?B:"file"}(T,O),this.authority=I||u,this.path=function(B,P){switch(B){case"https":case"http":case"file":P?P[0]!==h&&(P=h+P):P=h}return P}(this.scheme,A||u),this.query=D||u,this.fragment=N||u,l(this,O))}get fsPath(){return b(this,!1)}with(T){if(!T)return this;let{scheme:I,authority:A,path:D,query:N,fragment:O}=T;return I===void 0?I=this.scheme:I===null&&(I=u),A===void 0?A=this.authority:A===null&&(A=u),D===void 0?D=this.path:D===null&&(D=u),N===void 0?N=this.query:N===null&&(N=u),O===void 0?O=this.fragment:O===null&&(O=u),I===this.scheme&&A===this.authority&&D===this.path&&N===this.query&&O===this.fragment?this:new g(I,A,D,N,O)}static parse(T,I=!1){let A=f.exec(T);return A?new g(A[2]||u,E(A[4]||u),E(A[5]||u),E(A[7]||u),E(A[9]||u),I):new g(u,u,u,u,u)}static file(T){let I=u;if(i&&(T=T.replace(/\\/g,h)),T[0]===h&&T[1]===h){let A=T.indexOf(h,2);A===-1?(I=T.substring(2),T=h):(I=T.substring(2,A),T=T.substring(A)||h)}return new g("file",I,T,u,u)}static from(T){let I=new g(T.scheme,T.authority,T.path,T.query,T.fragment);return l(I,!0),I}toString(T=!1){return w(this,T)}toJSON(){return this}static revive(T){if(T){if(T instanceof d)return T;{let I=new g(T);return I._formatted=T.external,I._fsPath=T._sep===p?T.fsPath:null,I}}return T}}let p=i?1:void 0;class g extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=b(this,!1)),this._fsPath}toString(T=!1){return T?w(this,!0):(this._formatted||(this._formatted=w(this,!1)),this._formatted)}toJSON(){let T={$mid:1};return this._fsPath&&(T.fsPath=this._fsPath,T._sep=p),this._formatted&&(T.external=this._formatted),this.path&&(T.path=this.path),this.scheme&&(T.scheme=this.scheme),this.authority&&(T.authority=this.authority),this.query&&(T.query=this.query),this.fragment&&(T.fragment=this.fragment),T}}let m={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function y(R,T,I){let A,D=-1;for(let N=0;N=97&&O<=122||O>=65&&O<=90||O>=48&&O<=57||O===45||O===46||O===95||O===126||T&&O===47||I&&O===91||I&&O===93||I&&O===58)D!==-1&&(A+=encodeURIComponent(R.substring(D,N)),D=-1),A!==void 0&&(A+=R.charAt(N));else{A===void 0&&(A=R.substr(0,N));let B=m[O];B!==void 0?(D!==-1&&(A+=encodeURIComponent(R.substring(D,N)),D=-1),A+=B):D===-1&&(D=N)}}return D!==-1&&(A+=encodeURIComponent(R.substring(D))),A!==void 0?A:R}function x(R){let T;for(let I=0;I1&&R.scheme==="file"?`//${R.authority}${R.path}`:R.path.charCodeAt(0)===47&&(R.path.charCodeAt(1)>=65&&R.path.charCodeAt(1)<=90||R.path.charCodeAt(1)>=97&&R.path.charCodeAt(1)<=122)&&R.path.charCodeAt(2)===58?T?R.path.substr(1):R.path[1].toLowerCase()+R.path.substr(2):R.path,i&&(I=I.replace(/\//g,"\\")),I}function w(R,T){let I=T?x:y,A="",{scheme:D,authority:N,path:O,query:B,fragment:P}=R;if(D&&(A+=D,A+=":"),(N||D==="file")&&(A+=h,A+=h),N){let $=N.indexOf("@");if($!==-1){let z=N.substr(0,$);N=N.substr($+1),$=z.lastIndexOf(":"),$===-1?A+=I(z,!1,!1):(A+=I(z.substr(0,$),!1,!1),A+=":",A+=I(z.substr($+1),!1,!0)),A+="@"}N=N.toLowerCase(),$=N.lastIndexOf(":"),$===-1?A+=I(N,!1,!0):(A+=I(N.substr(0,$),!1,!0),A+=N.substr($))}if(O){if(O.length>=3&&O.charCodeAt(0)===47&&O.charCodeAt(2)===58){let $=O.charCodeAt(1);$>=65&&$<=90&&(O=`/${String.fromCharCode($+32)}:${O.substr(3)}`)}else if(O.length>=2&&O.charCodeAt(1)===58){let $=O.charCodeAt(0);$>=65&&$<=90&&(O=`${String.fromCharCode($+32)}:${O.substr(2)}`)}A+=I(O,!0,!1)}return B&&(A+="?",A+=I(B,!1,!1)),P&&(A+="#",A+=T?P:y(P,!1,!1)),A}function _(R){try{return decodeURIComponent(R)}catch{return R.length>3?R.substr(0,3)+_(R.substr(3)):R}}let k=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function E(R){return R.match(k)?R.replace(k,T=>_(T)):R}var L=r(470);let S=L.posix||L,C="/";var M;(function(R){R.joinPath=function(T,...I){return T.with({path:S.join(T.path,...I)})},R.resolvePath=function(T,...I){let A=T.path,D=!1;A[0]!==C&&(A=C+A,D=!0);let N=S.resolve(A,...I);return D&&N[0]===C&&!T.authority&&(N=N.substring(1)),T.with({path:N})},R.dirname=function(T){if(T.path.length===0||T.path===C)return T;let I=S.dirname(T.path);return I.length===1&&I.charCodeAt(0)===46&&(I=""),T.with({path:I})},R.basename=function(T){return S.basename(T.path)},R.extname=function(T){return S.extname(T.path)}})(M||(M={}))})(),Moe=n})();({URI:Is,Utils:pm}=Moe)});var is,Mc=F(()=>{RN();(function(t){t.basename=pm.basename,t.dirname=pm.dirname,t.extname=pm.extname,t.joinPath=pm.joinPath,t.resolvePath=pm.resolvePath;function e(n,i){return n?.toString()===i?.toString()}t.equals=e;function r(n,i){let a=typeof n=="string"?n:n.path,s=typeof i=="string"?i:i.path,o=a.split("/").filter(d=>d.length>0),l=s.split("/").filter(d=>d.length>0),u=0;for(;u{Ioe();gm();Wo();Ls();Mc();(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(mn||(mn={}));g2=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,r=mr.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,r)}fromTextDocument(e,r,n){return r=r??Is.parse(e.uri),n?this.createAsync(r,e,n):this.create(r,e)}fromString(e,r,n){return n?this.createAsync(r,e,n):this.create(r,e)}fromModel(e,r){return this.create(r,{$model:e})}create(e,r){if(typeof r=="string"){let n=this.parse(e,r);return this.createLangiumDocument(n,e,void 0,r)}else if("$model"in r){let n={value:r.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let n=this.parse(e,r.getText());return this.createLangiumDocument(n,e,r)}}async createAsync(e,r,n){if(typeof r=="string"){let i=await this.parseAsync(e,r,n);return this.createLangiumDocument(i,e,void 0,r)}else{let i=await this.parseAsync(e,r.getText(),n);return this.createLangiumDocument(i,e,r)}}createLangiumDocument(e,r,n,i){let a;if(n)a={parseResult:e,uri:r,state:mn.Parsed,references:[],textDocument:n};else{let s=this.createTextDocumentGetter(r,i);a={parseResult:e,uri:r,state:mn.Parsed,references:[],get textDocument(){return s()}}}return e.value.$document=a,a}async update(e,r){var n,i;let a=(n=e.parseResult.value.$cstNode)===null||n===void 0?void 0:n.root.fullText,s=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),o=s?s.getText():await this.fileSystemProvider.readFile(e.uri);if(s)Object.defineProperty(e,"textDocument",{value:s});else{let l=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:l})}return a!==o&&(e.parseResult=await this.parseAsync(e.uri,o,r),e.parseResult.value.$document=e),e.state=mn.Parsed,e}parse(e,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(r)}parseAsync(e,r,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(r,n)}createTextDocumentGetter(e,r){let n=this.serviceRegistry,i;return()=>i??(i=dm.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,r??""))}},m2=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return Xr(this.documentMap.values())}addDocument(e){let r=e.uri.toString();if(this.documentMap.has(r))throw new Error(`A document with the URI '${r}' is already present.`);this.documentMap.set(r,e)}getDocument(e){let r=e.toString();return this.documentMap.get(r)}async getOrCreateDocument(e,r){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,r),this.addDocument(n),n)}createDocument(e,r,n){if(n)return this.langiumDocumentFactory.fromString(r,e,n).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(r,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=mn.Changed,n.precomputedScopes=void 0,n.references=[],n.diagnostics=void 0),n}deleteDocument(e){let r=e.toString(),n=this.documentMap.get(r);return n&&(n.state=mn.Changed,this.documentMap.delete(r)),n}}});var v2,NN=F(()=>{Wo();$o();Qa();Ho();gm();v2=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,r=mr.CancellationToken.None){for(let n of Vo(e.parseResult.value))await Ri(r),Dg(n).forEach(i=>this.doLink(i,e))}doLink(e,r){let n=e.reference;if(n._ref===void 0)try{let i=this.getCandidate(e);if(Bd(i))n._ref=i;else if(n._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){let a=this.loadAstNode(i);n._ref=a??this.createLinkingError(e,i)}}catch(i){n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${i}`})}r.references.push(n)}unlink(e){for(let r of e.references)delete r._ref,delete r._nodeDescription;e.references=[]}getCandidate(e){let n=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return n??this.createLinkingError(e)}buildReference(e,r,n,i){let a=this,s={$refNode:n,$refText:i,get ref(){var o;if(Xn(this._ref))return this._ref;if(R9(this._nodeDescription)){let l=a.loadAstNode(this._nodeDescription);this._ref=l??a.createLinkingError({reference:s,container:e,property:r},this._nodeDescription)}else if(this._ref===void 0){let l=a.getLinkedNode({reference:s,container:e,property:r});if(l.error&&_i(e).state{Al();y2=class{getName(e){if(Doe(e))return e.name}getNameNode(e){return Py(e.$cstNode,"name")}}});var x2,MN=F(()=>{Al();$o();Qa();El();Ls();Mc();x2=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let r=tR(e),n=e.astNode;if(r&&n){let i=n[r.feature];if(pa(i))return i.ref;if(Array.isArray(i)){for(let a of i)if(pa(a)&&a.$refNode&&a.$refNode.offset<=e.offset&&a.$refNode.end>=e.end)return a.ref}}if(n){let i=this.nameProvider.getNameNode(n);if(i&&(i===e||I9(e,i)))return n}}}findDeclarationNode(e){let r=this.findDeclaration(e);if(r?.$cstNode){let n=this.nameProvider.getNameNode(r);return n??r.$cstNode}}findReferences(e,r){let n=[];if(r.includeDeclaration){let a=this.getReferenceToSelf(e);a&&n.push(a)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return r.documentUri&&(i=i.filter(a=>is.equals(a.sourceUri,r.documentUri))),n.push(...i),Xr(n)}getReferenceToSelf(e){let r=this.nameProvider.getNameNode(e);if(r){let n=_i(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:i,targetUri:n.uri,targetPath:i,segment:zd(r),local:!0}}}}});var Dc,c0,mm=F(()=>{Ls();Dc=class{constructor(e){if(this.map=new Map,e)for(let[r,n]of e)this.add(r,n)}get size(){return Ng.sum(Xr(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,r){if(r===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let i=n.indexOf(r);if(i>=0)return n.length===1?this.map.delete(e):n.splice(i,1),!0}return!1}}get(e){var r;return(r=this.map.get(e))!==null&&r!==void 0?r:[]}has(e,r){if(r===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(r)>=0:!1}}add(e,r){return this.map.has(e)?this.map.get(e).push(r):this.map.set(e,[r]),this}addAll(e,r){return this.map.has(e)?this.map.get(e).push(...r):this.map.set(e,Array.from(r)),this}forEach(e){this.map.forEach((r,n)=>r.forEach(i=>e(i,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return Xr(this.map.entries()).flatMap(([e,r])=>r.map(n=>[e,n]))}keys(){return Xr(this.map.keys())}values(){return Xr(this.map.values()).flat()}entriesGroupedByKey(){return Xr(this.map.entries())}},c0=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[r,n]of e)this.set(r,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,r){return this.map.set(e,r),this.inverse.set(r,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let r=this.map.get(e);return r!==void 0?(this.map.delete(e),this.inverse.delete(r),!0):!1}}});var b2,DN=F(()=>{Wo();Qa();mm();Ho();b2=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,r=mr.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,r)}async computeExportsForNode(e,r,n=Ry,i=mr.CancellationToken.None){let a=[];this.exportNode(e,a,r);for(let s of n(e))await Ri(i),this.exportNode(s,a,r);return a}exportNode(e,r,n){let i=this.nameProvider.getName(e);i&&r.push(this.descriptions.createDescription(e,i,n))}async computeLocalScopes(e,r=mr.CancellationToken.None){let n=e.parseResult.value,i=new Dc;for(let a of _c(n))await Ri(r),this.processNode(a,e,i);return i}processNode(e,r,n){let i=e.$container;if(i){let a=this.nameProvider.getName(e);a&&n.add(i,this.descriptions.createDescription(e,a,r))}}}});var vm,w2,AMe,ON=F(()=>{Ls();vm=class{constructor(e,r,n){var i;this.elements=e,this.outerScope=r,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let r=this.caseInsensitive?this.elements.find(n=>n.name.toLowerCase()===e.toLowerCase()):this.elements.find(n=>n.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}},w2=class{constructor(e,r,n){var i;this.elements=new Map,this.caseInsensitive=(i=n?.caseInsensitive)!==null&&i!==void 0?i:!1;for(let a of e){let s=this.caseInsensitive?a.name.toLowerCase():a.name;this.elements.set(s,a)}this.outerScope=r}getElement(e){let r=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(r);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=Xr(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},AMe={getElement(){},getAllElements(){return Ey}}});var ym,k2,u0,pT,xm,gT=F(()=>{ym=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},k2=class extends ym{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,r){this.throwIfDisposed(),this.cache.set(e,r)}get(e,r){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(r){let n=r();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},u0=class extends ym{constructor(e){super(),this.cache=new Map,this.converter=e??(r=>r)}has(e,r){return this.throwIfDisposed(),this.cacheForContext(e).has(r)}set(e,r,n){this.throwIfDisposed(),this.cacheForContext(e).set(r,n)}get(e,r,n){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(r))return i.get(r);if(n){let a=n();return i.set(r,a),a}else return}delete(e,r){return this.throwIfDisposed(),this.cacheForContext(e).delete(r)}clear(e){if(this.throwIfDisposed(),e){let r=this.converter(e);this.cache.delete(r)}else this.cache.clear()}cacheForContext(e){let r=this.converter(e),n=this.cache.get(r);return n||(n=new Map,this.cache.set(r,n)),n}},pT=class extends u0{constructor(e){super(r=>r.toString()),this.onDispose(e.workspace.DocumentBuilder.onUpdate((r,n)=>{let i=r.concat(n);for(let a of i)this.clear(a)}))}},xm=class extends k2{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}});var T2,PN=F(()=>{ON();Qa();Ls();gT();T2=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new xm(e.shared)}getScope(e){let r=[],n=this.reflection.getReferenceType(e),i=_i(e.container).precomputedScopes;if(i){let s=e.container;do{let o=i.get(s);o.length>0&&r.push(Xr(o).filter(l=>this.reflection.isSubtype(l.type,n))),s=s.$container}while(s)}let a=this.getGlobalScope(n,e);for(let s=r.length-1;s>=0;s--)a=this.createScope(r[s],a);return a}createScope(e,r,n){return new vm(Xr(e),r,n)}createScopeForNodes(e,r,n){let i=Xr(e).map(a=>{let s=this.nameProvider.getName(a);if(s)return this.descriptions.createDescription(a,s)}).nonNullable();return new vm(i,r,n)}getGlobalScope(e,r){return this.globalScopeCache.get(e,()=>new w2(this.indexManager.allElements(e)))}}});function BN(t){return typeof t.$comment=="string"}function Ooe(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}var E2,mT=F(()=>{RN();$o();Qa();Al();E2=class{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,r={}){let n=r?.replacer,i=(s,o)=>this.replacer(s,o,r),a=n?(s,o)=>n(s,o,i):i;try{return this.currentDocument=_i(e),JSON.stringify(e,a,r?.space)}finally{this.currentDocument=void 0}}deserialize(e,r={}){let n=JSON.parse(e);return this.linkNode(n,n,r),n}replacer(e,r,{refText:n,sourceText:i,textRegions:a,comments:s,uriConverter:o}){var l,u,h,f;if(!this.ignoreProperties.has(e))if(pa(r)){let d=r.ref,p=n?r.$refText:void 0;if(d){let g=_i(d),m="";this.currentDocument&&this.currentDocument!==g&&(o?m=o(g.uri,r):m=g.uri.toString());let y=this.astNodeLocator.getAstNodePath(d);return{$ref:`${m}#${y}`,$refText:p}}else return{$error:(u=(l=r.error)===null||l===void 0?void 0:l.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:p}}else if(Xn(r)){let d;if(a&&(d=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},r)),(!e||r.$document)&&d?.$textRegion&&(d.$textRegion.documentURI=(h=this.currentDocument)===null||h===void 0?void 0:h.uri.toString())),i&&!e&&(d??(d=Object.assign({},r)),d.$sourceText=(f=r.$cstNode)===null||f===void 0?void 0:f.text),s){d??(d=Object.assign({},r));let p=this.commentProvider.getComment(r);p&&(d.$comment=p.replace(/\r/g,""))}return d??r}else return r}addAstNodeRegionWithAssignmentsTo(e){let r=n=>({offset:n.offset,end:n.end,length:n.length,range:n.range});if(e.$cstNode){let n=e.$textRegion=r(e.$cstNode),i=n.assignments={};return Object.keys(e).filter(a=>!a.startsWith("$")).forEach(a=>{let s=ZL(e.$cstNode,a).map(r);s.length!==0&&(i[a]=s)}),e}}linkNode(e,r,n,i,a,s){for(let[l,u]of Object.entries(e))if(Array.isArray(u))for(let h=0;h{Mc();S2=class{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(let r of this.singleton.LanguageMetaData.fileExtensions)this.map[r]=this.singleton;this.singleton=void 0}for(let r of e.LanguageMetaData.fileExtensions)this.map[r]!==void 0&&this.map[r]!==e&&console.warn(`The file extension ${r} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[r]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");let r=is.extname(e),n=this.map[r];if(!n)throw new Error(`The service registry contains no services for the extension '${r}'.`);return n}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}}});function vT(t){return{code:t}}var bm,C2,A2=F(()=>{mm();Ho();Ls();(function(t){t.all=["fast","slow","built-in"]})(bm||(bm={}));C2=class{constructor(e){this.entries=new Dc,this.reflection=e.shared.AstReflection}register(e,r=this,n="fast"){if(n==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(let[i,a]of Object.entries(e)){let s=a;if(Array.isArray(s))for(let o of s){let l={check:this.wrapValidationException(o,r),category:n};this.addEntry(i,l)}else if(typeof s=="function"){let o={check:this.wrapValidationException(s,r),category:n};this.addEntry(i,o)}}}wrapValidationException(e,r){return async(n,i,a)=>{try{await e.call(r,n,i,a)}catch(s){if(af(s))throw s;console.error("An error occurred during validation:",s);let o=s instanceof Error?s.message:String(s);s instanceof Error&&s.stack&&console.error(s.stack),i("error","An error occurred during validation: "+o,{node:n})}}}addEntry(e,r){if(e==="AstNode"){this.entries.add("AstNode",r);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,r)}getChecks(e,r){let n=Xr(this.entries.get(e)).concat(this.entries.get("AstNode"));return r&&(n=n.filter(i=>r.includes(i.category))),n.map(i=>i.check)}}});function Poe(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=Py(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=JL(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function yT(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}var _2,Yu,zN=F(()=>{Wo();Al();Qa();El();Ho();A2();_2=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,r={},n=mr.CancellationToken.None){let i=e.parseResult,a=[];if(await Ri(n),(!r.categories||r.categories.includes("built-in"))&&(this.processLexingErrors(i,a,r),r.stopAfterLexingErrors&&a.some(s=>{var o;return((o=s.data)===null||o===void 0?void 0:o.code)===Yu.LexingError})||(this.processParsingErrors(i,a,r),r.stopAfterParsingErrors&&a.some(s=>{var o;return((o=s.data)===null||o===void 0?void 0:o.code)===Yu.ParsingError}))||(this.processLinkingErrors(e,a,r),r.stopAfterLinkingErrors&&a.some(s=>{var o;return((o=s.data)===null||o===void 0?void 0:o.code)===Yu.LinkingError}))))return a;try{a.push(...await this.validateAst(i.value,r,n))}catch(s){if(af(s))throw s;console.error("An error occurred during validation:",s)}return await Ri(n),a}processLexingErrors(e,r,n){for(let i of e.lexerErrors){let a={severity:yT("error"),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:vT(Yu.LexingError),source:this.getSource()};r.push(a)}}processParsingErrors(e,r,n){for(let i of e.parserErrors){let a;if(isNaN(i.token.startOffset)){if("previousToken"in i){let s=i.previousToken;if(isNaN(s.startOffset)){let o={line:0,character:0};a={start:o,end:o}}else{let o={line:s.endLine-1,character:s.endColumn};a={start:o,end:o}}}}else a=Ig(i.token);if(a){let s={severity:yT("error"),range:a,message:i.message,data:vT(Yu.ParsingError),source:this.getSource()};r.push(s)}}}processLinkingErrors(e,r,n){for(let i of e.references){let a=i.error;if(a){let s={node:a.container,property:a.property,index:a.index,data:{code:Yu.LinkingError,containerType:a.container.$type,property:a.property,refText:a.reference.$refText}};r.push(this.toDiagnostic("error",a.message,s))}}}async validateAst(e,r,n=mr.CancellationToken.None){let i=[],a=(s,o,l)=>{i.push(this.toDiagnostic(s,o,l))};return await Promise.all(Vo(e).map(async s=>{await Ri(n);let o=this.validationRegistry.getChecks(s.$type,r.categories);for(let l of o)await l(s,a,n)})),i}toDiagnostic(e,r,n){return{message:r,range:Poe(n),severity:yT(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Yu||(Yu={}))});var L2,R2,$N=F(()=>{Wo();$o();Qa();El();Ho();Mc();L2=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,r,n=_i(e)){r??(r=this.nameProvider.getName(e));let i=this.astNodeLocator.getAstNodePath(e);if(!r)throw new Error(`Node at path ${i} has no name.`);let a,s=()=>{var o;return a??(a=zd((o=this.nameProvider.getNameNode(e))!==null&&o!==void 0?o:e.$cstNode))};return{node:e,name:r,get nameSegment(){return s()},selectionSegment:zd(e.$cstNode),type:e.$type,documentUri:n.uri,path:i}}},R2=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,r=mr.CancellationToken.None){let n=[],i=e.parseResult.value;for(let a of Vo(i))await Ri(r),Dg(a).filter(s=>!Bd(s)).forEach(s=>{let o=this.createDescription(s);o&&n.push(o)});return n}createDescription(e){let r=e.reference.$nodeDescription,n=e.reference.$refNode;if(!r||!n)return;let i=_i(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:r.documentUri,targetPath:r.path,segment:zd(n),local:is.equals(r.documentUri,i)}}}});var N2,GN=F(()=>{N2=class{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let r=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return r+this.segmentSeparator+n}return""}getPathSegment({$containerProperty:e,$containerIndex:r}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return r!==void 0?e+this.indexSeparator+r:e}getAstNode(e,r){return r.split(this.segmentSeparator).reduce((i,a)=>{if(!i||a.length===0)return i;let s=a.indexOf(this.indexSeparator);if(s>0){let o=a.substring(0,s),l=parseInt(a.substring(s+1)),u=i[o];return u?.[l]}return i[a]},e)}}});var I2,UN=F(()=>{Ho();I2=class{constructor(e){this._ready=new ns,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var r,n;this.workspaceConfig=(n=(r=e.capabilities.workspace)===null||r===void 0?void 0:r.configuration)!==null&&n!==void 0?n:!1}async initialized(e){if(this.workspaceConfig){if(e.register){let r=this.serviceRegistry.all;e.register({section:r.map(n=>this.toSectionName(n.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let r=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(r);r.forEach((i,a)=>{this.updateSectionConfiguration(i.section,n[a])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(r=>{this.updateSectionConfiguration(r,e.settings[r])})}updateSectionConfiguration(e,r){this.settings[e]=r}async getConfiguration(e,r){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][r]}toSectionName(e){return`${e}`}}});var h0,VN=F(()=>{(function(t){function e(r){return{dispose:async()=>await r()}}t.create=e})(h0||(h0={}))});var M2,WN=F(()=>{Wo();VN();mm();Ho();Ls();A2();gm();M2=class{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new Dc,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=mn.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,r={},n=mr.CancellationToken.None){var i,a;for(let s of e){let o=s.uri.toString();if(s.state===mn.Validated){if(typeof r.validation=="boolean"&&r.validation)s.state=mn.IndexedReferences,s.diagnostics=void 0,this.buildState.delete(o);else if(typeof r.validation=="object"){let l=this.buildState.get(o),u=(i=l?.result)===null||i===void 0?void 0:i.validationChecks;if(u){let f=((a=r.validation.categories)!==null&&a!==void 0?a:bm.all).filter(d=>!u.includes(d));f.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},r.validation),{categories:f})},result:l.result}),s.state=mn.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=mn.Changed,await this.emitUpdate(e.map(s=>s.uri),[]),await this.buildDocuments(e,r,n)}async update(e,r,n=mr.CancellationToken.None){this.currentState=mn.Changed;for(let s of r)this.langiumDocuments.deleteDocument(s),this.buildState.delete(s.toString()),this.indexManager.remove(s);for(let s of e){if(!this.langiumDocuments.invalidateDocument(s)){let l=this.langiumDocumentFactory.fromModel({$type:"INVALID"},s);l.state=mn.Changed,this.langiumDocuments.addDocument(l)}this.buildState.delete(s.toString())}let i=Xr(e).concat(r).map(s=>s.toString()).toSet();this.langiumDocuments.all.filter(s=>!i.has(s.uri.toString())&&this.shouldRelink(s,i)).forEach(s=>{this.serviceRegistry.getServices(s.uri).references.Linker.unlink(s),s.state=Math.min(s.state,mn.ComputedScopes),s.diagnostics=void 0}),await this.emitUpdate(e,r),await Ri(n);let a=this.langiumDocuments.all.filter(s=>{var o;return s.staten(e,r)))}shouldRelink(e,r){return e.references.some(n=>n.error!==void 0)?!0:this.indexManager.isAffected(e,r)}onUpdate(e){return this.updateListeners.push(e),h0.create(()=>{let r=this.updateListeners.indexOf(e);r>=0&&this.updateListeners.splice(r,1)})}async buildDocuments(e,r,n){this.prepareBuild(e,r),await this.runCancelable(e,mn.Parsed,n,a=>this.langiumDocumentFactory.update(a,n)),await this.runCancelable(e,mn.IndexedContent,n,a=>this.indexManager.updateContent(a,n)),await this.runCancelable(e,mn.ComputedScopes,n,async a=>{let s=this.serviceRegistry.getServices(a.uri).references.ScopeComputation;a.precomputedScopes=await s.computeLocalScopes(a,n)}),await this.runCancelable(e,mn.Linked,n,a=>this.serviceRegistry.getServices(a.uri).references.Linker.link(a,n)),await this.runCancelable(e,mn.IndexedReferences,n,a=>this.indexManager.updateReferences(a,n));let i=e.filter(a=>this.shouldValidate(a));await this.runCancelable(i,mn.Validated,n,a=>this.validate(a,n));for(let a of e){let s=this.buildState.get(a.uri.toString());s&&(s.completed=!0)}}prepareBuild(e,r){for(let n of e){let i=n.uri.toString(),a=this.buildState.get(i);(!a||a.completed)&&this.buildState.set(i,{completed:!1,options:r,result:a?.result})}}async runCancelable(e,r,n,i){let a=e.filter(s=>s.state{this.buildPhaseListeners.delete(e,r)})}waitUntil(e,r,n){let i;if(r&&"path"in r?i=r:n=r,n??(n=mr.CancellationToken.None),i){let a=this.langiumDocuments.getDocument(i);if(a&&a.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(Ic):new Promise((a,s)=>{let o=this.onBuildPhase(e,()=>{if(o.dispose(),l.dispose(),i){let u=this.langiumDocuments.getDocument(i);a(u?.uri)}else a(void 0)}),l=n.onCancellationRequested(()=>{o.dispose(),l.dispose(),s(Ic)})})}async notifyBuildPhase(e,r,n){if(e.length===0)return;let i=this.buildPhaseListeners.get(r);for(let a of i)await Ri(n),await a(e,n)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,r){var n,i;let a=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,s=this.getBuildOptions(e).validation,o=typeof s=="object"?s:void 0,l=await a.validateDocument(e,o,r);e.diagnostics?e.diagnostics.push(...l):e.diagnostics=l;let u=this.buildState.get(e.uri.toString());if(u){(n=u.result)!==null&&n!==void 0||(u.result={});let h=(i=o?.categories)!==null&&i!==void 0?i:bm.all;u.result.validationChecks?u.result.validationChecks.push(...h):u.result.validationChecks=[...h]}}getBuildOptions(e){var r,n;return(n=(r=this.buildState.get(e.uri.toString()))===null||r===void 0?void 0:r.options)!==null&&n!==void 0?n:{}}}});var D2,HN=F(()=>{Qa();gT();Wo();Ls();Mc();D2=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new u0,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,r){let n=_i(e).uri,i=[];return this.referenceIndex.forEach(a=>{a.forEach(s=>{is.equals(s.targetUri,n)&&s.targetPath===r&&i.push(s)})}),Xr(i)}allElements(e,r){let n=Xr(this.symbolIndex.keys());return r&&(n=n.filter(i=>!r||r.has(i))),n.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,r){var n;return r?this.symbolByTypeIndex.get(e,r,()=>{var a;return((a=this.symbolIndex.get(e))!==null&&a!==void 0?a:[]).filter(o=>this.astReflection.isSubtype(o.type,r))}):(n=this.symbolIndex.get(e))!==null&&n!==void 0?n:[]}remove(e){let r=e.toString();this.symbolIndex.delete(r),this.symbolByTypeIndex.clear(r),this.referenceIndex.delete(r)}async updateContent(e,r=mr.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,r),a=e.uri.toString();this.symbolIndex.set(a,i),this.symbolByTypeIndex.clear(a)}async updateReferences(e,r=mr.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,r);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,r){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(i=>!i.local&&r.has(i.targetUri.toString())):!1}}});var O2,qN=F(()=>{Wo();Ho();Mc();O2=class{constructor(e){this.initialBuildOptions={},this._ready=new ns,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}initialize(e){var r;this.folders=(r=e.workspaceFolders)!==null&&r!==void 0?r:void 0}initialized(e){return this.mutex.write(r=>{var n;return this.initializeWorkspace((n=this.folders)!==null&&n!==void 0?n:[],r)})}async initializeWorkspace(e,r=mr.CancellationToken.None){let n=await this.performStartup(e);await Ri(r),await this.documentBuilder.build(n,this.initialBuildOptions,r)}async performStartup(e){let r=this.serviceRegistry.all.flatMap(a=>a.LanguageMetaData.fileExtensions),n=[],i=a=>{n.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(a=>[a,this.getRootFolder(a)]).map(async a=>this.traverseFolder(...a,r,i))),this._ready.resolve(),n}loadAdditionalDocuments(e,r){return Promise.resolve()}getRootFolder(e){return Is.parse(e.uri)}async traverseFolder(e,r,n,i){let a=await this.fileSystemProvider.readDirectory(r);await Promise.all(a.map(async s=>{if(this.includeEntry(e,s,n)){if(s.isDirectory)await this.traverseFolder(e,s.uri,n,i);else if(s.isFile){let o=await this.langiumDocuments.getOrCreateDocument(s.uri);i(o)}}}))}includeEntry(e,r,n){let i=is.basename(r.uri);if(i.startsWith("."))return!1;if(r.isDirectory)return i!=="node_modules"&&i!=="out";if(r.isFile){let a=is.extname(r.uri);return n.includes(a)}return!1}}});function Boe(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function XN(t){return t&&"modes"in t&&"defaultMode"in t}function YN(t){return!Boe(t)&&!XN(t)}var P2,jN=F(()=>{t0();P2=class{constructor(e){let r=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(r);let n=YN(r)?Object.values(r):r;this.chevrotainLexer=new ei(n,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var r;let n=this.chevrotainLexer.tokenize(e);return{tokens:n.tokens,errors:n.errors,hidden:(r=n.groups.hidden)!==null&&r!==void 0?r:[]}}toTokenTypeDictionary(e){if(YN(e))return e;let r=XN(e)?Object.values(e.modes).flat():e,n={};return r.forEach(i=>n[i.name]=i),n}}});function QN(t,e,r){let n,i;typeof t=="string"?(i=e,n=r):(i=t.range.start,n=e),i||(i=$r.create(0,0));let a=$oe(t),s=eI(n),o=LMe({lines:a,position:i,options:s});return DMe({index:0,tokens:o,position:i})}function JN(t,e){let r=eI(e),n=$oe(t);if(n.length===0)return!1;let i=n[0],a=n[n.length-1],s=r.start,o=r.end;return!!s?.exec(i)&&!!o?.exec(a)}function $oe(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(VL)}function LMe(t){var e,r,n;let i=[],a=t.position.line,s=t.position.character;for(let o=0;o=h.length){if(i.length>0){let p=$r.create(a,s);i.push({type:"break",content:"",range:wr.create(p,p)})}}else{Foe.lastIndex=f;let p=Foe.exec(h);if(p){let g=p[0],m=p[1],y=$r.create(a,s+f),x=$r.create(a,s+f+g.length);i.push({type:"tag",content:m,range:wr.create(y,x)}),f+=g.length,f=ZN(h,f)}if(f0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function RMe(t,e,r,n){let i=[];if(t.length===0){let a=$r.create(r,n),s=$r.create(r,n+e.length);i.push({type:"text",content:e,range:wr.create(a,s)})}else{let a=0;for(let o of t){let l=o.index,u=e.substring(a,l);u.length>0&&i.push({type:"text",content:e.substring(a,l),range:wr.create($r.create(r,a+n),$r.create(r,l+n))});let h=u.length+1,f=o[1];if(i.push({type:"inline-tag",content:f,range:wr.create($r.create(r,a+h+n),$r.create(r,a+h+f.length+n))}),h+=f.length,o.length===4){h+=o[2].length;let d=o[3];i.push({type:"text",content:d,range:wr.create($r.create(r,a+h+n),$r.create(r,a+h+d.length+n))})}else i.push({type:"text",content:"",range:wr.create($r.create(r,a+h+n),$r.create(r,a+h+n))});a=l+o[0].length}let s=e.substring(a);s.length>0&&i.push({type:"text",content:s,range:wr.create($r.create(r,a+n),$r.create(r,a+n+s.length))})}return i}function ZN(t,e){let r=t.substring(e).match(NMe);return r?e+r.index:t.length}function MMe(t){let e=t.match(IMe);if(e&&typeof e.index=="number")return e.index}function DMe(t){var e,r,n,i;let a=$r.create(t.position.line,t.position.character);if(t.tokens.length===0)return new xT([],wr.create(a,a));let s=[];for(;t.index0){let l=ZN(e,a);s=e.substring(l),e=e.substring(0,a)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(s=`\`${s}\``),(i=(n=r.renderLink)===null||n===void 0?void 0:n.call(r,e,s))!==null&&i!==void 0?i:zMe(e,s)}}function zMe(t,e){try{return Is.parse(t,!0),`[${e}](${t})`}catch{return t}}function zoe(t){return t.endsWith(` `)?` `:` `}var Foe,_Me,NMe,IMe,xT,B2,F2,bT,tI=F(()=>{oN();Pg();Mc();Foe=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,_Me=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;NMe=/\S/,IMe=/\s*$/;xT=class{constructor(e,r){this.elements=e,this.range=r}getTag(e){return this.getAllTags().find(r=>r.name===e)}getTags(e){return this.getAllTags().filter(r=>r.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let r of this.elements)if(e.length===0)e=r.toString();else{let n=r.toString();e+=zoe(e)+n}return e.trim()}toMarkdown(e){let r="";for(let n of this.elements)if(r.length===0)r=n.toMarkdown(e);else{let i=n.toMarkdown(e);r+=zoe(r)+i}return r.trim()}},B2=class{constructor(e,r,n,i){this.name=e,this.content=r,this.inline=n,this.range=i}toString(){let e=`@${this.name}`,r=this.content.toString();return this.content.inlines.length===1?e=`${e} ${r}`:this.content.inlines.length>1&&(e=`${e} ${r}`),this.inline?`{${e}}`:e}toMarkdown(e){var r,n;return(n=(r=e?.renderTag)===null||r===void 0?void 0:r.call(e,this))!==null&&n!==void 0?n:this.toMarkdownDefault(e)}toMarkdownDefault(e){let r=this.content.toMarkdown(e);if(this.inline){let a=FMe(this.name,r,e??{});if(typeof a=="string")return a}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} \u2014 ${r}`:this.content.inlines.length>1&&(i=`${i} ${r}`),this.inline?`{${i}}`:i}};F2=class{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;rn.range.start.line&&(e+=` `)}return e}toMarkdown(e){let r="";for(let n=0;ni.range.start.line&&(r+=` `)}return r}},bT=class{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}}});var z2,rI=F(()=>{Qa();tI();z2=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let r=this.commentProvider.getComment(e);if(r&&JN(r))return QN(r).toMarkdown({renderLink:(i,a)=>this.documentationLinkRenderer(e,i,a),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,r,n){var i;let a=(i=this.findNameInPrecomputedScopes(e,r))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,r);if(a&&a.nameSegment){let s=a.nameSegment.range.start.line+1,o=a.nameSegment.range.start.character+1,l=a.documentUri.with({fragment:`L${s},${o}`});return`[${n}](${l.toString()})`}else return}documentationTagRenderer(e,r){}findNameInPrecomputedScopes(e,r){let i=_i(e).precomputedScopes;if(!i)return;let a=e;do{let o=i.get(a).find(l=>l.name===r);if(o)return o;a=a.$container}while(a)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(i=>i.name===r)}}});var $2,nI=F(()=>{mT();El();$2=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var r;return BN(e)?e.$comment:(r=D9(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||r===void 0?void 0:r.text}}});var ti={};var iI=F(()=>{gr(ti,Gi(EN(),1))});var G2,aI,sI,oI=F(()=>{Ho();iI();G2=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}},aI=class{constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length{if(this.queue.length>0){let r=this.queue.shift();r&&(e.lock(),r.resolve(e))}}),this.workerPool.push(e)}}async parse(e,r){let n=await this.acquireParserWorker(r),i=new ns,a,s=r.onCancellationRequested(()=>{a=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(o=>{let l=this.hydrator.hydrate(o);i.resolve(l)}).catch(o=>{i.reject(o)}).finally(()=>{s.dispose(),clearTimeout(a)}),i.promise}terminateWorker(e){e.terminate();let r=this.workerPool.indexOf(e);r>=0&&this.workerPool.splice(r,1)}async acquireParserWorker(e){this.initializeWorkers();for(let n of this.workerPool)if(n.ready)return n.lock(),n;let r=new ns;return e.onCancellationRequested(()=>{let n=this.queue.indexOf(r);n>=0&&this.queue.splice(n,1),r.reject(Ic)}),this.queue.push(r),r.promise}},sI=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,r,n,i){this.onReadyEmitter=new ti.Emitter,this.deferred=new ns,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,r(a=>{let s=a;this.deferred.resolve(s),this.unlock()}),n(a=>{this.deferred.reject(a),this.unlock()})}terminate(){this.deferred.reject(Ic),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new ns,this.sendMessage(e),this.deferred.promise}}});var U2,lI=F(()=>{Wo();Ho();U2=class{constructor(){this.previousTokenSource=new mr.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let r=new mr.CancellationTokenSource;return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n){let i=new ns,a={action:r,deferred:i,cancellationToken:n??mr.CancellationToken.None};return e.push(a),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:r,deferred:n,cancellationToken:i})=>{try{let a=await Promise.resolve().then(()=>r(i));n.resolve(a)}catch(a){af(a)?n.resolve(void 0):n.reject(a)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}});var V2,cI=F(()=>{aT();Ac();$o();Qa();mm();El();V2=class{constructor(e){this.grammarElementIdMap=new c0,this.tokenTypeIdMap=new c0,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(r=>Object.assign({},r)),parserErrors:e.parserErrors.map(r=>Object.assign({},r)),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){let r=new Map,n=new Map;for(let i of Vo(e))r.set(i,{});if(e.$cstNode)for(let i of Fd(e.$cstNode))n.set(i,{});return{astNodes:r,cstNodes:n}}dehydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,r));for(let[i,a]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(a)){let s=[];n[i]=s;for(let o of a)Xn(o)?s.push(this.dehydrateAstNode(o,r)):pa(o)?s.push(this.dehydrateReference(o,r)):s.push(o)}else Xn(a)?n[i]=this.dehydrateAstNode(a,r):pa(a)?n[i]=this.dehydrateReference(a,r):a!==void 0&&(n[i]=a);return n}dehydrateReference(e,r){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=r.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,r){let n=r.cstNodes.get(e);return Ty(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=r.astNodes.get(e.astNode),eo(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,r)):Qh(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let r=e.value,n=this.createHydrationContext(r);return"$cstNode"in r&&this.hydrateCstNode(r.$cstNode,n),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(r,n)}}createHydrationContext(e){let r=new Map,n=new Map;for(let a of Vo(e))r.set(a,{});let i;if(e.$cstNode)for(let a of Fd(e.$cstNode)){let s;"fullText"in a?(s=new cm(a.fullText),i=s):"content"in a?s=new a0:"tokenType"in a&&(s=this.hydrateCstLeafNode(a)),s&&(n.set(a,s),s.root=i)}return{astNodes:r,cstNodes:n}}hydrateAstNode(e,r){let n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=r.cstNodes.get(e.$cstNode));for(let[i,a]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(a)){let s=[];n[i]=s;for(let o of a)Xn(o)?s.push(this.setParent(this.hydrateAstNode(o,r),n)):pa(o)?s.push(this.hydrateReference(o,n,i,r)):s.push(o)}else Xn(a)?n[i]=this.setParent(this.hydrateAstNode(a,r),n):pa(a)?n[i]=this.hydrateReference(a,n,i,r):a!==void 0&&(n[i]=a);return n}setParent(e,r){return e.$container=r,e}hydrateReference(e,r,n,i){return this.linker.buildReference(r,n,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,r,n=0){let i=r.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=r.astNodes.get(e.astNode),eo(i))for(let a of e.content){let s=this.hydrateCstNode(a,r,n++);i.content.push(s)}return i}hydrateCstLeafNode(e){let r=this.getTokenType(e.tokenType),n=e.offset,i=e.length,a=e.startLine,s=e.startColumn,o=e.endLine,l=e.endColumn,u=e.hidden;return new i0(n,i,{start:{line:a,character:s},end:{line:o,character:l}},r,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();let r=this.grammarElementIdMap.getKey(e);if(r)return r;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(let r of Vo(this.grammar))Ay(r)&&this.grammarElementIdMap.set(r,e++)}}});function io(t){return{documentation:{CommentProvider:e=>new $2(e),DocumentationProvider:e=>new z2(e)},parser:{AsyncParser:e=>new G2(e),GrammarConfig:e=>aR(e),LangiumParser:e=>gN(e),CompletionParser:e=>dN(e),ValueConverter:()=>new l0,TokenBuilder:()=>new o0,Lexer:e=>new P2(e),ParserErrorMessageProvider:()=>new um},workspace:{AstNodeLocator:()=>new N2,AstNodeDescriptionProvider:e=>new L2(e),ReferenceDescriptionProvider:e=>new R2(e)},references:{Linker:e=>new v2(e),NameProvider:()=>new y2,ScopeProvider:e=>new T2(e),ScopeComputation:e=>new b2(e),References:e=>new x2(e)},serializer:{Hydrator:e=>new V2(e),JsonSerializer:e=>new E2(e)},validation:{DocumentValidator:e=>new _2(e),ValidationRegistry:e=>new C2(e)},shared:()=>t.shared}}function ao(t){return{ServiceRegistry:()=>new S2,workspace:{LangiumDocuments:e=>new m2(e),LangiumDocumentFactory:e=>new g2(e),DocumentBuilder:e=>new M2(e),IndexManager:e=>new D2(e),WorkspaceManager:e=>new O2(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new U2,ConfigurationProvider:e=>new I2(e)}}}var uI=F(()=>{sR();pN();mN();vN();yN();NN();IN();MN();DN();PN();mT();FN();zN();A2();$N();GN();UN();WN();gm();HN();qN();jN();rI();nI();p2();oI();lI();cI()});function Ni(t,e,r,n,i,a,s,o,l){let u=[t,e,r,n,i,a,s,o,l].reduce(wT,{});return Yoe(u)}function qoe(t){if(t&&t[fI])for(let e of Object.values(t))qoe(e);return t}function Yoe(t,e){let r=new Proxy({},{deleteProperty:()=>!1,get:(n,i)=>Hoe(n,i,t,e||r),getOwnPropertyDescriptor:(n,i)=>(Hoe(n,i,t,e||r),Object.getOwnPropertyDescriptor(n,i)),has:(n,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),fI]});return r[fI]=!0,r}function Hoe(t,e,r,n){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===Woe)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in r){let i=r[e];t[e]=Woe;try{t[e]=typeof i=="function"?i(n):Yoe(i,n)}catch(a){throw t[e]=a instanceof Error?a:void 0,a}return t[e]}else return}function wT(t,e){if(e){for(let[r,n]of Object.entries(e))if(n!==void 0){let i=t[r];i!==null&&n!==null&&typeof i=="object"&&typeof n=="object"?t[r]=wT(i,n):t[r]=n}}return t}var hI,fI,Woe,dI=F(()=>{(function(t){t.merge=(e,r)=>wT(wT({},e),r)})(hI||(hI={}));fI=Symbol("isProxy");Woe=Symbol()});var Xoe=F(()=>{});var joe=F(()=>{nI();rI();tI()});var Koe=F(()=>{});var Zoe=F(()=>{sR();Koe()});var Qoe=F(()=>{});var Joe=F(()=>{oI();pN();aT();mN();p2();jN();Qoe();vN();yN()});var ele=F(()=>{NN();IN();MN();ON();DN();PN()});var tle=F(()=>{cI();mT()});var kT,so,pI=F(()=>{kT=class{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}},so={fileSystemProvider:()=>new kT}});function UMe(){let t=Ni(ao(so),GMe),e=Ni(io({shared:t}),$Me);return t.ServiceRegistry.register(e),e}function sf(t){var e;let r=UMe(),n=r.serializer.JsonSerializer.deserialize(t);return r.shared.workspace.LangiumDocumentFactory.fromModel(n,Is.parse(`memory://${(e=n.name)!==null&&e!==void 0?e:"grammar"}.langium`)),n}var $Me,GMe,rle=F(()=>{uI();dI();Ac();pI();Mc();$Me={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},GMe={AstReflection:()=>new Mg}});var Ir={};vr(Ir,{AstUtils:()=>sk,BiMap:()=>c0,Cancellation:()=>mr,ContextCache:()=>u0,CstUtils:()=>Xw,DONE_RESULT:()=>Za,Deferred:()=>ns,Disposable:()=>h0,DisposableCache:()=>ym,DocumentCache:()=>pT,EMPTY_STREAM:()=>Ey,ErrorWithLocation:()=>$d,GrammarUtils:()=>fk,MultiMap:()=>Dc,OperationCancelled:()=>Ic,Reduction:()=>Ng,RegExpUtils:()=>uk,SimpleCache:()=>k2,StreamImpl:()=>to,TreeStreamImpl:()=>Cc,URI:()=>Is,UriUtils:()=>is,WorkspaceCache:()=>xm,assertUnreachable:()=>Jh,delayNextTick:()=>_N,interruptAndCheck:()=>Ri,isOperationCancelled:()=>af,loadGrammarFromJson:()=>sf,setInterruptionPeriod:()=>_oe,startCancelableOperation:()=>Aoe,stream:()=>Xr});var nle=F(()=>{gT();iI();gr(Ir,ti);mm();VN();jw();rle();Ho();Ls();Mc();Qa();Wo();El();Al();Pg()});var ile=F(()=>{zN();A2()});var ale=F(()=>{$N();GN();UN();WN();gm();pI();HN();lI();qN()});var ga={};vr(ga,{AbstractAstReflection:()=>Pd,AbstractCstNode:()=>u2,AbstractLangiumParser:()=>h2,AbstractParserErrorMessageProvider:()=>oT,AbstractThreadedAsyncParser:()=>aI,AstUtils:()=>sk,BiMap:()=>c0,Cancellation:()=>mr,CompositeCstNodeImpl:()=>a0,ContextCache:()=>u0,CstNodeBuilder:()=>c2,CstUtils:()=>Xw,DONE_RESULT:()=>Za,DatatypeSymbol:()=>sT,DefaultAstNodeDescriptionProvider:()=>L2,DefaultAstNodeLocator:()=>N2,DefaultAsyncParser:()=>G2,DefaultCommentProvider:()=>$2,DefaultConfigurationProvider:()=>I2,DefaultDocumentBuilder:()=>M2,DefaultDocumentValidator:()=>_2,DefaultHydrator:()=>V2,DefaultIndexManager:()=>D2,DefaultJsonSerializer:()=>E2,DefaultLangiumDocumentFactory:()=>g2,DefaultLangiumDocuments:()=>m2,DefaultLexer:()=>P2,DefaultLinker:()=>v2,DefaultNameProvider:()=>y2,DefaultReferenceDescriptionProvider:()=>R2,DefaultReferences:()=>x2,DefaultScopeComputation:()=>b2,DefaultScopeProvider:()=>T2,DefaultServiceRegistry:()=>S2,DefaultTokenBuilder:()=>o0,DefaultValueConverter:()=>l0,DefaultWorkspaceLock:()=>U2,DefaultWorkspaceManager:()=>O2,Deferred:()=>ns,Disposable:()=>h0,DisposableCache:()=>ym,DocumentCache:()=>pT,DocumentState:()=>mn,DocumentValidator:()=>Yu,EMPTY_SCOPE:()=>AMe,EMPTY_STREAM:()=>Ey,EmptyFileSystem:()=>so,EmptyFileSystemProvider:()=>kT,ErrorWithLocation:()=>$d,GrammarAST:()=>Ly,GrammarUtils:()=>fk,JSDocDocumentationProvider:()=>z2,LangiumCompletionParser:()=>d2,LangiumParser:()=>f2,LangiumParserErrorMessageProvider:()=>um,LeafCstNodeImpl:()=>i0,MapScope:()=>w2,Module:()=>hI,MultiMap:()=>Dc,OperationCancelled:()=>Ic,ParserWorker:()=>sI,Reduction:()=>Ng,RegExpUtils:()=>uk,RootCstNodeImpl:()=>cm,SimpleCache:()=>k2,StreamImpl:()=>to,StreamScope:()=>vm,TextDocument:()=>dm,TreeStreamImpl:()=>Cc,URI:()=>Is,UriUtils:()=>is,ValidationCategory:()=>bm,ValidationRegistry:()=>C2,ValueConverter:()=>Nc,WorkspaceCache:()=>xm,assertUnreachable:()=>Jh,createCompletionParser:()=>dN,createDefaultCoreModule:()=>io,createDefaultSharedCoreModule:()=>ao,createGrammarConfig:()=>aR,createLangiumParser:()=>gN,delayNextTick:()=>_N,diagnosticData:()=>vT,eagerLoad:()=>qoe,getDiagnosticRange:()=>Poe,inject:()=>Ni,interruptAndCheck:()=>Ri,isAstNode:()=>Xn,isAstNodeDescription:()=>R9,isAstNodeWithComment:()=>BN,isCompositeCstNode:()=>eo,isIMultiModeLexerDefinition:()=>XN,isJSDoc:()=>JN,isLeafCstNode:()=>Qh,isLinkingError:()=>Bd,isNamed:()=>Doe,isOperationCancelled:()=>af,isReference:()=>pa,isRootCstNode:()=>Ty,isTokenTypeArray:()=>Boe,isTokenTypeDictionary:()=>YN,loadGrammarFromJson:()=>sf,parseJSDoc:()=>QN,prepareLangiumParser:()=>boe,setInterruptionPeriod:()=>_oe,startCancelableOperation:()=>Aoe,stream:()=>Xr,toDiagnosticSeverity:()=>yT});var Oc=F(()=>{uI();dI();FN();Xoe();$o();joe();Zoe();Joe();ele();tle();nle();gr(ga,Ir);ile();ale();Ac()});function dle(t){return Ll.isInstance(t,fle)}function ple(t){return Ll.isInstance(t,gI)}function gle(t){return Ll.isInstance(t,mI)}function mle(t){return Ll.isInstance(t,qMe)}function vle(t){return Ll.isInstance(t,vI)}function xle(t){return Ll.isInstance(t,yle)}function ble(t){return Ll.isInstance(t,yI)}function kle(t){return Ll.isInstance(t,wle)}function Ele(t){return Ll.isInstance(t,Tle)}function Cle(t){return Ll.isInstance(t,Sle)}function _le(t){return Ll.isInstance(t,Ale)}var VMe,Ct,hle,fle,gI,WMe,HMe,mI,qMe,vI,yle,yI,wle,Tle,Sle,Ale,YMe,Lle,Ll,sle,XMe,ole,jMe,lle,KMe,cle,ZMe,ule,QMe,JMe,eDe,tDe,rDe,nDe,Rl,xI,bI,wI,kI,TI,iDe,aDe,sDe,oDe,wm,f0,qo,lDe,Yo=F(()=>{Oc();Oc();Oc();Oc();VMe=Object.defineProperty,Ct=(t,e)=>VMe(t,"name",{value:e,configurable:!0}),hle="Statement",fle="Architecture";Ct(dle,"isArchitecture");gI="Branch";Ct(ple,"isBranch");WMe="Checkout",HMe="CherryPicking",mI="Commit";Ct(gle,"isCommit");qMe="Common";Ct(mle,"isCommon");vI="GitGraph";Ct(vle,"isGitGraph");yle="Info";Ct(xle,"isInfo");yI="Merge";Ct(ble,"isMerge");wle="Packet";Ct(kle,"isPacket");Tle="PacketBlock";Ct(Ele,"isPacketBlock");Sle="Pie";Ct(Cle,"isPie");Ale="PieSection";Ct(_le,"isPieSection");YMe="Direction",Lle=class extends Pd{static{Ct(this,"MermaidAstReflection")}getAllTypes(){return["Architecture","Branch","Checkout","CherryPicking","Commit","Common","Direction","Edge","GitGraph","Group","Info","Junction","Merge","Packet","PacketBlock","Pie","PieSection","Service","Statement"]}computeIsSubtype(t,e){switch(t){case gI:case WMe:case HMe:case mI:case yI:return this.isSubtype(hle,e);case YMe:return this.isSubtype(vI,e);default:return!1}}getReferenceType(t){let e=`${t.container.$type}:${t.property}`;switch(e){default:throw new Error(`${e} is not a valid reference id.`)}}getTypeMetaData(t){switch(t){case"Architecture":return{name:"Architecture",properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case"Branch":return{name:"Branch",properties:[{name:"name"},{name:"order"}]};case"Checkout":return{name:"Checkout",properties:[{name:"branch"}]};case"CherryPicking":return{name:"CherryPicking",properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case"Commit":return{name:"Commit",properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Common":return{name:"Common",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Edge":return{name:"Edge",properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case"GitGraph":return{name:"GitGraph",properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case"Group":return{name:"Group",properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case"Info":return{name:"Info",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Junction":return{name:"Junction",properties:[{name:"id"},{name:"in"}]};case"Merge":return{name:"Merge",properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Packet":return{name:"Packet",properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case"PacketBlock":return{name:"PacketBlock",properties:[{name:"end"},{name:"label"},{name:"start"}]};case"Pie":return{name:"Pie",properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case"PieSection":return{name:"PieSection",properties:[{name:"label"},{name:"value"}]};case"Service":return{name:"Service",properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case"Direction":return{name:"Direction",properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:t,properties:[]}}}},Ll=new Lle,XMe=Ct(()=>sle??(sle=sf('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","name":"Info","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"InfoGrammar"),jMe=Ct(()=>ole??(ole=sf(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","name":"Packet","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),KMe=Ct(()=>lle??(lle=sf('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","name":"Pie","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"PieGrammar"),ZMe=Ct(()=>cle??(cle=sf('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","name":"Architecture","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LeftPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RightPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Arrow","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"ArchitectureGrammar"),QMe=Ct(()=>ule??(ule=sf(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","name":"GitGraph","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),JMe={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},eDe={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},tDe={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},rDe={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},nDe={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},Rl={AstReflection:Ct(()=>new Lle,"AstReflection")},xI={Grammar:Ct(()=>XMe(),"Grammar"),LanguageMetaData:Ct(()=>JMe,"LanguageMetaData"),parser:{}},bI={Grammar:Ct(()=>jMe(),"Grammar"),LanguageMetaData:Ct(()=>eDe,"LanguageMetaData"),parser:{}},wI={Grammar:Ct(()=>KMe(),"Grammar"),LanguageMetaData:Ct(()=>tDe,"LanguageMetaData"),parser:{}},kI={Grammar:Ct(()=>ZMe(),"Grammar"),LanguageMetaData:Ct(()=>rDe,"LanguageMetaData"),parser:{}},TI={Grammar:Ct(()=>QMe(),"Grammar"),LanguageMetaData:Ct(()=>nDe,"LanguageMetaData"),parser:{}},iDe=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,aDe=/accTitle[\t ]*:([^\n\r]*)/,sDe=/title([\t ][^\n\r]*|)/,oDe={ACC_DESCR:iDe,ACC_TITLE:aDe,TITLE:sDe},wm=class extends l0{static{Ct(this,"AbstractMermaidValueConverter")}runConverter(t,e,r){let n=this.runCommonConverter(t,e,r);return n===void 0&&(n=this.runCustomConverter(t,e,r)),n===void 0?super.runConverter(t,e,r):n}runCommonConverter(t,e,r){let n=oDe[t.name];if(n===void 0)return;let i=n.exec(e);if(i!==null){if(i[1]!==void 0)return i[1].trim().replace(/[\t ]{2,}/gm," ");if(i[2]!==void 0)return i[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,` `)}}},f0=class extends wm{static{Ct(this,"CommonValueConverter")}runCustomConverter(t,e,r){}},qo=class extends o0{static{Ct(this,"AbstractMermaidTokenBuilder")}constructor(t){super(),this.keywords=new Set(t)}buildKeywordTokens(t,e,r){let n=super.buildKeywordTokens(t,e,r);return n.forEach(i=>{this.keywords.has(i.name)&&i.PATTERN!==void 0&&(i.PATTERN=new RegExp(i.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),n}},lDe=class extends qo{static{Ct(this,"CommonTokenBuilder")}}});function ET(t=so){let e=Ni(ao(t),Rl),r=Ni(io({shared:e}),TI,TT);return e.ServiceRegistry.register(r),{shared:e,GitGraph:r}}var cDe,TT,EI=F(()=>{Yo();Oc();cDe=class extends qo{static{Ct(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},TT={parser:{TokenBuilder:Ct(()=>new cDe,"TokenBuilder"),ValueConverter:Ct(()=>new f0,"ValueConverter")}};Ct(ET,"createGitGraphServices")});function CT(t=so){let e=Ni(ao(t),Rl),r=Ni(io({shared:e}),xI,ST);return e.ServiceRegistry.register(r),{shared:e,Info:r}}var uDe,ST,SI=F(()=>{Yo();Oc();uDe=class extends qo{static{Ct(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},ST={parser:{TokenBuilder:Ct(()=>new uDe,"TokenBuilder"),ValueConverter:Ct(()=>new f0,"ValueConverter")}};Ct(CT,"createInfoServices")});function _T(t=so){let e=Ni(ao(t),Rl),r=Ni(io({shared:e}),bI,AT);return e.ServiceRegistry.register(r),{shared:e,Packet:r}}var hDe,AT,CI=F(()=>{Yo();Oc();hDe=class extends qo{static{Ct(this,"PacketTokenBuilder")}constructor(){super(["packet-beta"])}},AT={parser:{TokenBuilder:Ct(()=>new hDe,"TokenBuilder"),ValueConverter:Ct(()=>new f0,"ValueConverter")}};Ct(_T,"createPacketServices")});function RT(t=so){let e=Ni(ao(t),Rl),r=Ni(io({shared:e}),wI,LT);return e.ServiceRegistry.register(r),{shared:e,Pie:r}}var fDe,dDe,LT,AI=F(()=>{Yo();Oc();fDe=class extends qo{static{Ct(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},dDe=class extends wm{static{Ct(this,"PieValueConverter")}runCustomConverter(t,e,r){if(t.name==="PIE_SECTION_LABEL")return e.replace(/"/g,"").trim()}},LT={parser:{TokenBuilder:Ct(()=>new fDe,"TokenBuilder"),ValueConverter:Ct(()=>new dDe,"ValueConverter")}};Ct(RT,"createPieServices")});function IT(t=so){let e=Ni(ao(t),Rl),r=Ni(io({shared:e}),kI,NT);return e.ServiceRegistry.register(r),{shared:e,Architecture:r}}var pDe,gDe,NT,_I=F(()=>{Yo();Oc();pDe=class extends qo{static{Ct(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},gDe=class extends wm{static{Ct(this,"ArchitectureValueConverter")}runCustomConverter(t,e,r){if(t.name==="ARCH_ICON")return e.replace(/[()]/g,"").trim();if(t.name==="ARCH_TEXT_ICON")return e.replace(/["()]/g,"");if(t.name==="ARCH_TITLE")return e.replace(/[[\]]/g,"").trim()}},NT={parser:{TokenBuilder:Ct(()=>new pDe,"TokenBuilder"),ValueConverter:Ct(()=>new gDe,"ValueConverter")}};Ct(IT,"createArchitectureServices")});var Rle={};vr(Rle,{InfoModule:()=>ST,createInfoServices:()=>CT});var Nle=F(()=>{SI();Yo()});var Ile={};vr(Ile,{PacketModule:()=>AT,createPacketServices:()=>_T});var Mle=F(()=>{CI();Yo()});var Dle={};vr(Dle,{PieModule:()=>LT,createPieServices:()=>RT});var Ole=F(()=>{AI();Yo()});var Ple={};vr(Ple,{ArchitectureModule:()=>NT,createArchitectureServices:()=>IT});var Ble=F(()=>{_I();Yo()});var Fle={};vr(Fle,{GitGraphModule:()=>TT,createGitGraphServices:()=>ET});var zle=F(()=>{EI();Yo()});async function Nl(t,e){let r=mDe[t];if(!r)throw new Error(`Unknown diagram type: ${t}`);d0[t]||await r();let i=d0[t].parse(e);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new vDe(i);return i.value}var d0,mDe,vDe,km=F(()=>{EI();SI();CI();AI();_I();Yo();d0={},mDe={info:Ct(async()=>{let{createInfoServices:t}=await Promise.resolve().then(()=>(Nle(),Rle)),e=t().Info.parser.LangiumParser;d0.info=e},"info"),packet:Ct(async()=>{let{createPacketServices:t}=await Promise.resolve().then(()=>(Mle(),Ile)),e=t().Packet.parser.LangiumParser;d0.packet=e},"packet"),pie:Ct(async()=>{let{createPieServices:t}=await Promise.resolve().then(()=>(Ole(),Dle)),e=t().Pie.parser.LangiumParser;d0.pie=e},"pie"),architecture:Ct(async()=>{let{createArchitectureServices:t}=await Promise.resolve().then(()=>(Ble(),Ple)),e=t().Architecture.parser.LangiumParser;d0.architecture=e},"architecture"),gitGraph:Ct(async()=>{let{createGitGraphServices:t}=await Promise.resolve().then(()=>(zle(),Fle)),e=t().GitGraph.parser.LangiumParser;d0.gitGraph=e},"gitGraph")};Ct(Nl,"parse");vDe=class extends Error{constructor(t){let e=t.lexerErrors.map(n=>n.message).join(` `),r=t.parserErrors.map(n=>n.message).join(` `);super(`Parsing failed: ${e} ${r}`),this.result=t}static{Ct(this,"MermaidParseError")}}});var Yle={};vr(Yle,{diagram:()=>hOe});function OT(){return lA({length:7})}function Gle(t,e){let r=Object.create(null);return t.reduce((n,i)=>{let a=e(i);return r[a]||(r[a]=!0,n.push(i)),n},[])}function LI(t,e,r){let n=t.indexOf(e);n===-1?t.push(r):t.splice(n,1,r)}function RI(t){let e=t.reduce((i,a)=>i.seq>a.seq?i:a,t[0]),r="";t.forEach(function(i){i===e?r+=" *":r+=" |"});let n=[r,e.id,e.seq];for(let i in gt.records.branches)gt.records.branches.get(i)===e.id&&n.push(i);if(re.debug(n.join(" ")),e.parents&&e.parents.length==2&&e.parents[0]&&e.parents[1]){let i=gt.records.commits.get(e.parents[0]);LI(t,e,i),e.parents[1]&&t.push(gt.records.commits.get(e.parents[1]))}else{if(e.parents.length==0)return;if(e.parents[0]){let i=gt.records.commits.get(e.parents[0]);LI(t,e,i)}}t=Gle(t,i=>i.id),RI(t)}var nn,yDe,g0,gt,xDe,bDe,wDe,kDe,TDe,EDe,SDe,Ule,CDe,ADe,_De,LDe,RDe,Vle,NDe,IDe,MDe,Wle,DDe,ODe,PDe,BDe,FDe,zDe,$De,GDe,UDe,Xo,lf,cf,Pc,Xu,p0,Ms,Ds,MT,W2,DT,of,kr,VDe,Hle,qle,WDe,HDe,qDe,YDe,XDe,jDe,KDe,ZDe,QDe,JDe,eOe,tOe,$le,rOe,H2,nOe,iOe,aOe,sOe,oOe,lOe,cOe,uOe,hOe,Xle=F(()=>{ky();Hw();kn();or();km();lr();nn={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},yDe=sr.gitGraph,g0=v(()=>ws({...yDe,...Or().gitGraph}),"getConfig"),gt=new Rg(()=>{let t=g0(),e=t.mainBranchName,r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}});v(OT,"getID");v(Gle,"uniqBy");xDe=v(function(t){gt.records.direction=t},"setDirection"),bDe=v(function(t){re.debug("options str",t),t=t?.trim(),t=t||"{}";try{gt.records.options=JSON.parse(t)}catch(e){re.error("error while parsing gitGraph options",e.message)}},"setOptions"),wDe=v(function(){return gt.records.options},"getOptions"),kDe=v(function(t){let e=t.msg,r=t.id,n=t.type,i=t.tags;re.info("commit",e,r,n,i),re.debug("Entering commit:",e,r,n,i);let a=g0();r=Xe.sanitizeText(r,a),e=Xe.sanitizeText(e,a),i=i?.map(o=>Xe.sanitizeText(o,a));let s={id:r||gt.records.seq+"-"+OT(),message:e,seq:gt.records.seq++,type:n??nn.NORMAL,tags:i??[],parents:gt.records.head==null?[]:[gt.records.head.id],branch:gt.records.currBranch};gt.records.head=s,re.info("main branch",a.mainBranchName),gt.records.commits.set(s.id,s),gt.records.branches.set(gt.records.currBranch,s.id),re.debug("in pushCommit "+s.id)},"commit"),TDe=v(function(t){let e=t.name,r=t.order;if(e=Xe.sanitizeText(e,g0()),gt.records.branches.has(e))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`);gt.records.branches.set(e,gt.records.head!=null?gt.records.head.id:null),gt.records.branchConfig.set(e,{name:e,order:r}),Ule(e),re.debug("in createBranch")},"branch"),EDe=v(t=>{let e=t.branch,r=t.id,n=t.type,i=t.tags,a=g0();e=Xe.sanitizeText(e,a),r&&(r=Xe.sanitizeText(r,a));let s=gt.records.branches.get(gt.records.currBranch),o=gt.records.branches.get(e),l=s?gt.records.commits.get(s):void 0,u=o?gt.records.commits.get(o):void 0;if(l&&u&&l.branch===e)throw new Error(`Cannot merge branch '${e}' into itself.`);if(gt.records.currBranch===e){let d=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},d}if(l===void 0||!l){let d=new Error(`Incorrect usage of "merge". Current branch (${gt.records.currBranch})has no commits`);throw d.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},d}if(!gt.records.branches.has(e)){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");throw d.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]},d}if(u===void 0||!u){let d=new Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");throw d.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']},d}if(l===u){let d=new Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},d}if(r&>.records.commits.has(r)){let d=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom Id");throw d.hash={text:`merge ${e} ${r} ${n} ${i?.join(" ")}`,token:`merge ${e} ${r} ${n} ${i?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${n} ${i?.join(" ")}`]},d}let h=o||"",f={id:r||`${gt.records.seq}-${OT()}`,message:`merged branch ${e} into ${gt.records.currBranch}`,seq:gt.records.seq++,parents:gt.records.head==null?[]:[gt.records.head.id,h],branch:gt.records.currBranch,type:nn.MERGE,customType:n,customId:!!r,tags:i??[]};gt.records.head=f,gt.records.commits.set(f.id,f),gt.records.branches.set(gt.records.currBranch,f.id),re.debug(gt.records.branches),re.debug("in mergeBranch")},"merge"),SDe=v(function(t){let e=t.id,r=t.targetId,n=t.tags,i=t.parent;re.debug("Entering cherryPick:",e,r,n);let a=g0();if(e=Xe.sanitizeText(e,a),r=Xe.sanitizeText(r,a),n=n?.map(l=>Xe.sanitizeText(l,a)),i=Xe.sanitizeText(i,a),!e||!gt.records.commits.has(e)){let l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},l}let s=gt.records.commits.get(e);if(s===void 0||!s)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(s.parents)&&s.parents.includes(i)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let o=s.branch;if(s.type===nn.MERGE&&!i)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!gt.records.commits.has(r)){if(o===gt.records.currBranch){let f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},f}let l=gt.records.branches.get(gt.records.currBranch);if(l===void 0||!l){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${gt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},f}let u=gt.records.commits.get(l);if(u===void 0||!u){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${gt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},f}let h={id:gt.records.seq+"-"+OT(),message:`cherry-picked ${s?.message} into ${gt.records.currBranch}`,seq:gt.records.seq++,parents:gt.records.head==null?[]:[gt.records.head.id,s.id],branch:gt.records.currBranch,type:nn.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${s.id}${s.type===nn.MERGE?`|parent:${i}`:""}`]};gt.records.head=h,gt.records.commits.set(h.id,h),gt.records.branches.set(gt.records.currBranch,h.id),re.debug(gt.records.branches),re.debug("in cherryPick")}},"cherryPick"),Ule=v(function(t){if(t=Xe.sanitizeText(t,g0()),gt.records.branches.has(t)){gt.records.currBranch=t;let e=gt.records.branches.get(gt.records.currBranch);e===void 0||!e?gt.records.head=null:gt.records.head=gt.records.commits.get(e)??null}else{let e=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},e}},"checkout");v(LI,"upsert");v(RI,"prettyPrintCommitHistory");CDe=v(function(){re.debug(gt.records.commits);let t=Vle()[0];RI([t])},"prettyPrint"),ADe=v(function(){gt.reset(),xr()},"clear"),_De=v(function(){return[...gt.records.branchConfig.values()].map((e,r)=>e.order!==null&&e.order!==void 0?e:{...e,order:parseFloat(`0.${r}`)}).sort((e,r)=>(e.order??0)-(r.order??0)).map(({name:e})=>({name:e}))},"getBranchesAsObjArray"),LDe=v(function(){return gt.records.branches},"getBranches"),RDe=v(function(){return gt.records.commits},"getCommits"),Vle=v(function(){let t=[...gt.records.commits.values()];return t.forEach(function(e){re.debug(e.id)}),t.sort((e,r)=>e.seq-r.seq),t},"getCommitsArray"),NDe=v(function(){return gt.records.currBranch},"getCurrentBranch"),IDe=v(function(){return gt.records.direction},"getDirection"),MDe=v(function(){return gt.records.head},"getHead"),Wle={commitType:nn,getConfig:g0,setDirection:xDe,setOptions:bDe,getOptions:wDe,commit:kDe,branch:TDe,merge:EDe,cherryPick:SDe,checkout:Ule,prettyPrint:CDe,clear:ADe,getBranchesAsObjArray:_De,getBranches:LDe,getCommits:RDe,getCommitsArray:Vle,getCurrentBranch:NDe,getDirection:IDe,getHead:MDe,setAccTitle:Tr,getAccTitle:_r,getAccDescription:Rr,setAccDescription:Lr,setDiagramTitle:tn,getDiagramTitle:qr},DDe=v((t,e)=>{Pu(t,e),t.dir&&e.setDirection(t.dir);for(let r of t.statements)ODe(r,e)},"populate"),ODe=v((t,e)=>{let n={Commit:v(i=>e.commit(PDe(i)),"Commit"),Branch:v(i=>e.branch(BDe(i)),"Branch"),Merge:v(i=>e.merge(FDe(i)),"Merge"),Checkout:v(i=>e.checkout(zDe(i)),"Checkout"),CherryPicking:v(i=>e.cherryPick($De(i)),"CherryPicking")}[t.$type];n?n(t):re.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),PDe=v(t=>({id:t.id,msg:t.message??"",type:t.type!==void 0?nn[t.type]:nn.NORMAL,tags:t.tags??void 0}),"parseCommit"),BDe=v(t=>({name:t.name,order:t.order??0}),"parseBranch"),FDe=v(t=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?nn[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),zDe=v(t=>t.branch,"parseCheckout"),$De=v(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),GDe={parse:v(async t=>{let e=await Nl("gitGraph",t);re.debug(e),DDe(e,Wle)},"parse")},UDe=pe(),Xo=UDe?.gitGraph,lf=10,cf=40,Pc=4,Xu=2,p0=8,Ms=new Map,Ds=new Map,MT=30,W2=new Map,DT=[],of=0,kr="LR",VDe=v(()=>{Ms.clear(),Ds.clear(),W2.clear(),of=0,DT=[],kr="LR"},"clear"),Hle=v(t=>{let e=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof t=="string"?t.split(/\\n|\n|/gi):t).forEach(n=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=n.trim(),e.appendChild(i)}),e},"drawText"),qle=v(t=>{let e,r,n;return kr==="BT"?(r=v((i,a)=>i<=a,"comparisonFunc"),n=1/0):(r=v((i,a)=>i>=a,"comparisonFunc"),n=0),t.forEach(i=>{let a=kr==="TB"||kr=="BT"?Ds.get(i)?.y:Ds.get(i)?.x;a!==void 0&&r(a,n)&&(e=i,n=a)}),e},"findClosestParent"),WDe=v(t=>{let e="",r=1/0;return t.forEach(n=>{let i=Ds.get(n).y;i<=r&&(e=n,r=i)}),e||void 0},"findClosestParentBT"),HDe=v((t,e,r)=>{let n=r,i=r,a=[];t.forEach(s=>{let o=e.get(s);if(!o)throw new Error(`Commit not found for key ${s}`);o.parents.length?(n=YDe(o),i=Math.max(n,i)):a.push(o),XDe(o,n)}),n=i,a.forEach(s=>{jDe(s,n,r)}),t.forEach(s=>{let o=e.get(s);if(o?.parents.length){let l=WDe(o.parents);n=Ds.get(l).y-cf,n<=i&&(i=n);let u=Ms.get(o.branch).pos,h=n-lf;Ds.set(o.id,{x:u,y:h})}})},"setParallelBTPos"),qDe=v(t=>{let e=qle(t.parents.filter(n=>n!==null));if(!e)throw new Error(`Closest parent not found for commit ${t.id}`);let r=Ds.get(e)?.y;if(r===void 0)throw new Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),YDe=v(t=>qDe(t)+cf,"calculateCommitPosition"),XDe=v((t,e)=>{let r=Ms.get(t.branch);if(!r)throw new Error(`Branch not found for commit ${t.id}`);let n=r.pos,i=e+lf;return Ds.set(t.id,{x:n,y:i}),{x:n,y:i}},"setCommitPosition"),jDe=v((t,e,r)=>{let n=Ms.get(t.branch);if(!n)throw new Error(`Branch not found for commit ${t.id}`);let i=e+r,a=n.pos;Ds.set(t.id,{x:a,y:i})},"setRootPosition"),KDe=v((t,e,r,n,i,a)=>{if(a===nn.HIGHLIGHT)t.append("rect").attr("x",r.x-10).attr("y",r.y-10).attr("width",20).attr("height",20).attr("class",`commit ${e.id} commit-highlight${i%p0} ${n}-outer`),t.append("rect").attr("x",r.x-6).attr("y",r.y-6).attr("width",12).attr("height",12).attr("class",`commit ${e.id} commit${i%p0} ${n}-inner`);else if(a===nn.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",10).attr("class",`commit ${e.id} ${n}`),t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${n}`),t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${n}`),t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${n}`),t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${n}`);else{let s=t.append("circle");if(s.attr("cx",r.x),s.attr("cy",r.y),s.attr("r",e.type===nn.MERGE?9:10),s.attr("class",`commit ${e.id} commit${i%p0}`),a===nn.MERGE){let o=t.append("circle");o.attr("cx",r.x),o.attr("cy",r.y),o.attr("r",6),o.attr("class",`commit ${n} ${e.id} commit${i%p0}`)}a===nn.REVERSE&&t.append("path").attr("d",`M ${r.x-5},${r.y-5}L${r.x+5},${r.y+5}M${r.x-5},${r.y+5}L${r.x+5},${r.y-5}`).attr("class",`commit ${n} ${e.id} commit${i%p0}`)}},"drawCommitBullet"),ZDe=v((t,e,r,n)=>{if(e.type!==nn.CHERRY_PICK&&(e.customId&&e.type===nn.MERGE||e.type!==nn.MERGE)&&Xo?.showCommitLabel){let i=t.append("g"),a=i.insert("rect").attr("class","commit-label-bkg"),s=i.append("text").attr("x",n).attr("y",r.y+25).attr("class","commit-label").text(e.id),o=s.node()?.getBBox();if(o&&(a.attr("x",r.posWithOffset-o.width/2-Xu).attr("y",r.y+13.5).attr("width",o.width+2*Xu).attr("height",o.height+2*Xu),kr==="TB"||kr==="BT"?(a.attr("x",r.x-(o.width+4*Pc+5)).attr("y",r.y-12),s.attr("x",r.x-(o.width+4*Pc)).attr("y",r.y+o.height-12)):s.attr("x",r.posWithOffset-o.width/2),Xo.rotateCommitLabel))if(kr==="TB"||kr==="BT")s.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),a.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let l=-7.5-(o.width+10)/25*9.5,u=10+o.width/25*8.5;i.attr("transform","translate("+l+", "+u+") rotate(-45, "+n+", "+r.y+")")}}},"drawCommitLabel"),QDe=v((t,e,r,n)=>{if(e.tags.length>0){let i=0,a=0,s=0,o=[];for(let l of e.tags.reverse()){let u=t.insert("polygon"),h=t.append("circle"),f=t.append("text").attr("y",r.y-16-i).attr("class","tag-label").text(l),d=f.node()?.getBBox();if(!d)throw new Error("Tag bbox not found");a=Math.max(a,d.width),s=Math.max(s,d.height),f.attr("x",r.posWithOffset-d.width/2),o.push({tag:f,hole:h,rect:u,yOffset:i}),i+=20}for(let{tag:l,hole:u,rect:h,yOffset:f}of o){let d=s/2,p=r.y-19.2-f;if(h.attr("class","tag-label-bkg").attr("points",` ${n-a/2-Pc/2},${p+Xu} ${n-a/2-Pc/2},${p-Xu} ${r.posWithOffset-a/2-Pc},${p-d-Xu} ${r.posWithOffset+a/2+Pc},${p-d-Xu} ${r.posWithOffset+a/2+Pc},${p+d+Xu} ${r.posWithOffset-a/2-Pc},${p+d+Xu}`),u.attr("cy",p).attr("cx",n-a/2+Pc/2).attr("r",1.5).attr("class","tag-hole"),kr==="TB"||kr==="BT"){let g=n+f;h.attr("class","tag-label-bkg").attr("points",` ${r.x},${g+2} ${r.x},${g-2} ${r.x+lf},${g-d-2} ${r.x+lf+a+4},${g-d-2} ${r.x+lf+a+4},${g+d+2} ${r.x+lf},${g+d+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),u.attr("cx",r.x+Pc/2).attr("cy",g).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),l.attr("x",r.x+5).attr("y",g+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+n+")")}}}},"drawCommitTags"),JDe=v(t=>{switch(t.customType??t.type){case nn.NORMAL:return"commit-normal";case nn.REVERSE:return"commit-reverse";case nn.HIGHLIGHT:return"commit-highlight";case nn.MERGE:return"commit-merge";case nn.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),eOe=v((t,e,r,n)=>{let i={x:0,y:0};if(t.parents.length>0){let a=qle(t.parents);if(a){let s=n.get(a)??i;return e==="TB"?s.y+cf:e==="BT"?(n.get(t.id)??i).y-cf:s.x+cf}}else return e==="TB"?MT:e==="BT"?(n.get(t.id)??i).y-cf:0;return 0},"calculatePosition"),tOe=v((t,e,r)=>{let n=kr==="BT"&&r?e:e+lf,i=kr==="TB"||kr==="BT"?n:Ms.get(t.branch)?.pos,a=kr==="TB"||kr==="BT"?Ms.get(t.branch)?.pos:n;if(a===void 0||i===void 0)throw new Error(`Position were undefined for commit ${t.id}`);return{x:a,y:i,posWithOffset:n}},"getCommitPosition"),$le=v((t,e,r)=>{if(!Xo)throw new Error("GitGraph config not found");let n=t.append("g").attr("class","commit-bullets"),i=t.append("g").attr("class","commit-labels"),a=kr==="TB"||kr==="BT"?MT:0,s=[...e.keys()],o=Xo?.parallelCommits??!1,l=v((h,f)=>{let d=e.get(h)?.seq,p=e.get(f)?.seq;return d!==void 0&&p!==void 0?d-p:0},"sortKeys"),u=s.sort(l);kr==="BT"&&(o&&HDe(u,e,a),u=u.reverse()),u.forEach(h=>{let f=e.get(h);if(!f)throw new Error(`Commit not found for key ${h}`);o&&(a=eOe(f,kr,a,Ds));let d=tOe(f,a,o);if(r){let p=JDe(f),g=f.customType??f.type,m=Ms.get(f.branch)?.index??0;KDe(n,f,d,p,m,g),ZDe(i,f,d,a),QDe(i,f,d,a)}kr==="TB"||kr==="BT"?Ds.set(f.id,{x:d.x,y:d.posWithOffset}):Ds.set(f.id,{x:d.posWithOffset,y:d.y}),a=kr==="BT"&&o?a+cf:a+cf+lf,a>of&&(of=a)})},"drawCommits"),rOe=v((t,e,r,n,i)=>{let s=(kr==="TB"||kr==="BT"?r.xu.branch===s,"isOnBranchToGetCurve"),l=v(u=>u.seq>t.seq&&u.seql(u)&&o(u))},"shouldRerouteArrow"),H2=v((t,e,r=0)=>{let n=t+Math.abs(t-e)/2;if(r>5)return n;if(DT.every(s=>Math.abs(s-n)>=10))return DT.push(n),n;let a=Math.abs(t-e);return H2(t,e-a/5,r+1)},"findLane"),nOe=v((t,e,r,n)=>{let i=Ds.get(e.id),a=Ds.get(r.id);if(i===void 0||a===void 0)throw new Error(`Commit positions not found for commits ${e.id} and ${r.id}`);let s=rOe(e,r,i,a,n),o="",l="",u=0,h=0,f=Ms.get(r.branch)?.index;r.type===nn.MERGE&&e.id!==r.parents[0]&&(f=Ms.get(e.branch)?.index);let d;if(s){o="A 10 10, 0, 0, 0,",l="A 10 10, 0, 0, 1,",u=10,h=10;let p=i.ya.x&&(o="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",u=20,h=20,r.type===nn.MERGE&&e.id!==r.parents[0]?d=`M ${i.x} ${i.y} L ${i.x} ${a.y-u} ${l} ${i.x-h} ${a.y} L ${a.x} ${a.y}`:d=`M ${i.x} ${i.y} L ${a.x+u} ${i.y} ${o} ${a.x} ${i.y+h} L ${a.x} ${a.y}`),i.x===a.x&&(d=`M ${i.x} ${i.y} L ${a.x} ${a.y}`)):kr==="BT"?(i.xa.x&&(o="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",u=20,h=20,r.type===nn.MERGE&&e.id!==r.parents[0]?d=`M ${i.x} ${i.y} L ${i.x} ${a.y+u} ${o} ${i.x-h} ${a.y} L ${a.x} ${a.y}`:d=`M ${i.x} ${i.y} L ${a.x-u} ${i.y} ${o} ${a.x} ${i.y-h} L ${a.x} ${a.y}`),i.x===a.x&&(d=`M ${i.x} ${i.y} L ${a.x} ${a.y}`)):(i.ya.y&&(r.type===nn.MERGE&&e.id!==r.parents[0]?d=`M ${i.x} ${i.y} L ${a.x-u} ${i.y} ${o} ${a.x} ${i.y-h} L ${a.x} ${a.y}`:d=`M ${i.x} ${i.y} L ${i.x} ${a.y+u} ${l} ${i.x+h} ${a.y} L ${a.x} ${a.y}`),i.y===a.y&&(d=`M ${i.x} ${i.y} L ${a.x} ${a.y}`));if(d===void 0)throw new Error("Line definition not found");t.append("path").attr("d",d).attr("class","arrow arrow"+f%p0)},"drawArrow"),iOe=v((t,e)=>{let r=t.append("g").attr("class","commit-arrows");[...e.keys()].forEach(n=>{let i=e.get(n);i.parents&&i.parents.length>0&&i.parents.forEach(a=>{nOe(r,e.get(a),i,e)})})},"drawArrows"),aOe=v((t,e)=>{let r=t.append("g");e.forEach((n,i)=>{let a=i%p0,s=Ms.get(n.name)?.pos;if(s===void 0)throw new Error(`Position not found for branch ${n.name}`);let o=r.append("line");o.attr("x1",0),o.attr("y1",s),o.attr("x2",of),o.attr("y2",s),o.attr("class","branch branch"+a),kr==="TB"?(o.attr("y1",MT),o.attr("x1",s),o.attr("y2",of),o.attr("x2",s)):kr==="BT"&&(o.attr("y1",of),o.attr("x1",s),o.attr("y2",MT),o.attr("x2",s)),DT.push(s);let l=n.name,u=Hle(l),h=r.insert("rect"),d=r.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+a);d.node().appendChild(u);let p=u.getBBox();h.attr("class","branchLabelBkg label"+a).attr("rx",4).attr("ry",4).attr("x",-p.width-4-(Xo?.rotateCommitLabel===!0?30:0)).attr("y",-p.height/2+8).attr("width",p.width+18).attr("height",p.height+4),d.attr("transform","translate("+(-p.width-14-(Xo?.rotateCommitLabel===!0?30:0))+", "+(s-p.height/2-1)+")"),kr==="TB"?(h.attr("x",s-p.width/2-10).attr("y",0),d.attr("transform","translate("+(s-p.width/2-5)+", 0)")):kr==="BT"?(h.attr("x",s-p.width/2-10).attr("y",of),d.attr("transform","translate("+(s-p.width/2-5)+", "+of+")")):h.attr("transform","translate(-19, "+(s-p.height/2)+")")})},"drawBranches"),sOe=v(function(t,e,r,n,i){return Ms.set(t,{pos:e,index:r}),e+=50+(i?40:0)+(kr==="TB"||kr==="BT"?n.width/2:0),e},"setBranchPosition"),oOe=v(function(t,e,r,n){if(VDe(),re.debug("in gitgraph renderer",t+` `,"id:",e,r),!Xo)throw new Error("GitGraph config not found");let i=Xo.rotateCommitLabel??!1,a=n.db;W2=a.getCommits();let s=a.getBranchesAsObjArray();kr=a.getDirection();let o=Ve(`[id="${e}"]`),l=0;s.forEach((u,h)=>{let f=Hle(u.name),d=o.append("g"),p=d.insert("g").attr("class","branchLabel"),g=p.insert("g").attr("class","label branch-label");g.node()?.appendChild(f);let m=f.getBBox();l=sOe(u.name,l,h,m,i),g.remove(),p.remove(),d.remove()}),$le(o,W2,!1),Xo.showBranches&&aOe(o,s),iOe(o,W2),$le(o,W2,!0),Ut.insertTitle(o,"gitTitleText",Xo.titleTopMargin??0,a.getDiagramTitle()),HS(void 0,o,Xo.diagramPadding,Xo.useMaxWidth)},"draw"),lOe={draw:oOe},cOe=v(t=>` .commit-id, .commit-msg, .branch-label { fill: lightgrey; color: lightgrey; font-family: 'trebuchet ms', verdana, arial, sans-serif; font-family: var(--mermaid-font-family); } ${[0,1,2,3,4,5,6,7].map(e=>` .branch-label${e} { fill: ${t["gitBranchLabel"+e]}; } .commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; } .commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; } .label${e} { fill: ${t["git"+e]}; } .arrow${e} { stroke: ${t["git"+e]}; } `).join(` `)} .branch { stroke-width: 1; stroke: ${t.lineColor}; stroke-dasharray: 2; } .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};} .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; } .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};} .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; } .tag-hole { fill: ${t.textColor}; } .commit-merge { stroke: ${t.primaryColor}; fill: ${t.primaryColor}; } .commit-reverse { stroke: ${t.primaryColor}; fill: ${t.primaryColor}; stroke-width: 3; } .commit-highlight-outer { } .commit-highlight-inner { stroke: ${t.primaryColor}; fill: ${t.primaryColor}; } .arrow { stroke-width: 8; stroke-linecap: round; fill: none} .gitTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } `,"getStyles"),uOe=cOe,hOe={parser:GDe,db:Wle,renderer:lOe,styles:uOe}});var jle=di((NI,II)=>{(function(t,e){typeof NI=="object"&&typeof II<"u"?II.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_isoWeek=e()})(NI,function(){"use strict";var t="day";return function(e,r,n){var i=function(o){return o.add(4-o.isoWeekday(),t)},a=r.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add(7*(o-this.isoWeek()),t);var l,u,h,f,d=i(this),p=(l=this.isoWeekYear(),u=this.$u,h=(u?n.utc:n)().year(l).startOf("year"),f=4-h.isoWeekday(),h.isoWeekday()>4&&(f+=7),h.add(f,t));return d.diff(p,"week")+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var s=a.startOf;a.startOf=function(o,l){var u=this.$utils(),h=!!u.u(l)||l;return u.p(o)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(o,l)}}})});var Kle=di((MI,DI)=>{(function(t,e){typeof MI=="object"&&typeof DI<"u"?DI.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(MI,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},o=function(g){return(g=+g)+(g>68?1900:2e3)},l=function(g){return function(m){this[g]=+m}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=function(m){if(!m||m==="Z")return 0;var y=m.match(/([+-]|\d\d)/g),x=60*y[1]+(+y[2]||0);return x===0?0:y[0]==="+"?-x:x}(g)}],h=function(g){var m=s[g];return m&&(m.indexOf?m:m.s.concat(m.f))},f=function(g,m){var y,x=s.meridiem;if(x){for(var b=1;b<=24;b+=1)if(g.indexOf(x(b,0,m))>-1){y=b>12;break}}else y=g===(m?"pm":"PM");return y},d={A:[a,function(g){this.afternoon=f(g,!1)}],a:[a,function(g){this.afternoon=f(g,!0)}],Q:[r,function(g){this.month=3*(g-1)+1}],S:[r,function(g){this.milliseconds=100*+g}],SS:[n,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[i,l("seconds")],ss:[i,l("seconds")],m:[i,l("minutes")],mm:[i,l("minutes")],H:[i,l("hours")],h:[i,l("hours")],HH:[i,l("hours")],hh:[i,l("hours")],D:[i,l("day")],DD:[n,l("day")],Do:[a,function(g){var m=s.ordinal,y=g.match(/\d+/);if(this.day=y[0],m)for(var x=1;x<=31;x+=1)m(x).replace(/\[|\]/g,"")===g&&(this.day=x)}],w:[i,l("week")],ww:[n,l("week")],M:[i,l("month")],MM:[n,l("month")],MMM:[a,function(g){var m=h("months"),y=(h("monthsShort")||m.map(function(x){return x.slice(0,3)})).indexOf(g)+1;if(y<1)throw new Error;this.month=y%12||y}],MMMM:[a,function(g){var m=h("months").indexOf(g)+1;if(m<1)throw new Error;this.month=m%12||m}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(g){this.year=o(g)}],YYYY:[/\d{4}/,l("year")],Z:u,ZZ:u};function p(g){var m,y;m=g,y=s&&s.formats;for(var x=(g=m.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,C,M){var R=M&&M.toUpperCase();return C||y[M]||t[M]||y[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,I,A){return I||A.slice(1)})})).match(e),b=x.length,w=0;w-1)return new Date((N==="X"?1e3:1)*D);var P=p(N)(D),$=P.year,z=P.month,H=P.day,J=P.hours,X=P.minutes,oe=P.seconds,K=P.milliseconds,ee=P.zone,Q=P.week,W=new Date,Y=H||($||z?1:W.getDate()),Z=$||W.getFullYear(),se=0;$&&!z||(se=z>0?z-1:W.getMonth());var ce,ue=J||0,te=X||0,Ne=oe||0,ae=K||0;return ee?new Date(Date.UTC(Z,se,Y,ue,te,Ne,ae+60*ee.offset*1e3)):O?new Date(Date.UTC(Z,se,Y,ue,te,Ne,ae)):(ce=new Date(Z,se,Y,ue,te,Ne,ae),Q&&(ce=B(ce).week(Q).toDate()),ce)}catch{return new Date("")}}(_,L,k,y),this.init(),R&&R!==!0&&(this.$L=this.locale(R).$L),M&&_!=this.format(L)&&(this.$d=new Date("")),s={}}else if(L instanceof Array)for(var T=L.length,I=1;I<=T;I+=1){E[1]=L[I-1];var A=y.apply(this,E);if(A.isValid()){this.$d=A.$d,this.$L=A.$L,this.init();break}I===T&&(this.$d=new Date(""))}else b.call(this,w)}}})});var Zle=di((OI,PI)=>{(function(t,e){typeof OI=="object"&&typeof PI<"u"?PI.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_advancedFormat=e()})(OI,function(){"use strict";return function(t,e){var r=e.prototype,n=r.format;r.format=function(i){var a=this,s=this.$locale();if(!this.isValid())return n.bind(this)(i);var o=this.$utils(),l=(i||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(u){switch(u){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return s.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return s.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),u==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),u==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),u==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return u}});return n.bind(this)(l)}}})});var dce={};vr(dce,{diagram:()=>tPe});function KI(t,e,r){let n=!0;for(;n;)n=!1,r.forEach(function(i){let a="^\\s*"+i+"\\s*$",s=new RegExp(a);t[0].match(s)&&(e[i]=!0,t.shift(1),n=!0)})}var tce,oo,rce,nce,ice,FT,BI,fOe,Qle,Bc,GI,UI,VI,q2,Y2,WI,HI,zT,Em,qI,ace,YI,X2,XI,jI,$T,FI,dOe,pOe,gOe,mOe,vOe,yOe,xOe,bOe,wOe,kOe,TOe,EOe,SOe,COe,AOe,_Oe,LOe,ROe,NOe,IOe,MOe,DOe,OOe,sce,POe,BOe,FOe,oce,zOe,zI,lce,cce,PT,Tm,$Oe,GOe,$I,BT,Ii,uce,UOe,m0,VOe,Jle,WOe,hce,HOe,fce,qOe,YOe,XOe,jOe,ece,KOe,ju,ZOe,QOe,JOe,ePe,tPe,pce=F(()=>{kn();or();tce=Gi(hp(),1),oo=Gi(nb(),1),rce=Gi(jle(),1),nce=Gi(Kle(),1),ice=Gi(Zle(),1),FT=Gi(nb(),1);lr();BI=function(){var t=v(function(I,A,D,N){for(D=D||{},N=I.length;N--;D[I[N]]=A);return D},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],r=[1,26],n=[1,27],i=[1,28],a=[1,29],s=[1,30],o=[1,31],l=[1,32],u=[1,33],h=[1,34],f=[1,9],d=[1,10],p=[1,11],g=[1,12],m=[1,13],y=[1,14],x=[1,15],b=[1,16],w=[1,19],_=[1,20],k=[1,21],E=[1,22],L=[1,23],S=[1,25],C=[1,35],M={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:v(function(A,D,N,O,B,P,$){var z=P.length-1;switch(B){case 1:return P[z-1];case 2:this.$=[];break;case 3:P[z-1].push(P[z]),this.$=P[z-1];break;case 4:case 5:this.$=P[z];break;case 6:case 7:this.$=[];break;case 8:O.setWeekday("monday");break;case 9:O.setWeekday("tuesday");break;case 10:O.setWeekday("wednesday");break;case 11:O.setWeekday("thursday");break;case 12:O.setWeekday("friday");break;case 13:O.setWeekday("saturday");break;case 14:O.setWeekday("sunday");break;case 15:O.setWeekend("friday");break;case 16:O.setWeekend("saturday");break;case 17:O.setDateFormat(P[z].substr(11)),this.$=P[z].substr(11);break;case 18:O.enableInclusiveEndDates(),this.$=P[z].substr(18);break;case 19:O.TopAxis(),this.$=P[z].substr(8);break;case 20:O.setAxisFormat(P[z].substr(11)),this.$=P[z].substr(11);break;case 21:O.setTickInterval(P[z].substr(13)),this.$=P[z].substr(13);break;case 22:O.setExcludes(P[z].substr(9)),this.$=P[z].substr(9);break;case 23:O.setIncludes(P[z].substr(9)),this.$=P[z].substr(9);break;case 24:O.setTodayMarker(P[z].substr(12)),this.$=P[z].substr(12);break;case 27:O.setDiagramTitle(P[z].substr(6)),this.$=P[z].substr(6);break;case 28:this.$=P[z].trim(),O.setAccTitle(this.$);break;case 29:case 30:this.$=P[z].trim(),O.setAccDescription(this.$);break;case 31:O.addSection(P[z].substr(8)),this.$=P[z].substr(8);break;case 33:O.addTask(P[z-1],P[z]),this.$="task";break;case 34:this.$=P[z-1],O.setClickEvent(P[z-1],P[z],null);break;case 35:this.$=P[z-2],O.setClickEvent(P[z-2],P[z-1],P[z]);break;case 36:this.$=P[z-2],O.setClickEvent(P[z-2],P[z-1],null),O.setLink(P[z-2],P[z]);break;case 37:this.$=P[z-3],O.setClickEvent(P[z-3],P[z-2],P[z-1]),O.setLink(P[z-3],P[z]);break;case 38:this.$=P[z-2],O.setClickEvent(P[z-2],P[z],null),O.setLink(P[z-2],P[z-1]);break;case 39:this.$=P[z-3],O.setClickEvent(P[z-3],P[z-1],P[z]),O.setLink(P[z-3],P[z-2]);break;case 40:this.$=P[z-1],O.setLink(P[z-1],P[z]);break;case 41:case 47:this.$=P[z-1]+" "+P[z];break;case 42:case 43:case 45:this.$=P[z-2]+" "+P[z-1]+" "+P[z];break;case 44:case 46:this.$=P[z-3]+" "+P[z-2]+" "+P[z-1]+" "+P[z];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:g,26:m,27:y,28:x,29:b,30:w,31:_,33:k,35:E,36:L,37:24,38:S,40:C},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:r,13:n,14:i,15:a,16:s,17:o,18:l,19:18,20:u,21:h,22:f,23:d,24:p,25:g,26:m,27:y,28:x,29:b,30:w,31:_,33:k,35:E,36:L,37:24,38:S,40:C},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:v(function(A,D){if(D.recoverable)this.trace(A);else{var N=new Error(A);throw N.hash=D,N}},"parseError"),parse:v(function(A){var D=this,N=[0],O=[],B=[null],P=[],$=this.table,z="",H=0,J=0,X=0,oe=2,K=1,ee=P.slice.call(arguments,1),Q=Object.create(this.lexer),W={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(W.yy[Y]=this.yy[Y]);Q.setInput(A,W.yy),W.yy.lexer=Q,W.yy.parser=this,typeof Q.yylloc>"u"&&(Q.yylloc={});var Z=Q.yylloc;P.push(Z);var se=Q.options&&Q.options.ranges;typeof W.yy.parseError=="function"?this.parseError=W.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ce(q){N.length=N.length-2*q,B.length=B.length-q,P.length=P.length-q}v(ce,"popStack");function ue(){var q;return q=O.pop()||Q.lex()||K,typeof q!="number"&&(q instanceof Array&&(O=q,q=O.pop()),q=D.symbols_[q]||q),q}v(ue,"lex");for(var te,Ne,ae,we,Ie,Ee,Oe={},De,We,Re,Pe;;){if(ae=N[N.length-1],this.defaultActions[ae]?we=this.defaultActions[ae]:((te===null||typeof te>"u")&&(te=ue()),we=$[ae]&&$[ae][te]),typeof we>"u"||!we.length||!we[0]){var xe="";Pe=[];for(De in $[ae])this.terminals_[De]&&De>oe&&Pe.push("'"+this.terminals_[De]+"'");Q.showPosition?xe="Parse error on line "+(H+1)+`: `+Q.showPosition()+` Expecting `+Pe.join(", ")+", got '"+(this.terminals_[te]||te)+"'":xe="Parse error on line "+(H+1)+": Unexpected "+(te==K?"end of input":"'"+(this.terminals_[te]||te)+"'"),this.parseError(xe,{text:Q.match,token:this.terminals_[te]||te,line:Q.yylineno,loc:Z,expected:Pe})}if(we[0]instanceof Array&&we.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ae+", token: "+te);switch(we[0]){case 1:N.push(te),B.push(Q.yytext),P.push(Q.yylloc),N.push(we[1]),te=null,Ne?(te=Ne,Ne=null):(J=Q.yyleng,z=Q.yytext,H=Q.yylineno,Z=Q.yylloc,X>0&&X--);break;case 2:if(We=this.productions_[we[1]][1],Oe.$=B[B.length-We],Oe._$={first_line:P[P.length-(We||1)].first_line,last_line:P[P.length-1].last_line,first_column:P[P.length-(We||1)].first_column,last_column:P[P.length-1].last_column},se&&(Oe._$.range=[P[P.length-(We||1)].range[0],P[P.length-1].range[1]]),Ee=this.performAction.apply(Oe,[z,J,H,W.yy,we[1],B,P].concat(ee)),typeof Ee<"u")return Ee;We&&(N=N.slice(0,-1*We*2),B=B.slice(0,-1*We),P=P.slice(0,-1*We)),N.push(this.productions_[we[1]][0]),B.push(Oe.$),P.push(Oe._$),Re=$[N[N.length-2]][N[N.length-1]],N.push(Re);break;case 3:return!0}}return!0},"parse")},R=function(){var I={EOF:1,parseError:v(function(D,N){if(this.yy.parser)this.yy.parser.parseError(D,N);else throw new Error(D)},"parseError"),setInput:v(function(A,D){return this.yy=D||this.yy||{},this._input=A,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var A=this._input[0];this.yytext+=A,this.yyleng++,this.offset++,this.match+=A,this.matched+=A;var D=A.match(/(?:\r\n?|\n).*/g);return D?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),A},"input"),unput:v(function(A){var D=A.length,N=A.split(/(?:\r\n?|\n)/g);this._input=A+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-D),this.offset-=D;var O=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),N.length-1&&(this.yylineno-=N.length-1);var B=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:N?(N.length===O.length?this.yylloc.first_column:0)+O[O.length-N.length].length-N[0].length:this.yylloc.first_column-D},this.options.ranges&&(this.yylloc.range=[B[0],B[0]+this.yyleng-D]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(A){this.unput(this.match.slice(A))},"less"),pastInput:v(function(){var A=this.matched.substr(0,this.matched.length-this.match.length);return(A.length>20?"...":"")+A.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var A=this.match;return A.length<20&&(A+=this._input.substr(0,20-A.length)),(A.substr(0,20)+(A.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var A=this.pastInput(),D=new Array(A.length+1).join("-");return A+this.upcomingInput()+` `+D+"^"},"showPosition"),test_match:v(function(A,D){var N,O,B;if(this.options.backtrack_lexer&&(B={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(B.yylloc.range=this.yylloc.range.slice(0))),O=A[0].match(/(?:\r\n?|\n).*/g),O&&(this.yylineno+=O.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:O?O[O.length-1].length-O[O.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+A[0].length},this.yytext+=A[0],this.match+=A[0],this.matches=A,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(A[0].length),this.matched+=A[0],N=this.performAction.call(this,this.yy,this,D,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),N)return N;if(this._backtrack){for(var P in B)this[P]=B[P];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var A,D,N,O;this._more||(this.yytext="",this.match="");for(var B=this._currentRules(),P=0;PD[0].length)){if(D=N,O=P,this.options.backtrack_lexer){if(A=this.test_match(N,B[P]),A!==!1)return A;if(this._backtrack){D=!1;continue}else return!1}else if(!this.options.flex)break}return D?(A=this.test_match(D,B[O]),A!==!1?A:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var D=this.next();return D||this.lex()},"lex"),begin:v(function(D){this.conditionStack.push(D)},"begin"),popState:v(function(){var D=this.conditionStack.length-1;return D>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(D){return D=this.conditionStack.length-1-Math.abs(D||0),D>=0?this.conditionStack[D]:"INITIAL"},"topState"),pushState:v(function(D){this.begin(D)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(D,N,O,B){var P=B;switch(O){case 0:return this.begin("open_directive"),"open_directive";break;case 1:return this.begin("acc_title"),31;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),33;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:break;case 9:break;case 10:break;case 11:return 10;case 12:break;case 13:break;case 14:this.begin("href");break;case 15:this.popState();break;case 16:return 43;case 17:this.begin("callbackname");break;case 18:this.popState();break;case 19:this.popState(),this.begin("callbackargs");break;case 20:return 41;case 21:this.popState();break;case 22:return 42;case 23:this.begin("click");break;case 24:this.popState();break;case 25:return 40;case 26:return 4;case 27:return 22;case 28:return 23;case 29:return 24;case 30:return 25;case 31:return 26;case 32:return 28;case 33:return 27;case 34:return 29;case 35:return 12;case 36:return 13;case 37:return 14;case 38:return 15;case 39:return 16;case 40:return 17;case 41:return 18;case 42:return 20;case 43:return 21;case 44:return"date";case 45:return 30;case 46:return"accDescription";case 47:return 36;case 48:return 38;case 49:return 39;case 50:return":";case 51:return 6;case 52:return"INVALID"}},"anonymous"),rules:[/^(?:%%\{)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:weekday\s+monday\b)/i,/^(?:weekday\s+tuesday\b)/i,/^(?:weekday\s+wednesday\b)/i,/^(?:weekday\s+thursday\b)/i,/^(?:weekday\s+friday\b)/i,/^(?:weekday\s+saturday\b)/i,/^(?:weekday\s+sunday\b)/i,/^(?:weekend\s+friday\b)/i,/^(?:weekend\s+saturday\b)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^\n]+)/i,/^(?:[^:\n]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},callbackargs:{rules:[21,22],inclusive:!1},callbackname:{rules:[18,19,20],inclusive:!1},href:{rules:[15,16],inclusive:!1},click:{rules:[24,25],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,17,23,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return I}();M.lexer=R;function T(){this.yy={}}return v(T,"Parser"),T.prototype=M,M.Parser=T,new T}();BI.parser=BI;fOe=BI;oo.default.extend(rce.default);oo.default.extend(nce.default);oo.default.extend(ice.default);Qle={friday:5,saturday:6},Bc="",GI="",UI=void 0,VI="",q2=[],Y2=[],WI=new Map,HI=[],zT=[],Em="",qI="",ace=["active","done","crit","milestone"],YI=[],X2=!1,XI=!1,jI="sunday",$T="saturday",FI=0,dOe=v(function(){HI=[],zT=[],Em="",YI=[],PT=0,$I=void 0,BT=void 0,Ii=[],Bc="",GI="",qI="",UI=void 0,VI="",q2=[],Y2=[],X2=!1,XI=!1,FI=0,WI=new Map,xr(),jI="sunday",$T="saturday"},"clear"),pOe=v(function(t){GI=t},"setAxisFormat"),gOe=v(function(){return GI},"getAxisFormat"),mOe=v(function(t){UI=t},"setTickInterval"),vOe=v(function(){return UI},"getTickInterval"),yOe=v(function(t){VI=t},"setTodayMarker"),xOe=v(function(){return VI},"getTodayMarker"),bOe=v(function(t){Bc=t},"setDateFormat"),wOe=v(function(){X2=!0},"enableInclusiveEndDates"),kOe=v(function(){return X2},"endDatesAreInclusive"),TOe=v(function(){XI=!0},"enableTopAxis"),EOe=v(function(){return XI},"topAxisEnabled"),SOe=v(function(t){qI=t},"setDisplayMode"),COe=v(function(){return qI},"getDisplayMode"),AOe=v(function(){return Bc},"getDateFormat"),_Oe=v(function(t){q2=t.toLowerCase().split(/[\s,]+/)},"setIncludes"),LOe=v(function(){return q2},"getIncludes"),ROe=v(function(t){Y2=t.toLowerCase().split(/[\s,]+/)},"setExcludes"),NOe=v(function(){return Y2},"getExcludes"),IOe=v(function(){return WI},"getLinks"),MOe=v(function(t){Em=t,HI.push(t)},"addSection"),DOe=v(function(){return HI},"getSections"),OOe=v(function(){let t=Jle(),e=10,r=0;for(;!t&&r[\d\w- ]+)/.exec(r);if(i!==null){let s=null;for(let l of i.groups.ids.split(" ")){let u=m0(l);u!==void 0&&(!s||u.endTime>s.endTime)&&(s=u)}if(s)return s.endTime;let o=new Date;return o.setHours(0,0,0,0),o}let a=(0,oo.default)(r,e.trim(),!0);if(a.isValid())return a.toDate();{re.debug("Invalid date:"+r),re.debug("With date format:"+e.trim());let s=new Date(r);if(s===void 0||isNaN(s.getTime())||s.getFullYear()<-1e4||s.getFullYear()>1e4)throw new Error("Invalid date:"+r);return s}},"getStartDate"),lce=v(function(t){let e=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());return e!==null?[Number.parseFloat(e[1]),e[2]]:[NaN,"ms"]},"parseDuration"),cce=v(function(t,e,r,n=!1){r=r.trim();let a=/^until\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let h=null;for(let d of a.groups.ids.split(" ")){let p=m0(d);p!==void 0&&(!h||p.startTime{window.open(r,"_self")}),WI.set(n,r))}),hce(t,"clickable")},"setLink"),hce=v(function(t,e){t.split(",").forEach(function(r){let n=m0(r);n!==void 0&&n.classes.push(e)})},"setClass"),HOe=v(function(t,e,r){if(pe().securityLevel!=="loose"||e===void 0)return;let n=[];if(typeof r=="string"){n=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{Ut.runFunc(e,...n)})},"setClickFun"),fce=v(function(t,e){YI.push(function(){let r=document.querySelector(`[id="${t}"]`);r!==null&&r.addEventListener("click",function(){e()})},function(){let r=document.querySelector(`[id="${t}-text"]`);r!==null&&r.addEventListener("click",function(){e()})})},"pushFun"),qOe=v(function(t,e,r){t.split(",").forEach(function(n){HOe(n,e,r)}),hce(t,"clickable")},"setClickEvent"),YOe=v(function(t){YI.forEach(function(e){e(t)})},"bindFunctions"),XOe={getConfig:v(()=>pe().gantt,"getConfig"),clear:dOe,setDateFormat:bOe,getDateFormat:AOe,enableInclusiveEndDates:wOe,endDatesAreInclusive:kOe,enableTopAxis:TOe,topAxisEnabled:EOe,setAxisFormat:pOe,getAxisFormat:gOe,setTickInterval:mOe,getTickInterval:vOe,setTodayMarker:yOe,getTodayMarker:xOe,setAccTitle:Tr,getAccTitle:_r,setDiagramTitle:tn,getDiagramTitle:qr,setDisplayMode:SOe,getDisplayMode:COe,setAccDescription:Lr,getAccDescription:Rr,addSection:MOe,getSections:DOe,getTasks:OOe,addTask:UOe,findTaskById:m0,addTaskOrg:VOe,setIncludes:_Oe,getIncludes:LOe,setExcludes:ROe,getExcludes:NOe,setClickEvent:qOe,setLink:WOe,getLinks:IOe,bindFunctions:YOe,parseDuration:lce,isInvalidDate:sce,setWeekday:POe,getWeekday:BOe,setWeekend:FOe};v(KI,"getTaskTags");jOe=v(function(){re.debug("Something is calling, setConf, remove the call")},"setConf"),ece={monday:wh,tuesday:t3,wednesday:r3,thursday:oc,friday:n3,saturday:i3,sunday:fl},KOe=v((t,e)=>{let r=[...t].map(()=>-1/0),n=[...t].sort((a,s)=>a.startTime-s.startTime||a.order-s.order),i=0;for(let a of n)for(let s=0;s=r[s]){r[s]=a.endTime,a.order=s+e,s>i&&(i=s);break}return i},"getMaxIntersections"),ZOe=v(function(t,e,r,n){let i=pe().gantt,a=pe().securityLevel,s;a==="sandbox"&&(s=Ve("#i"+e));let o=a==="sandbox"?Ve(s.nodes()[0].contentDocument.body):Ve("body"),l=a==="sandbox"?s.nodes()[0].contentDocument:document,u=l.getElementById(e);ju=u.parentElement.offsetWidth,ju===void 0&&(ju=1200),i.useWidth!==void 0&&(ju=i.useWidth);let h=n.db.getTasks(),f=[];for(let S of h)f.push(S.type);f=L(f);let d={},p=2*i.topPadding;if(n.db.getDisplayMode()==="compact"||i.displayMode==="compact"){let S={};for(let M of h)S[M.section]===void 0?S[M.section]=[M]:S[M.section].push(M);let C=0;for(let M of Object.keys(S)){let R=KOe(S[M],C)+1;C+=R,p+=R*(i.barHeight+i.barGap),d[M]=R}}else{p+=h.length*(i.barHeight+i.barGap);for(let S of f)d[S]=h.filter(C=>C.type===S).length}u.setAttribute("viewBox","0 0 "+ju+" "+p);let g=o.select(`[id="${e}"]`),m=o3().domain([d4(h,function(S){return S.startTime}),f4(h,function(S){return S.endTime})]).rangeRound([0,ju-i.leftPadding-i.rightPadding]);function y(S,C){let M=S.startTime,R=C.startTime,T=0;return M>R?T=1:M$.order))].map($=>S.find(z=>z.order===$));g.append("g").selectAll("rect").data(N).enter().append("rect").attr("x",0).attr("y",function($,z){return z=$.order,z*C+M-2}).attr("width",function(){return A-i.rightPadding/2}).attr("height",C).attr("class",function($){for(let[z,H]of f.entries())if($.type===H)return"section section"+z%i.numberSectionStyles;return"section section0"});let O=g.append("g").selectAll("rect").data(S).enter(),B=n.db.getLinks();if(O.append("rect").attr("id",function($){return $.id}).attr("rx",3).attr("ry",3).attr("x",function($){return $.milestone?m($.startTime)+R+.5*(m($.endTime)-m($.startTime))-.5*T:m($.startTime)+R}).attr("y",function($,z){return z=$.order,z*C+M}).attr("width",function($){return $.milestone?T:m($.renderEndTime||$.endTime)-m($.startTime)}).attr("height",T).attr("transform-origin",function($,z){return z=$.order,(m($.startTime)+R+.5*(m($.endTime)-m($.startTime))).toString()+"px "+(z*C+M+.5*T).toString()+"px"}).attr("class",function($){let z="task",H="";$.classes.length>0&&(H=$.classes.join(" "));let J=0;for(let[oe,K]of f.entries())$.type===K&&(J=oe%i.numberSectionStyles);let X="";return $.active?$.crit?X+=" activeCrit":X=" active":$.done?$.crit?X=" doneCrit":X=" done":$.crit&&(X+=" crit"),X.length===0&&(X=" task"),$.milestone&&(X=" milestone "+X),X+=J,X+=" "+H,z+X}),O.append("text").attr("id",function($){return $.id+"-text"}).text(function($){return $.task}).attr("font-size",i.fontSize).attr("x",function($){let z=m($.startTime),H=m($.renderEndTime||$.endTime);$.milestone&&(z+=.5*(m($.endTime)-m($.startTime))-.5*T),$.milestone&&(H=z+T);let J=this.getBBox().width;return J>H-z?H+J+1.5*i.leftPadding>A?z+R-5:H+R+5:(H-z)/2+z+R}).attr("y",function($,z){return z=$.order,z*C+i.barHeight/2+(i.fontSize/2-2)+M}).attr("text-height",T).attr("class",function($){let z=m($.startTime),H=m($.endTime);$.milestone&&(H=z+T);let J=this.getBBox().width,X="";$.classes.length>0&&(X=$.classes.join(" "));let oe=0;for(let[ee,Q]of f.entries())$.type===Q&&(oe=ee%i.numberSectionStyles);let K="";return $.active&&($.crit?K="activeCritText"+oe:K="activeText"+oe),$.done?$.crit?K=K+" doneCritText"+oe:K=K+" doneText"+oe:$.crit&&(K=K+" critText"+oe),$.milestone&&(K+=" milestoneText"),J>H-z?H+J+1.5*i.leftPadding>A?X+" taskTextOutsideLeft taskTextOutside"+oe+" "+K:X+" taskTextOutsideRight taskTextOutside"+oe+" "+K+" width-"+J:X+" taskText taskText"+oe+" "+K+" width-"+J}),pe().securityLevel==="sandbox"){let $;$=Ve("#i"+e);let z=$.nodes()[0].contentDocument;O.filter(function(H){return B.has(H.id)}).each(function(H){var J=z.querySelector("#"+H.id),X=z.querySelector("#"+H.id+"-text");let oe=J.parentNode;var K=z.createElement("a");K.setAttribute("xlink:href",B.get(H.id)),K.setAttribute("target","_top"),oe.appendChild(K),K.appendChild(J),K.appendChild(X)})}}v(b,"drawRects");function w(S,C,M,R,T,I,A,D){if(A.length===0&&D.length===0)return;let N,O;for(let{startTime:J,endTime:X}of I)(N===void 0||JO)&&(O=X);if(!N||!O)return;if((0,FT.default)(O).diff((0,FT.default)(N),"year")>5){re.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");return}let B=n.db.getDateFormat(),P=[],$=null,z=(0,FT.default)(N);for(;z.valueOf()<=O;)n.db.isInvalidDate(z,B,A,D)?$?$.end=z:$={start:z,end:z}:$&&(P.push($),$=null),z=z.add(1,"d");g.append("g").selectAll("rect").data(P).enter().append("rect").attr("id",function(J){return"exclude-"+J.start.format("YYYY-MM-DD")}).attr("x",function(J){return m(J.start)+M}).attr("y",i.gridLineStartPadding).attr("width",function(J){let X=J.end.add(1,"day");return m(X)-m(J.start)}).attr("height",T-C-i.gridLineStartPadding).attr("transform-origin",function(J,X){return(m(J.start)+M+.5*(m(J.end)-m(J.start))).toString()+"px "+(X*S+.5*T).toString()+"px"}).attr("class","exclude-range")}v(w,"drawExcludeDays");function _(S,C,M,R){let T=MC(m).tickSize(-R+C+i.gridLineStartPadding).tickFormat(cd(n.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d")),A=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(n.db.getTickInterval()||i.tickInterval);if(A!==null){let D=A[1],N=A[2],O=n.db.getWeekday()||i.weekday;switch(N){case"millisecond":T.ticks(ac.every(D));break;case"second":T.ticks(Ws.every(D));break;case"minute":T.ticks(gu.every(D));break;case"hour":T.ticks(mu.every(D));break;case"day":T.ticks(wo.every(D));break;case"week":T.ticks(ece[O].every(D));break;case"month":T.ticks(vu.every(D));break}}if(g.append("g").attr("class","grid").attr("transform","translate("+S+", "+(R-50)+")").call(T).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),n.db.topAxisEnabled()||i.topAxis){let D=IC(m).tickSize(-R+C+i.gridLineStartPadding).tickFormat(cd(n.db.getAxisFormat()||i.axisFormat||"%Y-%m-%d"));if(A!==null){let N=A[1],O=A[2],B=n.db.getWeekday()||i.weekday;switch(O){case"millisecond":D.ticks(ac.every(N));break;case"second":D.ticks(Ws.every(N));break;case"minute":D.ticks(gu.every(N));break;case"hour":D.ticks(mu.every(N));break;case"day":D.ticks(wo.every(N));break;case"week":D.ticks(ece[B].every(N));break;case"month":D.ticks(vu.every(N));break}}g.append("g").attr("class","grid").attr("transform","translate("+S+", "+C+")").call(D).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}v(_,"makeGrid");function k(S,C){let M=0,R=Object.keys(d).map(T=>[T,d[T]]);g.append("g").selectAll("text").data(R).enter().append(function(T){let I=T[0].split(Xe.lineBreakRegex),A=-(I.length-1)/2,D=l.createElementNS("http://www.w3.org/2000/svg","text");D.setAttribute("dy",A+"em");for(let[N,O]of I.entries()){let B=l.createElementNS("http://www.w3.org/2000/svg","tspan");B.setAttribute("alignment-baseline","central"),B.setAttribute("x","10"),N>0&&B.setAttribute("dy","1em"),B.textContent=O,D.appendChild(B)}return D}).attr("x",10).attr("y",function(T,I){if(I>0)for(let A=0;A` .mermaid-main-font { font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif); } .exclude-range { fill: ${t.excludeBkgColor}; } .section { stroke: none; opacity: 0.2; } .section0 { fill: ${t.sectionBkgColor}; } .section2 { fill: ${t.sectionBkgColor2}; } .section1, .section3 { fill: ${t.altSectionBkgColor}; opacity: 0.2; } .sectionTitle0 { fill: ${t.titleColor}; } .sectionTitle1 { fill: ${t.titleColor}; } .sectionTitle2 { fill: ${t.titleColor}; } .sectionTitle3 { fill: ${t.titleColor}; } .sectionTitle { text-anchor: start; font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif); } /* Grid and axis */ .grid .tick { stroke: ${t.gridColor}; opacity: 0.8; shape-rendering: crispEdges; } .grid .tick text { font-family: ${t.fontFamily}; fill: ${t.textColor}; } .grid path { stroke-width: 0; } /* Today line */ .today { fill: none; stroke: ${t.todayLineColor}; stroke-width: 2px; } /* Task styling */ /* Default task */ .task { stroke-width: 2; } .taskText { text-anchor: middle; font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif); } .taskTextOutsideRight { fill: ${t.taskTextDarkColor}; text-anchor: start; font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif); } .taskTextOutsideLeft { fill: ${t.taskTextDarkColor}; text-anchor: end; } /* Special case clickable */ .task.clickable { cursor: pointer; } .taskText.clickable { cursor: pointer; fill: ${t.taskTextClickableColor} !important; font-weight: bold; } .taskTextOutsideLeft.clickable { cursor: pointer; fill: ${t.taskTextClickableColor} !important; font-weight: bold; } .taskTextOutsideRight.clickable { cursor: pointer; fill: ${t.taskTextClickableColor} !important; font-weight: bold; } /* Specific task settings for the sections*/ .taskText0, .taskText1, .taskText2, .taskText3 { fill: ${t.taskTextColor}; } .task0, .task1, .task2, .task3 { fill: ${t.taskBkgColor}; stroke: ${t.taskBorderColor}; } .taskTextOutside0, .taskTextOutside2 { fill: ${t.taskTextOutsideColor}; } .taskTextOutside1, .taskTextOutside3 { fill: ${t.taskTextOutsideColor}; } /* Active task */ .active0, .active1, .active2, .active3 { fill: ${t.activeTaskBkgColor}; stroke: ${t.activeTaskBorderColor}; } .activeText0, .activeText1, .activeText2, .activeText3 { fill: ${t.taskTextDarkColor} !important; } /* Completed task */ .done0, .done1, .done2, .done3 { stroke: ${t.doneTaskBorderColor}; fill: ${t.doneTaskBkgColor}; stroke-width: 2; } .doneText0, .doneText1, .doneText2, .doneText3 { fill: ${t.taskTextDarkColor} !important; } /* Tasks on the critical line */ .crit0, .crit1, .crit2, .crit3 { stroke: ${t.critBorderColor}; fill: ${t.critBkgColor}; stroke-width: 2; } .activeCrit0, .activeCrit1, .activeCrit2, .activeCrit3 { stroke: ${t.critBorderColor}; fill: ${t.activeTaskBkgColor}; stroke-width: 2; } .doneCrit0, .doneCrit1, .doneCrit2, .doneCrit3 { stroke: ${t.critBorderColor}; fill: ${t.doneTaskBkgColor}; stroke-width: 2; cursor: pointer; shape-rendering: crispEdges; } .milestone { transform: rotate(45deg) scale(0.8,0.8); } .milestoneText { font-style: italic; } .doneCritText0, .doneCritText1, .doneCritText2, .doneCritText3 { fill: ${t.taskTextDarkColor} !important; } .activeCritText0, .activeCritText1, .activeCritText2, .activeCritText3 { fill: ${t.taskTextDarkColor} !important; } .titleText { text-anchor: middle; font-size: 18px; fill: ${t.titleColor||t.textColor}; font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif); } `,"getStyles"),ePe=JOe,tPe={parser:fOe,db:XOe,renderer:QOe,styles:ePe}});var gce={};vr(gce,{diagram:()=>lPe});var rPe,nPe,iPe,aPe,sPe,oPe,lPe,mce=F(()=>{o9();Iu();or();km();rPe={parse:v(async t=>{let e=await Nl("info",t);re.debug(e)},"parse")},nPe={version:dy},iPe=v(()=>nPe.version,"getVersion"),aPe={getVersion:iPe},sPe=v((t,e,r)=>{re.debug(`rendering info diagram `+t);let n=La(e);Hr(n,100,400,!0),n.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${r}`)},"draw"),oPe={draw:sPe},lPe={parser:rPe,db:aPe,renderer:oPe}});var xce={};vr(xce,{diagram:()=>TPe});var vce,ZI,GT,QI,cPe,uPe,hPe,fPe,dPe,pPe,gPe,yce,mPe,vPe,yPe,xPe,bPe,wPe,kPe,TPe,bce=F(()=>{ky();kn();Iu();or();km();lr();vce=sr.pie,ZI={sections:new Map,showData:!1,config:vce},GT=ZI.sections,QI=ZI.showData,cPe=structuredClone(vce),uPe=v(()=>structuredClone(cPe),"getConfig"),hPe=v(()=>{GT=new Map,QI=ZI.showData,xr()},"clear"),fPe=v(({label:t,value:e})=>{GT.has(t)||(GT.set(t,e),re.debug(`added new section: ${t}, with value: ${e}`))},"addSection"),dPe=v(()=>GT,"getSections"),pPe=v(t=>{QI=t},"setShowData"),gPe=v(()=>QI,"getShowData"),yce={getConfig:uPe,clear:hPe,setDiagramTitle:tn,getDiagramTitle:qr,setAccTitle:Tr,getAccTitle:_r,setAccDescription:Lr,getAccDescription:Rr,addSection:fPe,getSections:dPe,setShowData:pPe,getShowData:gPe},mPe=v((t,e)=>{Pu(t,e),e.setShowData(t.showData),t.sections.map(e.addSection)},"populateDb"),vPe={parse:v(async t=>{let e=await Nl("pie",t);re.debug(e),mPe(e,yce)},"parse")},yPe=v(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; opacity : ${t.pieOpacity}; } .pieOuterCircle{ stroke: ${t.pieOuterStrokeColor}; stroke-width: ${t.pieOuterStrokeWidth}; fill: none; } .pieTitleText { text-anchor: middle; font-size: ${t.pieTitleTextSize}; fill: ${t.pieTitleTextColor}; font-family: ${t.fontFamily}; } .slice { font-family: ${t.fontFamily}; fill: ${t.pieSectionTextColor}; font-size:${t.pieSectionTextSize}; // fill: white; } .legend text { fill: ${t.pieLegendTextColor}; font-family: ${t.fontFamily}; font-size: ${t.pieLegendTextSize}; } `,"getStyles"),xPe=yPe,bPe=v(t=>{let e=[...t.entries()].map(n=>({label:n[0],value:n[1]})).sort((n,i)=>i.value-n.value);return h8().value(n=>n.value)(e)},"createPieArcs"),wPe=v((t,e,r,n)=>{re.debug(`rendering pie chart `+t);let i=n.db,a=pe(),s=ws(i.getConfig(),a.pie),o=40,l=18,u=4,h=450,f=h,d=La(e),p=d.append("g");p.attr("transform","translate("+f/2+","+h/2+")");let{themeVariables:g}=a,[m]=Ro(g.pieOuterStrokeWidth);m??=2;let y=s.textPosition,x=Math.min(f,h)/2-o,b=lc().innerRadius(0).outerRadius(x),w=lc().innerRadius(x*y).outerRadius(x*y);p.append("circle").attr("cx",0).attr("cy",0).attr("r",x+m/2).attr("class","pieOuterCircle");let _=i.getSections(),k=bPe(_),E=[g.pie1,g.pie2,g.pie3,g.pie4,g.pie5,g.pie6,g.pie7,g.pie8,g.pie9,g.pie10,g.pie11,g.pie12],L=du(E);p.selectAll("mySlices").data(k).enter().append("path").attr("d",b).attr("fill",T=>L(T.data.label)).attr("class","pieCircle");let S=0;_.forEach(T=>{S+=T}),p.selectAll("mySlices").data(k).enter().append("text").text(T=>(T.data.value/S*100).toFixed(0)+"%").attr("transform",T=>"translate("+w.centroid(T)+")").style("text-anchor","middle").attr("class","slice"),p.append("text").text(i.getDiagramTitle()).attr("x",0).attr("y",-(h-50)/2).attr("class","pieTitleText");let C=p.selectAll(".legend").data(L.domain()).enter().append("g").attr("class","legend").attr("transform",(T,I)=>{let A=l+u,D=A*L.domain().length/2,N=12*l,O=I*A-D;return"translate("+N+","+O+")"});C.append("rect").attr("width",l).attr("height",l).style("fill",L).style("stroke",L),C.data(k).append("text").attr("x",l+u).attr("y",l-u).text(T=>{let{label:I,value:A}=T.data;return i.getShowData()?`${I} [${A}]`:I});let M=Math.max(...C.selectAll("text").nodes().map(T=>T?.getBoundingClientRect().width??0)),R=f+o+l+u+M;d.attr("viewBox",`0 0 ${R} ${h}`),Hr(d,h,R,s.useMaxWidth)},"draw"),kPe={draw:wPe},TPe={parser:vPe,db:yce,renderer:kPe,styles:xPe}});var Pce={};vr(Pce,{diagram:()=>NPe});function eM(t){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t)}function wce(t){return!/^\d+$/.test(t)}function kce(t){return!/^\d+px$/.test(t)}function Fc(t){return yr(t.trim(),CPe)}function Tce(t){ma.setData({quadrant1Text:Fc(t.text)})}function Ece(t){ma.setData({quadrant2Text:Fc(t.text)})}function Sce(t){ma.setData({quadrant3Text:Fc(t.text)})}function Cce(t){ma.setData({quadrant4Text:Fc(t.text)})}function Ace(t){ma.setData({xAxisLeftText:Fc(t.text)})}function _ce(t){ma.setData({xAxisRightText:Fc(t.text)})}function Lce(t){ma.setData({yAxisTopText:Fc(t.text)})}function Rce(t){ma.setData({yAxisBottomText:Fc(t.text)})}function VT(t){let e={};for(let r of t){let[n,i]=r.trim().split(/\s*:\s*/);if(n==="radius"){if(wce(i))throw new UT(n,i,"number");e.radius=parseInt(i)}else if(n==="color"){if(eM(i))throw new UT(n,i,"hex code");e.color=i}else if(n==="stroke-color"){if(eM(i))throw new UT(n,i,"hex code");e.strokeColor=i}else if(n==="stroke-width"){if(kce(i))throw new UT(n,i,"number of pixels (eg. 10px)");e.strokeWidth=i}else throw new Error(`style named ${n} is not supported.`)}return e}function Nce(t,e,r,n,i){let a=VT(i);ma.addPoints([{x:r,y:n,text:Fc(t.text),className:e,...a}])}function Ice(t,e){ma.addClass(t,VT(e))}function Mce(t){ma.setConfig({chartWidth:t})}function Dce(t){ma.setConfig({chartHeight:t})}function Oce(){let t=pe(),{themeVariables:e,quadrantChart:r}=t;return r&&ma.setConfig(r),ma.setThemeConfig({quadrant1Fill:e.quadrant1Fill,quadrant2Fill:e.quadrant2Fill,quadrant3Fill:e.quadrant3Fill,quadrant4Fill:e.quadrant4Fill,quadrant1TextFill:e.quadrant1TextFill,quadrant2TextFill:e.quadrant2TextFill,quadrant3TextFill:e.quadrant3TextFill,quadrant4TextFill:e.quadrant4TextFill,quadrantPointFill:e.quadrantPointFill,quadrantPointTextFill:e.quadrantPointTextFill,quadrantXAxisTextFill:e.quadrantXAxisTextFill,quadrantYAxisTextFill:e.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:e.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:e.quadrantInternalBorderStrokeFill,quadrantTitleFill:e.quadrantTitleFill}),ma.setData({titleText:qr()}),ma.build()}var JI,EPe,as,SPe,UT,CPe,ma,APe,_Pe,LPe,RPe,NPe,Bce=F(()=>{or();lr();lr();JI=function(){var t=v(function(ke,j,ye,Ae){for(ye=ye||{},Ae=ke.length;Ae--;ye[ke[Ae]]=j);return ye},"o"),e=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[1,7],s=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],o=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[55,56,57],u=[2,36],h=[1,37],f=[1,36],d=[1,38],p=[1,35],g=[1,43],m=[1,41],y=[1,14],x=[1,23],b=[1,18],w=[1,19],_=[1,20],k=[1,21],E=[1,22],L=[1,24],S=[1,25],C=[1,26],M=[1,27],R=[1,28],T=[1,29],I=[1,32],A=[1,33],D=[1,34],N=[1,39],O=[1,40],B=[1,42],P=[1,44],$=[1,62],z=[1,61],H=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],J=[1,65],X=[1,66],oe=[1,67],K=[1,68],ee=[1,69],Q=[1,70],W=[1,71],Y=[1,72],Z=[1,73],se=[1,74],ce=[1,75],ue=[1,76],te=[4,5,6,7,8,9,10,11,12,13,14,15,18],Ne=[1,90],ae=[1,91],we=[1,92],Ie=[1,99],Ee=[1,93],Oe=[1,96],De=[1,94],We=[1,95],Re=[1,97],Pe=[1,98],xe=[1,102],q=[10,55,56,57],de=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],ie={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:v(function(j,ye,Ae,Ge,Fe,ge,$e){var Ce=ge.length-1;switch(Fe){case 23:this.$=ge[Ce];break;case 24:this.$=ge[Ce-1]+""+ge[Ce];break;case 26:this.$=ge[Ce-1]+ge[Ce];break;case 27:this.$=[ge[Ce].trim()];break;case 28:ge[Ce-2].push(ge[Ce].trim()),this.$=ge[Ce-2];break;case 29:this.$=ge[Ce-4],Ge.addClass(ge[Ce-2],ge[Ce]);break;case 37:this.$=[];break;case 42:this.$=ge[Ce].trim(),Ge.setDiagramTitle(this.$);break;case 43:this.$=ge[Ce].trim(),Ge.setAccTitle(this.$);break;case 44:case 45:this.$=ge[Ce].trim(),Ge.setAccDescription(this.$);break;case 46:Ge.addSection(ge[Ce].substr(8)),this.$=ge[Ce].substr(8);break;case 47:Ge.addPoint(ge[Ce-3],"",ge[Ce-1],ge[Ce],[]);break;case 48:Ge.addPoint(ge[Ce-4],ge[Ce-3],ge[Ce-1],ge[Ce],[]);break;case 49:Ge.addPoint(ge[Ce-4],"",ge[Ce-2],ge[Ce-1],ge[Ce]);break;case 50:Ge.addPoint(ge[Ce-5],ge[Ce-4],ge[Ce-2],ge[Ce-1],ge[Ce]);break;case 51:Ge.setXAxisLeftText(ge[Ce-2]),Ge.setXAxisRightText(ge[Ce]);break;case 52:ge[Ce-1].text+=" \u27F6 ",Ge.setXAxisLeftText(ge[Ce-1]);break;case 53:Ge.setXAxisLeftText(ge[Ce]);break;case 54:Ge.setYAxisBottomText(ge[Ce-2]),Ge.setYAxisTopText(ge[Ce]);break;case 55:ge[Ce-1].text+=" \u27F6 ",Ge.setYAxisBottomText(ge[Ce-1]);break;case 56:Ge.setYAxisBottomText(ge[Ce]);break;case 57:Ge.setQuadrant1Text(ge[Ce]);break;case 58:Ge.setQuadrant2Text(ge[Ce]);break;case 59:Ge.setQuadrant3Text(ge[Ce]);break;case 60:Ge.setQuadrant4Text(ge[Ce]);break;case 64:this.$={text:ge[Ce],type:"text"};break;case 65:this.$={text:ge[Ce-1].text+""+ge[Ce],type:ge[Ce-1].type};break;case 66:this.$={text:ge[Ce],type:"text"};break;case 67:this.$={text:ge[Ce],type:"markdown"};break;case 68:this.$=ge[Ce];break;case 69:this.$=ge[Ce-1]+""+ge[Ce];break}},"anonymous"),table:[{18:e,26:1,27:2,28:r,55:n,56:i,57:a},{1:[3]},{18:e,26:8,27:2,28:r,55:n,56:i,57:a},{18:e,26:9,27:2,28:r,55:n,56:i,57:a},t(s,[2,33],{29:10}),t(o,[2,61]),t(o,[2,62]),t(o,[2,63]),{1:[2,30]},{1:[2,31]},t(l,u,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:h,5:f,10:d,12:p,13:g,14:m,18:y,25:x,35:b,37:w,39:_,41:k,42:E,48:L,50:S,51:C,52:M,53:R,54:T,60:I,61:A,63:D,64:N,65:O,66:B,67:P}),t(s,[2,34]),{27:45,55:n,56:i,57:a},t(l,[2,37]),t(l,u,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:h,5:f,10:d,12:p,13:g,14:m,18:y,25:x,35:b,37:w,39:_,41:k,42:E,48:L,50:S,51:C,52:M,53:R,54:T,60:I,61:A,63:D,64:N,65:O,66:B,67:P}),t(l,[2,39]),t(l,[2,40]),t(l,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(l,[2,45]),t(l,[2,46]),{18:[1,50]},{4:h,5:f,10:d,12:p,13:g,14:m,43:51,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,10:d,12:p,13:g,14:m,43:52,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,10:d,12:p,13:g,14:m,43:53,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,10:d,12:p,13:g,14:m,43:54,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,10:d,12:p,13:g,14:m,43:55,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,10:d,12:p,13:g,14:m,43:56,58:31,60:I,61:A,63:D,64:N,65:O,66:B,67:P},{4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,44:[1,57],47:[1,58],58:60,59:59,63:D,64:N,65:O,66:B,67:P},t(H,[2,64]),t(H,[2,66]),t(H,[2,67]),t(H,[2,70]),t(H,[2,71]),t(H,[2,72]),t(H,[2,73]),t(H,[2,74]),t(H,[2,75]),t(H,[2,76]),t(H,[2,77]),t(H,[2,78]),t(H,[2,79]),t(H,[2,80]),t(s,[2,35]),t(l,[2,38]),t(l,[2,42]),t(l,[2,43]),t(l,[2,44]),{3:64,4:J,5:X,6:oe,7:K,8:ee,9:Q,10:W,11:Y,12:Z,13:se,14:ce,15:ue,21:63},t(l,[2,53],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,49:[1,77],63:D,64:N,65:O,66:B,67:P}),t(l,[2,56],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,49:[1,78],63:D,64:N,65:O,66:B,67:P}),t(l,[2,57],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),t(l,[2,58],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),t(l,[2,59],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),t(l,[2,60],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),{45:[1,79]},{44:[1,80]},t(H,[2,65]),t(H,[2,81]),t(H,[2,82]),t(H,[2,83]),{3:82,4:J,5:X,6:oe,7:K,8:ee,9:Q,10:W,11:Y,12:Z,13:se,14:ce,15:ue,18:[1,81]},t(te,[2,23]),t(te,[2,1]),t(te,[2,2]),t(te,[2,3]),t(te,[2,4]),t(te,[2,5]),t(te,[2,6]),t(te,[2,7]),t(te,[2,8]),t(te,[2,9]),t(te,[2,10]),t(te,[2,11]),t(te,[2,12]),t(l,[2,52],{58:31,43:83,4:h,5:f,10:d,12:p,13:g,14:m,60:I,61:A,63:D,64:N,65:O,66:B,67:P}),t(l,[2,55],{58:31,43:84,4:h,5:f,10:d,12:p,13:g,14:m,60:I,61:A,63:D,64:N,65:O,66:B,67:P}),{46:[1,85]},{45:[1,86]},{4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,16:89,17:De,18:We,19:Re,20:Pe,22:88,23:87},t(te,[2,24]),t(l,[2,51],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),t(l,[2,54],{59:59,58:60,4:h,5:f,8:$,10:d,12:p,13:g,14:m,18:z,63:D,64:N,65:O,66:B,67:P}),t(l,[2,47],{22:88,16:89,23:100,4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,17:De,18:We,19:Re,20:Pe}),{46:[1,101]},t(l,[2,29],{10:xe}),t(q,[2,27],{16:103,4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,17:De,18:We,19:Re,20:Pe}),t(de,[2,25]),t(de,[2,13]),t(de,[2,14]),t(de,[2,15]),t(de,[2,16]),t(de,[2,17]),t(de,[2,18]),t(de,[2,19]),t(de,[2,20]),t(de,[2,21]),t(de,[2,22]),t(l,[2,49],{10:xe}),t(l,[2,48],{22:88,16:89,23:104,4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,17:De,18:We,19:Re,20:Pe}),{4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,16:89,17:De,18:We,19:Re,20:Pe,22:105},t(de,[2,26]),t(l,[2,50],{10:xe}),t(q,[2,28],{16:103,4:Ne,5:ae,6:we,8:Ie,11:Ee,13:Oe,17:De,18:We,19:Re,20:Pe})],defaultActions:{8:[2,30],9:[2,31]},parseError:v(function(j,ye){if(ye.recoverable)this.trace(j);else{var Ae=new Error(j);throw Ae.hash=ye,Ae}},"parseError"),parse:v(function(j){var ye=this,Ae=[0],Ge=[],Fe=[null],ge=[],$e=this.table,Ce="",qe=0,lt=0,xt=0,ft=2,Ze=1,st=ge.slice.call(arguments,1),Ue=Object.create(this.lexer),Ke={yy:{}};for(var it in this.yy)Object.prototype.hasOwnProperty.call(this.yy,it)&&(Ke.yy[it]=this.yy[it]);Ue.setInput(j,Ke.yy),Ke.yy.lexer=Ue,Ke.yy.parser=this,typeof Ue.yylloc>"u"&&(Ue.yylloc={});var mt=Ue.yylloc;ge.push(mt);var Ht=Ue.options&&Ue.options.ranges;typeof Ke.yy.parseError=="function"?this.parseError=Ke.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ot(Vr){Ae.length=Ae.length-2*Vr,Fe.length=Fe.length-Vr,ge.length=ge.length-Vr}v(ot,"popStack");function et(){var Vr;return Vr=Ge.pop()||Ue.lex()||Ze,typeof Vr!="number"&&(Vr instanceof Array&&(Ge=Vr,Vr=Ge.pop()),Vr=ye.symbols_[Vr]||Vr),Vr}v(et,"lex");for(var ht,bt,tt,_t,ur,Qt,Jt={},en,Cr,Kn,cn;;){if(tt=Ae[Ae.length-1],this.defaultActions[tt]?_t=this.defaultActions[tt]:((ht===null||typeof ht>"u")&&(ht=et()),_t=$e[tt]&&$e[tt][ht]),typeof _t>"u"||!_t.length||!_t[0]){var Rn="";cn=[];for(en in $e[tt])this.terminals_[en]&&en>ft&&cn.push("'"+this.terminals_[en]+"'");Ue.showPosition?Rn="Parse error on line "+(qe+1)+`: `+Ue.showPosition()+` Expecting `+cn.join(", ")+", got '"+(this.terminals_[ht]||ht)+"'":Rn="Parse error on line "+(qe+1)+": Unexpected "+(ht==Ze?"end of input":"'"+(this.terminals_[ht]||ht)+"'"),this.parseError(Rn,{text:Ue.match,token:this.terminals_[ht]||ht,line:Ue.yylineno,loc:mt,expected:cn})}if(_t[0]instanceof Array&&_t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+tt+", token: "+ht);switch(_t[0]){case 1:Ae.push(ht),Fe.push(Ue.yytext),ge.push(Ue.yylloc),Ae.push(_t[1]),ht=null,bt?(ht=bt,bt=null):(lt=Ue.yyleng,Ce=Ue.yytext,qe=Ue.yylineno,mt=Ue.yylloc,xt>0&&xt--);break;case 2:if(Cr=this.productions_[_t[1]][1],Jt.$=Fe[Fe.length-Cr],Jt._$={first_line:ge[ge.length-(Cr||1)].first_line,last_line:ge[ge.length-1].last_line,first_column:ge[ge.length-(Cr||1)].first_column,last_column:ge[ge.length-1].last_column},Ht&&(Jt._$.range=[ge[ge.length-(Cr||1)].range[0],ge[ge.length-1].range[1]]),Qt=this.performAction.apply(Jt,[Ce,lt,qe,Ke.yy,_t[1],Fe,ge].concat(st)),typeof Qt<"u")return Qt;Cr&&(Ae=Ae.slice(0,-1*Cr*2),Fe=Fe.slice(0,-1*Cr),ge=ge.slice(0,-1*Cr)),Ae.push(this.productions_[_t[1]][0]),Fe.push(Jt.$),ge.push(Jt._$),Kn=$e[Ae[Ae.length-2]][Ae[Ae.length-1]],Ae.push(Kn);break;case 3:return!0}}return!0},"parse")},he=function(){var ke={EOF:1,parseError:v(function(ye,Ae){if(this.yy.parser)this.yy.parser.parseError(ye,Ae);else throw new Error(ye)},"parseError"),setInput:v(function(j,ye){return this.yy=ye||this.yy||{},this._input=j,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var j=this._input[0];this.yytext+=j,this.yyleng++,this.offset++,this.match+=j,this.matched+=j;var ye=j.match(/(?:\r\n?|\n).*/g);return ye?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),j},"input"),unput:v(function(j){var ye=j.length,Ae=j.split(/(?:\r\n?|\n)/g);this._input=j+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-ye),this.offset-=ye;var Ge=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Ae.length-1&&(this.yylineno-=Ae.length-1);var Fe=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Ae?(Ae.length===Ge.length?this.yylloc.first_column:0)+Ge[Ge.length-Ae.length].length-Ae[0].length:this.yylloc.first_column-ye},this.options.ranges&&(this.yylloc.range=[Fe[0],Fe[0]+this.yyleng-ye]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(j){this.unput(this.match.slice(j))},"less"),pastInput:v(function(){var j=this.matched.substr(0,this.matched.length-this.match.length);return(j.length>20?"...":"")+j.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var j=this.match;return j.length<20&&(j+=this._input.substr(0,20-j.length)),(j.substr(0,20)+(j.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var j=this.pastInput(),ye=new Array(j.length+1).join("-");return j+this.upcomingInput()+` `+ye+"^"},"showPosition"),test_match:v(function(j,ye){var Ae,Ge,Fe;if(this.options.backtrack_lexer&&(Fe={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Fe.yylloc.range=this.yylloc.range.slice(0))),Ge=j[0].match(/(?:\r\n?|\n).*/g),Ge&&(this.yylineno+=Ge.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Ge?Ge[Ge.length-1].length-Ge[Ge.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+j[0].length},this.yytext+=j[0],this.match+=j[0],this.matches=j,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(j[0].length),this.matched+=j[0],Ae=this.performAction.call(this,this.yy,this,ye,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Ae)return Ae;if(this._backtrack){for(var ge in Fe)this[ge]=Fe[ge];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var j,ye,Ae,Ge;this._more||(this.yytext="",this.match="");for(var Fe=this._currentRules(),ge=0;geye[0].length)){if(ye=Ae,Ge=ge,this.options.backtrack_lexer){if(j=this.test_match(Ae,Fe[ge]),j!==!1)return j;if(this._backtrack){ye=!1;continue}else return!1}else if(!this.options.flex)break}return ye?(j=this.test_match(ye,Fe[Ge]),j!==!1?j:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var ye=this.next();return ye||this.lex()},"lex"),begin:v(function(ye){this.conditionStack.push(ye)},"begin"),popState:v(function(){var ye=this.conditionStack.length-1;return ye>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(ye){return ye=this.conditionStack.length-1-Math.abs(ye||0),ye>=0?this.conditionStack[ye]:"INITIAL"},"topState"),pushState:v(function(ye){this.begin(ye)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(ye,Ae,Ge,Fe){var ge=Fe;switch(Ge){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;break;case 5:return this.popState(),"title_value";break;case 6:return this.begin("acc_title"),37;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),39;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;break;case 29:return this.begin("point_start"),44;break;case 30:return this.begin("point_x"),45;break;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;break;case 34:return 28;case 35:return 4;case 36:return 11;case 37:return 64;case 38:return 10;case 39:return 65;case 40:return 65;case 41:return 14;case 42:return 13;case 43:return 67;case 44:return 66;case 45:return 12;case 46:return 8;case 47:return 5;case 48:return 18;case 49:return 56;case 50:return 63;case 51:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],inclusive:!0}}};return ke}();ie.lexer=he;function U(){this.yy={}}return v(U,"Parser"),U.prototype=ie,ie.Parser=U,new U}();JI.parser=JI;EPe=JI,as=z1(),SPe=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{v(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:sr.quadrantChart?.chartWidth||500,chartWidth:sr.quadrantChart?.chartHeight||500,titlePadding:sr.quadrantChart?.titlePadding||10,titleFontSize:sr.quadrantChart?.titleFontSize||20,quadrantPadding:sr.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:sr.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:sr.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:sr.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:sr.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:sr.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:sr.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:sr.quadrantChart?.pointTextPadding||5,pointLabelFontSize:sr.quadrantChart?.pointLabelFontSize||12,pointRadius:sr.quadrantChart?.pointRadius||5,xAxisPosition:sr.quadrantChart?.xAxisPosition||"top",yAxisPosition:sr.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:sr.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:sr.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:as.quadrant1Fill,quadrant2Fill:as.quadrant2Fill,quadrant3Fill:as.quadrant3Fill,quadrant4Fill:as.quadrant4Fill,quadrant1TextFill:as.quadrant1TextFill,quadrant2TextFill:as.quadrant2TextFill,quadrant3TextFill:as.quadrant3TextFill,quadrant4TextFill:as.quadrant4TextFill,quadrantPointFill:as.quadrantPointFill,quadrantPointTextFill:as.quadrantPointTextFill,quadrantXAxisTextFill:as.quadrantXAxisTextFill,quadrantYAxisTextFill:as.quadrantYAxisTextFill,quadrantTitleFill:as.quadrantTitleFill,quadrantInternalBorderStrokeFill:as.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:as.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,re.info("clear called")}setData(t){this.data={...this.data,...t}}addPoints(t){this.data.points=[...t,...this.data.points]}addClass(t,e){this.classes.set(t,e)}setConfig(t){re.trace("setConfig called with: ",t),this.config={...this.config,...t}}setThemeConfig(t){re.trace("setThemeConfig called with: ",t),this.themeConfig={...this.themeConfig,...t}}calculateSpace(t,e,r,n){let i=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,a={top:t==="top"&&e?i:0,bottom:t==="bottom"&&e?i:0},s=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,o={left:this.config.yAxisPosition==="left"&&r?s:0,right:this.config.yAxisPosition==="right"&&r?s:0},l=this.config.titleFontSize+this.config.titlePadding*2,u={top:n?l:0},h=this.config.quadrantPadding+o.left,f=this.config.quadrantPadding+a.top+u.top,d=this.config.chartWidth-this.config.quadrantPadding*2-o.left-o.right,p=this.config.chartHeight-this.config.quadrantPadding*2-a.top-a.bottom-u.top,g=d/2,m=p/2;return{xAxisSpace:a,yAxisSpace:o,titleSpace:u,quadrantSpace:{quadrantLeft:h,quadrantTop:f,quadrantWidth:d,quadrantHalfWidth:g,quadrantHeight:p,quadrantHalfHeight:m}}}getAxisLabels(t,e,r,n){let{quadrantSpace:i,titleSpace:a}=n,{quadrantHalfHeight:s,quadrantHeight:o,quadrantLeft:l,quadrantHalfWidth:u,quadrantTop:h,quadrantWidth:f}=i,d=!!this.data.xAxisRightText,p=!!this.data.yAxisTopText,g=[];return this.data.xAxisLeftText&&e&&g.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+(d?u/2:0),y:t==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&e&&g.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:l+u+(d?u/2:0),y:t==="top"?this.config.xAxisLabelPadding+a.top:this.config.xAxisLabelPadding+h+o+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:d?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&r&&g.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+o-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&r&&g.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+l+f+this.config.quadrantPadding,y:h+s-(p?s/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:p?"center":"left",horizontalPos:"top",rotation:-90}),g}getQuadrants(t){let{quadrantSpace:e}=t,{quadrantHalfHeight:r,quadrantLeft:n,quadrantHalfWidth:i,quadrantTop:a}=e,s=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a,width:i,height:r,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a,width:i,height:r,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+i,y:a+r,width:i,height:r,fill:this.themeConfig.quadrant4Fill}];for(let o of s)o.text.x=o.x+o.width/2,this.data.points.length===0?(o.text.y=o.y+o.height/2,o.text.horizontalPos="middle"):(o.text.y=o.y+this.config.quadrantTextTopPadding,o.text.horizontalPos="top");return s}getQuadrantPoints(t){let{quadrantSpace:e}=t,{quadrantHeight:r,quadrantLeft:n,quadrantTop:i,quadrantWidth:a}=e,s=hl().domain([0,1]).range([n,a+n]),o=hl().domain([0,1]).range([r+i,i]);return this.data.points.map(u=>{let h=this.classes.get(u.className);return h&&(u={...h,...u}),{x:s(u.x),y:o(u.y),fill:u.color??this.themeConfig.quadrantPointFill,radius:u.radius??this.config.pointRadius,text:{text:u.text,fill:this.themeConfig.quadrantPointTextFill,x:s(u.x),y:o(u.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:u.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:u.strokeWidth??"0px"}})}getBorders(t){let e=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:r}=t,{quadrantHalfHeight:n,quadrantHeight:i,quadrantLeft:a,quadrantHalfWidth:s,quadrantTop:o,quadrantWidth:l}=r;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-e,y1:o,x2:a+l+e,y2:o},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a+l,y1:o+e,x2:a+l,y2:o+i-e},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a-e,y1:o+i,x2:a+l+e,y2:o+i},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:a,y1:o+e,x2:a,y2:o+i-e},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+s,y1:o+e,x2:a+s,y2:o+i-e},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:a+e,y1:o+n,x2:a+l-e,y2:o+n}]}getTitle(t){if(t)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){let t=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),e=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),r=this.config.showTitle&&!!this.data.titleText,n=this.data.points.length>0?"bottom":this.config.xAxisPosition,i=this.calculateSpace(n,t,e,r);return{points:this.getQuadrantPoints(i),quadrants:this.getQuadrants(i),axisLabels:this.getAxisLabels(n,t,e,i),borderLines:this.getBorders(i),title:this.getTitle(r)}}},UT=class extends Error{static{v(this,"InvalidStyleError")}constructor(t,e,r){super(`value for ${t} ${e} is invalid, please use a valid ${r}`),this.name="InvalidStyleError"}};v(eM,"validateHexCode");v(wce,"validateNumber");v(kce,"validateSizeInPixels");CPe=pe();v(Fc,"textSanitizer");ma=new SPe;v(Tce,"setQuadrant1Text");v(Ece,"setQuadrant2Text");v(Sce,"setQuadrant3Text");v(Cce,"setQuadrant4Text");v(Ace,"setXAxisLeftText");v(_ce,"setXAxisRightText");v(Lce,"setYAxisTopText");v(Rce,"setYAxisBottomText");v(VT,"parseStyles");v(Nce,"addPoint");v(Ice,"addClass");v(Mce,"setWidth");v(Dce,"setHeight");v(Oce,"getQuadrantData");APe=v(function(){ma.clear(),xr()},"clear"),_Pe={setWidth:Mce,setHeight:Dce,setQuadrant1Text:Tce,setQuadrant2Text:Ece,setQuadrant3Text:Sce,setQuadrant4Text:Cce,setXAxisLeftText:Ace,setXAxisRightText:_ce,setYAxisTopText:Lce,setYAxisBottomText:Rce,parseStyles:VT,addPoint:Nce,addClass:Ice,getQuadrantData:Oce,clear:APe,setAccTitle:Tr,getAccTitle:_r,setDiagramTitle:tn,getDiagramTitle:qr,getAccDescription:Rr,setAccDescription:Lr},LPe=v((t,e,r,n)=>{function i(S){return S==="top"?"hanging":"middle"}v(i,"getDominantBaseLine");function a(S){return S==="left"?"start":"middle"}v(a,"getTextAnchor");function s(S){return`translate(${S.x}, ${S.y}) rotate(${S.rotation||0})`}v(s,"getTransformation");let o=pe();re.debug(`Rendering quadrant chart `+t);let l=o.securityLevel,u;l==="sandbox"&&(u=Ve("#i"+e));let f=(l==="sandbox"?Ve(u.nodes()[0].contentDocument.body):Ve("body")).select(`[id="${e}"]`),d=f.append("g").attr("class","main"),p=o.quadrantChart?.chartWidth??500,g=o.quadrantChart?.chartHeight??500;Hr(f,g,p,o.quadrantChart?.useMaxWidth??!0),f.attr("viewBox","0 0 "+p+" "+g),n.db.setHeight(g),n.db.setWidth(p);let m=n.db.getQuadrantData(),y=d.append("g").attr("class","quadrants"),x=d.append("g").attr("class","border"),b=d.append("g").attr("class","data-points"),w=d.append("g").attr("class","labels"),_=d.append("g").attr("class","title");m.title&&_.append("text").attr("x",0).attr("y",0).attr("fill",m.title.fill).attr("font-size",m.title.fontSize).attr("dominant-baseline",i(m.title.horizontalPos)).attr("text-anchor",a(m.title.verticalPos)).attr("transform",s(m.title)).text(m.title.text),m.borderLines&&x.selectAll("line").data(m.borderLines).enter().append("line").attr("x1",S=>S.x1).attr("y1",S=>S.y1).attr("x2",S=>S.x2).attr("y2",S=>S.y2).style("stroke",S=>S.strokeFill).style("stroke-width",S=>S.strokeWidth);let k=y.selectAll("g.quadrant").data(m.quadrants).enter().append("g").attr("class","quadrant");k.append("rect").attr("x",S=>S.x).attr("y",S=>S.y).attr("width",S=>S.width).attr("height",S=>S.height).attr("fill",S=>S.fill),k.append("text").attr("x",0).attr("y",0).attr("fill",S=>S.text.fill).attr("font-size",S=>S.text.fontSize).attr("dominant-baseline",S=>i(S.text.horizontalPos)).attr("text-anchor",S=>a(S.text.verticalPos)).attr("transform",S=>s(S.text)).text(S=>S.text.text),w.selectAll("g.label").data(m.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(S=>S.text).attr("fill",S=>S.fill).attr("font-size",S=>S.fontSize).attr("dominant-baseline",S=>i(S.horizontalPos)).attr("text-anchor",S=>a(S.verticalPos)).attr("transform",S=>s(S));let L=b.selectAll("g.data-point").data(m.points).enter().append("g").attr("class","data-point");L.append("circle").attr("cx",S=>S.x).attr("cy",S=>S.y).attr("r",S=>S.radius).attr("fill",S=>S.fill).attr("stroke",S=>S.strokeColor).attr("stroke-width",S=>S.strokeWidth),L.append("text").attr("x",0).attr("y",0).text(S=>S.text.text).attr("fill",S=>S.text.fill).attr("font-size",S=>S.text.fontSize).attr("dominant-baseline",S=>i(S.text.horizontalPos)).attr("text-anchor",S=>a(S.text.verticalPos)).attr("transform",S=>s(S.text))},"draw"),RPe={draw:LPe},NPe={parser:EPe,db:_Pe,renderer:RPe,styles:v(()=>"","styles")}});var nue={};vr(nue,{diagram:()=>HPe});function rM(t){return t.type==="bar"}function aM(t){return t.type==="band"}function Sm(t){return t.type==="linear"}function nM(t,e,r,n){let i=new $ce(n);return aM(t)?new MPe(e,r,t.categories,t.title,i):new DPe(e,r,[t.min,t.max],t.title,i)}function Uce(t,e,r,n){let i=new $ce(n);return new OPe(i,t,e,r)}function Vce(t,e,r){return new FPe(t,e,r)}function oM(){let t=z1(),e=Or();return ws(t.xyChart,e.themeVariables.xyChart)}function lM(){let t=Or();return ws(sr.xyChart,t.xyChart)}function cM(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function HT(t){let e=Or();return yr(t.trim(),e)}function Hce(t){Wce=t}function qce(t){t==="horizontal"?K2.chartOrientation="horizontal":K2.chartOrientation="vertical"}function Yce(t){an.xAxis.title=HT(t.text)}function uM(t,e){an.xAxis={type:"linear",title:an.xAxis.title,min:t,max:e},WT=!0}function Xce(t){an.xAxis={type:"band",title:an.xAxis.title,categories:t.map(e=>HT(e.text))},WT=!0}function jce(t){an.yAxis.title=HT(t.text)}function Kce(t,e){an.yAxis={type:"linear",title:an.yAxis.title,min:t,max:e},sM=!0}function Zce(t){let e=Math.min(...t),r=Math.max(...t),n=Sm(an.yAxis)?an.yAxis.min:1/0,i=Sm(an.yAxis)?an.yAxis.max:-1/0;an.yAxis={type:"linear",title:an.yAxis.title,min:Math.min(n,e),max:Math.max(i,r)}}function hM(t){let e=[];if(t.length===0)return e;if(!WT){let r=Sm(an.xAxis)?an.xAxis.min:1/0,n=Sm(an.xAxis)?an.xAxis.max:-1/0;uM(Math.min(r,1),Math.max(n,t.length))}if(sM||Zce(t),aM(an.xAxis)&&(e=an.xAxis.categories.map((r,n)=>[r,t[n]])),Sm(an.xAxis)){let r=an.xAxis.min,n=an.xAxis.max,i=(n-r)/(t.length-1),a=[];for(let s=r;s<=n;s+=i)a.push(`${s}`);e=a.map((s,o)=>[s,t[o]])}return e}function fM(t){return iM[t===0?0:t%iM.length]}function Qce(t,e){let r=hM(e);an.plots.push({type:"line",strokeFill:fM(j2),strokeWidth:2,data:r}),j2++}function Jce(t,e){let r=hM(e);an.plots.push({type:"bar",fill:fM(j2),data:r}),j2++}function eue(){if(an.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return an.title=qr(),$Pe.build(K2,an,Z2,Wce)}function tue(){return Z2}function rue(){return K2}var tM,IPe,$ce,Fce,zce,Gce,MPe,DPe,OPe,PPe,BPe,FPe,zPe,$Pe,j2,Wce,K2,Z2,an,iM,WT,sM,GPe,UPe,VPe,WPe,HPe,iue=F(()=>{Ya();kn();Iu();or();lr();lr();lr();tM=function(){var t=v(function(D,N,O,B){for(O=O||{},B=D.length;B--;O[D[B]]=N);return O},"o"),e=[1,10,12,14,16,18,19,21,23],r=[2,6],n=[1,3],i=[1,5],a=[1,6],s=[1,7],o=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],u=[1,26],h=[1,28],f=[1,29],d=[1,30],p=[1,31],g=[1,32],m=[1,33],y=[1,34],x=[1,35],b=[1,36],w=[1,37],_=[1,43],k=[1,42],E=[1,47],L=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],C=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],M=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],R=[1,64],T={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:v(function(N,O,B,P,$,z,H){var J=z.length-1;switch($){case 5:P.setOrientation(z[J]);break;case 9:P.setDiagramTitle(z[J].text.trim());break;case 12:P.setLineData({text:"",type:"text"},z[J]);break;case 13:P.setLineData(z[J-1],z[J]);break;case 14:P.setBarData({text:"",type:"text"},z[J]);break;case 15:P.setBarData(z[J-1],z[J]);break;case 16:this.$=z[J].trim(),P.setAccTitle(this.$);break;case 17:case 18:this.$=z[J].trim(),P.setAccDescription(this.$);break;case 19:this.$=z[J-1];break;case 20:this.$=[Number(z[J-2]),...z[J]];break;case 21:this.$=[Number(z[J])];break;case 22:P.setXAxisTitle(z[J]);break;case 23:P.setXAxisTitle(z[J-1]);break;case 24:P.setXAxisTitle({type:"text",text:""});break;case 25:P.setXAxisBand(z[J]);break;case 26:P.setXAxisRangeData(Number(z[J-2]),Number(z[J]));break;case 27:this.$=z[J-1];break;case 28:this.$=[z[J-2],...z[J]];break;case 29:this.$=[z[J]];break;case 30:P.setYAxisTitle(z[J]);break;case 31:P.setYAxisTitle(z[J-1]);break;case 32:P.setYAxisTitle({type:"text",text:""});break;case 33:P.setYAxisRangeData(Number(z[J-2]),Number(z[J]));break;case 37:this.$={text:z[J],type:"text"};break;case 38:this.$={text:z[J],type:"text"};break;case 39:this.$={text:z[J],type:"markdown"};break;case 40:this.$=z[J];break;case 41:this.$=z[J-1]+""+z[J];break}},"anonymous"),table:[t(e,r,{3:1,4:2,7:4,5:n,34:i,35:a,36:s}),{1:[3]},t(e,r,{4:2,7:4,3:8,5:n,34:i,35:a,36:s}),t(e,r,{4:2,7:4,6:9,3:10,5:n,8:[1,11],34:i,35:a,36:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(o,[2,34]),t(o,[2,35]),t(o,[2,36]),{1:[2,1]},t(e,r,{4:2,7:4,3:21,5:n,34:i,35:a,36:s}),{1:[2,3]},t(o,[2,5]),t(e,[2,7],{4:22,34:i,35:a,36:s}),{11:23,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},{11:39,13:38,24:_,27:k,29:40,30:41,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},{11:45,15:44,27:E,33:46,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},{11:49,17:48,24:L,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},{11:52,17:51,24:L,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},{20:[1,53]},{22:[1,54]},t(S,[2,18]),{1:[2,2]},t(S,[2,8]),t(S,[2,9]),t(C,[2,37],{40:55,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w}),t(C,[2,38]),t(C,[2,39]),t(M,[2,40]),t(M,[2,42]),t(M,[2,43]),t(M,[2,44]),t(M,[2,45]),t(M,[2,46]),t(M,[2,47]),t(M,[2,48]),t(M,[2,49]),t(M,[2,50]),t(M,[2,51]),t(S,[2,10]),t(S,[2,22],{30:41,29:56,24:_,27:k}),t(S,[2,24]),t(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},t(S,[2,11]),t(S,[2,30],{33:60,27:E}),t(S,[2,32]),{31:[1,61]},t(S,[2,12]),{17:62,24:L},{25:63,27:R},t(S,[2,14]),{17:65,24:L},t(S,[2,16]),t(S,[2,17]),t(M,[2,41]),t(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(S,[2,31]),{27:[1,69]},t(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(S,[2,15]),t(S,[2,26]),t(S,[2,27]),{11:59,32:72,37:24,38:l,39:u,40:27,41:h,42:f,43:d,44:p,45:g,46:m,47:y,48:x,49:b,50:w},t(S,[2,33]),t(S,[2,19]),{25:73,27:R},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:v(function(N,O){if(O.recoverable)this.trace(N);else{var B=new Error(N);throw B.hash=O,B}},"parseError"),parse:v(function(N){var O=this,B=[0],P=[],$=[null],z=[],H=this.table,J="",X=0,oe=0,K=0,ee=2,Q=1,W=z.slice.call(arguments,1),Y=Object.create(this.lexer),Z={yy:{}};for(var se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,se)&&(Z.yy[se]=this.yy[se]);Y.setInput(N,Z.yy),Z.yy.lexer=Y,Z.yy.parser=this,typeof Y.yylloc>"u"&&(Y.yylloc={});var ce=Y.yylloc;z.push(ce);var ue=Y.options&&Y.options.ranges;typeof Z.yy.parseError=="function"?this.parseError=Z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function te(ie){B.length=B.length-2*ie,$.length=$.length-ie,z.length=z.length-ie}v(te,"popStack");function Ne(){var ie;return ie=P.pop()||Y.lex()||Q,typeof ie!="number"&&(ie instanceof Array&&(P=ie,ie=P.pop()),ie=O.symbols_[ie]||ie),ie}v(Ne,"lex");for(var ae,we,Ie,Ee,Oe,De,We={},Re,Pe,xe,q;;){if(Ie=B[B.length-1],this.defaultActions[Ie]?Ee=this.defaultActions[Ie]:((ae===null||typeof ae>"u")&&(ae=Ne()),Ee=H[Ie]&&H[Ie][ae]),typeof Ee>"u"||!Ee.length||!Ee[0]){var de="";q=[];for(Re in H[Ie])this.terminals_[Re]&&Re>ee&&q.push("'"+this.terminals_[Re]+"'");Y.showPosition?de="Parse error on line "+(X+1)+`: `+Y.showPosition()+` Expecting `+q.join(", ")+", got '"+(this.terminals_[ae]||ae)+"'":de="Parse error on line "+(X+1)+": Unexpected "+(ae==Q?"end of input":"'"+(this.terminals_[ae]||ae)+"'"),this.parseError(de,{text:Y.match,token:this.terminals_[ae]||ae,line:Y.yylineno,loc:ce,expected:q})}if(Ee[0]instanceof Array&&Ee.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ie+", token: "+ae);switch(Ee[0]){case 1:B.push(ae),$.push(Y.yytext),z.push(Y.yylloc),B.push(Ee[1]),ae=null,we?(ae=we,we=null):(oe=Y.yyleng,J=Y.yytext,X=Y.yylineno,ce=Y.yylloc,K>0&&K--);break;case 2:if(Pe=this.productions_[Ee[1]][1],We.$=$[$.length-Pe],We._$={first_line:z[z.length-(Pe||1)].first_line,last_line:z[z.length-1].last_line,first_column:z[z.length-(Pe||1)].first_column,last_column:z[z.length-1].last_column},ue&&(We._$.range=[z[z.length-(Pe||1)].range[0],z[z.length-1].range[1]]),De=this.performAction.apply(We,[J,oe,X,Z.yy,Ee[1],$,z].concat(W)),typeof De<"u")return De;Pe&&(B=B.slice(0,-1*Pe*2),$=$.slice(0,-1*Pe),z=z.slice(0,-1*Pe)),B.push(this.productions_[Ee[1]][0]),$.push(We.$),z.push(We._$),xe=H[B[B.length-2]][B[B.length-1]],B.push(xe);break;case 3:return!0}}return!0},"parse")},I=function(){var D={EOF:1,parseError:v(function(O,B){if(this.yy.parser)this.yy.parser.parseError(O,B);else throw new Error(O)},"parseError"),setInput:v(function(N,O){return this.yy=O||this.yy||{},this._input=N,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var N=this._input[0];this.yytext+=N,this.yyleng++,this.offset++,this.match+=N,this.matched+=N;var O=N.match(/(?:\r\n?|\n).*/g);return O?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),N},"input"),unput:v(function(N){var O=N.length,B=N.split(/(?:\r\n?|\n)/g);this._input=N+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-O),this.offset-=O;var P=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),B.length-1&&(this.yylineno-=B.length-1);var $=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:B?(B.length===P.length?this.yylloc.first_column:0)+P[P.length-B.length].length-B[0].length:this.yylloc.first_column-O},this.options.ranges&&(this.yylloc.range=[$[0],$[0]+this.yyleng-O]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(N){this.unput(this.match.slice(N))},"less"),pastInput:v(function(){var N=this.matched.substr(0,this.matched.length-this.match.length);return(N.length>20?"...":"")+N.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var N=this.match;return N.length<20&&(N+=this._input.substr(0,20-N.length)),(N.substr(0,20)+(N.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var N=this.pastInput(),O=new Array(N.length+1).join("-");return N+this.upcomingInput()+` `+O+"^"},"showPosition"),test_match:v(function(N,O){var B,P,$;if(this.options.backtrack_lexer&&($={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&($.yylloc.range=this.yylloc.range.slice(0))),P=N[0].match(/(?:\r\n?|\n).*/g),P&&(this.yylineno+=P.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:P?P[P.length-1].length-P[P.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+N[0].length},this.yytext+=N[0],this.match+=N[0],this.matches=N,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(N[0].length),this.matched+=N[0],B=this.performAction.call(this,this.yy,this,O,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),B)return B;if(this._backtrack){for(var z in $)this[z]=$[z];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var N,O,B,P;this._more||(this.yytext="",this.match="");for(var $=this._currentRules(),z=0;z<$.length;z++)if(B=this._input.match(this.rules[$[z]]),B&&(!O||B[0].length>O[0].length)){if(O=B,P=z,this.options.backtrack_lexer){if(N=this.test_match(B,$[z]),N!==!1)return N;if(this._backtrack){O=!1;continue}else return!1}else if(!this.options.flex)break}return O?(N=this.test_match(O,$[P]),N!==!1?N:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var O=this.next();return O||this.lex()},"lex"),begin:v(function(O){this.conditionStack.push(O)},"begin"),popState:v(function(){var O=this.conditionStack.length-1;return O>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(O){return O=this.conditionStack.length-1-Math.abs(O||0),O>=0?this.conditionStack[O]:"INITIAL"},"topState"),pushState:v(function(O){this.begin(O)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(O,B,P,$){var z=$;switch(P){case 0:break;case 1:break;case 2:return this.popState(),34;break;case 3:return this.popState(),34;break;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";break;case 17:return this.pushState("axis_data"),"Y_AXIS";break;case 18:return this.pushState("axis_band_data"),24;break;case 19:return 31;case 20:return this.pushState("data"),16;break;case 21:return this.pushState("data"),18;break;case 22:return this.pushState("data_inner"),24;break;case 23:return 27;case 24:return this.popState(),26;break;case 25:this.popState();break;case 26:this.pushState("string");break;case 27:this.popState();break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 43:break;case 44:return 35;case 45:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}};return D}();T.lexer=I;function A(){this.yy={}}return v(A,"Parser"),A.prototype=T,T.Parser=A,new A}();tM.parser=tM;IPe=tM;v(rM,"isBarPlot");v(aM,"isBandAxisData");v(Sm,"isLinearAxisData");$ce=class{constructor(t){this.parentGroup=t}static{v(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,e){if(!this.parentGroup)return{width:t.reduce((i,a)=>Math.max(a.length,i),0)*e,height:e};let r={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",e);for(let i of t){let a=kA(n,1,i),s=a?a.width:i.length*e,o=a?a.height:e;r.width=Math.max(r.width,s),r.height=Math.max(r.height,o)}return n.remove(),r}},Fce=.7,zce=.2,Gce=class{constructor(t,e,r,n){this.axisConfig=t,this.title=e,this.textDimensionCalculator=r,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}static{v(this,"BaseAxis")}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){Fce*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(Fce*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let e=t.height;if(this.axisConfig.showAxisLine&&e>this.axisConfig.axisLineWidth&&(e-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=zce*t.width;this.outerPadding=Math.min(r.width/2,n);let i=r.height+this.axisConfig.labelPadding*2;this.labelTextHeight=r.height,i<=e&&(e-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&e>=this.axisConfig.tickLength&&(this.showTick=!0,e-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=e&&(e-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-e}calculateSpaceIfDrawnVertical(t){let e=t.width;if(this.axisConfig.showAxisLine&&e>this.axisConfig.axisLineWidth&&(e-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let r=this.getLabelDimension(),n=zce*t.height;this.outerPadding=Math.min(r.height/2,n);let i=r.width+this.axisConfig.labelPadding*2;i<=e&&(e-=i,this.showLabel=!0)}if(this.axisConfig.showTick&&e>=this.axisConfig.tickLength&&(this.showTick=!0,e-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let r=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=r.height+this.axisConfig.titlePadding*2;this.titleTextHeight=r.height,n<=e&&(e-=n,this.showTitle=!0)}this.boundingRect.width=t.width-e,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${e},${this.boundingRect.y} L ${e},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(e),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let e=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${e},${this.getScaleValue(r)} L ${e-this.axisConfig.tickLength},${this.getScaleValue(r)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${e} L ${this.boundingRect.x+this.boundingRect.width},${e}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let e=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${e} L ${this.getScaleValue(r)},${e+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${e} L ${this.boundingRect.x+this.boundingRect.width},${e}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let e=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(r=>({path:`M ${this.getScaleValue(r)},${e+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(r)},${e+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},MPe=class extends Gce{static{v(this,"BandAxis")}constructor(t,e,r,n,i){super(t,n,i,e),this.categories=r,this.scale=Tp().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=Tp().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),re.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},DPe=class extends Gce{static{v(this,"LinearAxis")}constructor(t,e,r,n,i){super(t,n,i,e),this.domain=r,this.scale=hl().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=hl().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};v(nM,"getAxis");OPe=class{constructor(t,e,r,n){this.textDimensionCalculator=t,this.chartConfig=e,this.chartData=r,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{v(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let e=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),r=Math.max(e.width,t.width),n=e.height+2*this.chartConfig.titlePadding;return e.width<=r&&e.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=r,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};v(Uce,"getChartTitleComponent");PPe=class{constructor(t,e,r,n,i){this.plotData=t,this.xAxis=e,this.yAxis=r,this.orientation=n,this.plotIndex=i}static{v(this,"LinePlot")}getDrawableElement(){let t=this.plotData.data.map(r=>[this.xAxis.getScaleValue(r[0]),this.yAxis.getScaleValue(r[1])]),e;return this.orientation==="horizontal"?e=ms().y(r=>r[0]).x(r=>r[1])(t):e=ms().x(r=>r[0]).y(r=>r[1])(t),e?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:e,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},BPe=class{constructor(t,e,r,n,i,a){this.barData=t,this.boundingRect=e,this.xAxis=r,this.yAxis=n,this.orientation=i,this.plotIndex=a}static{v(this,"BarPlot")}getDrawableElement(){let t=this.barData.data.map(i=>[this.xAxis.getScaleValue(i[0]),this.yAxis.getScaleValue(i[1])]),r=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=r/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(i=>({x:this.boundingRect.x,y:i[0]-n,height:r,width:i[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(i=>({x:i[0]-n,y:i[1],width:r,height:this.boundingRect.y+this.boundingRect.height-i[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},FPe=class{constructor(t,e,r){this.chartConfig=t,this.chartData=e,this.chartThemeConfig=r,this.boundingRect={x:0,y:0,width:0,height:0}}static{v(this,"BasePlot")}setAxes(t,e){this.xAxis=t,this.yAxis=e}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[e,r]of this.chartData.plots.entries())switch(r.type){case"line":{let n=new PPe(r,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,e);t.push(...n.getDrawableElement())}break;case"bar":{let n=new BPe(r,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,e);t.push(...n.getDrawableElement())}break}return t}};v(Vce,"getPlotComponent");zPe=class{constructor(t,e,r,n){this.chartConfig=t,this.chartData=e,this.componentStore={title:Uce(t,e,r,n),plot:Vce(t,e,r),xAxis:nM(e.xAxis,t.xAxis,{titleColor:r.xAxisTitleColor,labelColor:r.xAxisLabelColor,tickColor:r.xAxisTickColor,axisLineColor:r.xAxisLineColor},n),yAxis:nM(e.yAxis,t.yAxis,{titleColor:r.yAxisTitleColor,labelColor:r.yAxisLabelColor,tickColor:r.yAxisTickColor,axisLineColor:r.yAxisLineColor},n)}}static{v(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,e=this.chartConfig.height,r=0,n=0,i=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),a=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),s=this.componentStore.plot.calculateSpace({width:i,height:a});t-=s.width,e-=s.height,s=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:e}),n=s.height,e-=s.height,this.componentStore.xAxis.setAxisPosition("bottom"),s=this.componentStore.xAxis.calculateSpace({width:t,height:e}),e-=s.height,this.componentStore.yAxis.setAxisPosition("left"),s=this.componentStore.yAxis.calculateSpace({width:t,height:e}),r=s.width,t-=s.width,t>0&&(i+=t,t=0),e>0&&(a+=e,e=0),this.componentStore.plot.calculateSpace({width:i,height:a}),this.componentStore.plot.setBoundingBoxXY({x:r,y:n}),this.componentStore.xAxis.setRange([r,r+i]),this.componentStore.xAxis.setBoundingBoxXY({x:r,y:n+a}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(o=>rM(o))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,e=this.chartConfig.height,r=0,n=0,i=0,a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:a,height:s});t-=o.width,e-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:e}),r=o.height,e-=o.height,this.componentStore.xAxis.setAxisPosition("left"),o=this.componentStore.xAxis.calculateSpace({width:t,height:e}),t-=o.width,n=o.width,this.componentStore.yAxis.setAxisPosition("top"),o=this.componentStore.yAxis.calculateSpace({width:t,height:e}),e-=o.height,i=r+o.height,t>0&&(a+=t,t=0),e>0&&(s+=e,e=0),this.componentStore.plot.calculateSpace({width:a,height:s}),this.componentStore.plot.setBoundingBoxXY({x:n,y:i}),this.componentStore.yAxis.setRange([n,n+a]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:r}),this.componentStore.xAxis.setRange([i,i+s]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:i}),this.chartData.plots.some(l=>rM(l))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let e of Object.values(this.componentStore))t.push(...e.getDrawableElements());return t}},$Pe=class{static{v(this,"XYChartBuilder")}static build(t,e,r,n){return new zPe(t,e,r,n).getDrawableElement()}},j2=0,K2=lM(),Z2=oM(),an=cM(),iM=Z2.plotColorPalette.split(",").map(t=>t.trim()),WT=!1,sM=!1;v(oM,"getChartDefaultThemeConfig");v(lM,"getChartDefaultConfig");v(cM,"getChartDefaultData");v(HT,"textSanitizer");v(Hce,"setTmpSVGG");v(qce,"setOrientation");v(Yce,"setXAxisTitle");v(uM,"setXAxisRangeData");v(Xce,"setXAxisBand");v(jce,"setYAxisTitle");v(Kce,"setYAxisRangeData");v(Zce,"setYAxisRangeFromPlotData");v(hM,"transformDataWithoutCategory");v(fM,"getPlotColorFromPalette");v(Qce,"setLineData");v(Jce,"setBarData");v(eue,"getDrawableElem");v(tue,"getChartThemeConfig");v(rue,"getChartConfig");GPe=v(function(){xr(),j2=0,K2=lM(),an=cM(),Z2=oM(),iM=Z2.plotColorPalette.split(",").map(t=>t.trim()),WT=!1,sM=!1},"clear"),UPe={getDrawableElem:eue,clear:GPe,setAccTitle:Tr,getAccTitle:_r,setDiagramTitle:tn,getDiagramTitle:qr,getAccDescription:Rr,setAccDescription:Lr,setOrientation:qce,setXAxisTitle:Yce,setXAxisRangeData:uM,setXAxisBand:Xce,setYAxisTitle:jce,setYAxisRangeData:Kce,setLineData:Qce,setBarData:Jce,setTmpSVGG:Hce,getChartThemeConfig:tue,getChartConfig:rue},VPe=v((t,e,r,n)=>{let i=n.db,a=i.getChartThemeConfig(),s=i.getChartConfig();function o(y){return y==="top"?"text-before-edge":"middle"}v(o,"getDominantBaseLine");function l(y){return y==="left"?"start":y==="right"?"end":"middle"}v(l,"getTextAnchor");function u(y){return`translate(${y.x}, ${y.y}) rotate(${y.rotation||0})`}v(u,"getTextTransformation"),re.debug(`Rendering xychart chart `+t);let h=La(e),f=h.append("g").attr("class","main"),d=f.append("rect").attr("width",s.width).attr("height",s.height).attr("class","background");Hr(h,s.height,s.width,!0),h.attr("viewBox",`0 0 ${s.width} ${s.height}`),d.attr("fill",a.backgroundColor),i.setTmpSVGG(h.append("g").attr("class","mermaid-tmp-group"));let p=i.getDrawableElem(),g={};function m(y){let x=f,b="";for(let[w]of y.entries()){let _=f;w>0&&g[b]&&(_=g[b]),b+=y[w],x=g[b],x||(x=g[b]=_.append("g").attr("class",y[w]))}return x}v(m,"getGroup");for(let y of p){if(y.data.length===0)continue;let x=m(y.groupTexts);switch(y.type){case"rect":x.selectAll("rect").data(y.data).enter().append("rect").attr("x",b=>b.x).attr("y",b=>b.y).attr("width",b=>b.width).attr("height",b=>b.height).attr("fill",b=>b.fill).attr("stroke",b=>b.strokeFill).attr("stroke-width",b=>b.strokeWidth);break;case"text":x.selectAll("text").data(y.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",b=>b.fill).attr("font-size",b=>b.fontSize).attr("dominant-baseline",b=>o(b.verticalPos)).attr("text-anchor",b=>l(b.horizontalPos)).attr("transform",b=>u(b)).text(b=>b.text);break;case"path":x.selectAll("path").data(y.data).enter().append("path").attr("d",b=>b.path).attr("fill",b=>b.fill?b.fill:"none").attr("stroke",b=>b.strokeFill).attr("stroke-width",b=>b.strokeWidth);break}}},"draw"),WPe={draw:VPe},HPe={parser:IPe,db:UPe,renderer:WPe}});var uue={};vr(uue,{diagram:()=>kBe});var dM,qPe,gM,Os,Q2,uf,J2,YPe,XPe,jPe,KPe,ZPe,QPe,JPe,eBe,tBe,rBe,nBe,iBe,aBe,sBe,oBe,lBe,cBe,uBe,hBe,fBe,pM,dBe,sue,ri,aue,oue,lue,cue,pBe,gBe,mBe,vBe,yBe,xBe,Cm,bBe,wBe,kBe,hue=F(()=>{or();lr();uy();As();dM=function(){var t=v(function(oe,K,ee,Q){for(ee=ee||{},Q=oe.length;Q--;ee[oe[Q]]=K);return ee},"o"),e=[1,3],r=[1,4],n=[1,5],i=[1,6],a=[5,6,8,9,11,13,31,32,33,34,35,36,44,62,63],s=[1,18],o=[2,7],l=[1,22],u=[1,23],h=[1,24],f=[1,25],d=[1,26],p=[1,27],g=[1,20],m=[1,28],y=[1,29],x=[62,63],b=[5,8,9,11,13,31,32,33,34,35,36,44,51,53,62,63],w=[1,47],_=[1,48],k=[1,49],E=[1,50],L=[1,51],S=[1,52],C=[1,53],M=[53,54],R=[1,64],T=[1,60],I=[1,61],A=[1,62],D=[1,63],N=[1,65],O=[1,69],B=[1,70],P=[1,67],$=[1,68],z=[5,8,9,11,13,31,32,33,34,35,36,44,62,63],H={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,requirementType:17,requirementName:18,STRUCT_START:19,requirementBody:20,ID:21,COLONSEP:22,id:23,TEXT:24,text:25,RISK:26,riskLevel:27,VERIFYMTHD:28,verifyType:29,STRUCT_STOP:30,REQUIREMENT:31,FUNCTIONAL_REQUIREMENT:32,INTERFACE_REQUIREMENT:33,PERFORMANCE_REQUIREMENT:34,PHYSICAL_REQUIREMENT:35,DESIGN_CONSTRAINT:36,LOW_RISK:37,MED_RISK:38,HIGH_RISK:39,VERIFY_ANALYSIS:40,VERIFY_DEMONSTRATION:41,VERIFY_INSPECTION:42,VERIFY_TEST:43,ELEMENT:44,elementName:45,elementBody:46,TYPE:47,type:48,DOCREF:49,ref:50,END_ARROW_L:51,relationship:52,LINE:53,END_ARROW_R:54,CONTAINS:55,COPIES:56,DERIVES:57,SATISFIES:58,VERIFIES:59,REFINES:60,TRACES:61,unqString:62,qString:63,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",19:"STRUCT_START",21:"ID",22:"COLONSEP",24:"TEXT",26:"RISK",28:"VERIFYMTHD",30:"STRUCT_STOP",31:"REQUIREMENT",32:"FUNCTIONAL_REQUIREMENT",33:"INTERFACE_REQUIREMENT",34:"PERFORMANCE_REQUIREMENT",35:"PHYSICAL_REQUIREMENT",36:"DESIGN_CONSTRAINT",37:"LOW_RISK",38:"MED_RISK",39:"HIGH_RISK",40:"VERIFY_ANALYSIS",41:"VERIFY_DEMONSTRATION",42:"VERIFY_INSPECTION",43:"VERIFY_TEST",44:"ELEMENT",47:"TYPE",49:"DOCREF",51:"END_ARROW_L",53:"LINE",54:"END_ARROW_R",55:"CONTAINS",56:"COPIES",57:"DERIVES",58:"SATISFIES",59:"VERIFIES",60:"REFINES",61:"TRACES",62:"unqString",63:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[14,5],[20,5],[20,5],[20,5],[20,5],[20,2],[20,1],[17,1],[17,1],[17,1],[17,1],[17,1],[17,1],[27,1],[27,1],[27,1],[29,1],[29,1],[29,1],[29,1],[15,5],[46,5],[46,5],[46,2],[46,1],[16,5],[16,5],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[18,1],[18,1],[23,1],[23,1],[25,1],[25,1],[45,1],[45,1],[48,1],[48,1],[50,1],[50,1]],performAction:v(function(K,ee,Q,W,Y,Z,se){var ce=Z.length-1;switch(Y){case 4:this.$=Z[ce].trim(),W.setAccTitle(this.$);break;case 5:case 6:this.$=Z[ce].trim(),W.setAccDescription(this.$);break;case 7:this.$=[];break;case 13:W.addRequirement(Z[ce-3],Z[ce-4]);break;case 14:W.setNewReqId(Z[ce-2]);break;case 15:W.setNewReqText(Z[ce-2]);break;case 16:W.setNewReqRisk(Z[ce-2]);break;case 17:W.setNewReqVerifyMethod(Z[ce-2]);break;case 20:this.$=W.RequirementType.REQUIREMENT;break;case 21:this.$=W.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 22:this.$=W.RequirementType.INTERFACE_REQUIREMENT;break;case 23:this.$=W.RequirementType.PERFORMANCE_REQUIREMENT;break;case 24:this.$=W.RequirementType.PHYSICAL_REQUIREMENT;break;case 25:this.$=W.RequirementType.DESIGN_CONSTRAINT;break;case 26:this.$=W.RiskLevel.LOW_RISK;break;case 27:this.$=W.RiskLevel.MED_RISK;break;case 28:this.$=W.RiskLevel.HIGH_RISK;break;case 29:this.$=W.VerifyType.VERIFY_ANALYSIS;break;case 30:this.$=W.VerifyType.VERIFY_DEMONSTRATION;break;case 31:this.$=W.VerifyType.VERIFY_INSPECTION;break;case 32:this.$=W.VerifyType.VERIFY_TEST;break;case 33:W.addElement(Z[ce-3]);break;case 34:W.setNewElementType(Z[ce-2]);break;case 35:W.setNewElementDocRef(Z[ce-2]);break;case 38:W.addRelationship(Z[ce-2],Z[ce],Z[ce-4]);break;case 39:W.addRelationship(Z[ce-2],Z[ce-4],Z[ce]);break;case 40:this.$=W.Relationships.CONTAINS;break;case 41:this.$=W.Relationships.COPIES;break;case 42:this.$=W.Relationships.DERIVES;break;case 43:this.$=W.Relationships.SATISFIES;break;case 44:this.$=W.Relationships.VERIFIES;break;case 45:this.$=W.Relationships.REFINES;break;case 46:this.$=W.Relationships.TRACES;break}},"anonymous"),table:[{3:1,4:2,6:e,9:r,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:e,9:r,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},t(a,[2,6]),{3:12,4:2,6:e,9:r,11:n,13:i},{1:[2,2]},{4:17,5:s,7:13,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},t(a,[2,4]),t(a,[2,5]),{1:[2,1]},{8:[1,30]},{4:17,5:s,7:31,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},{4:17,5:s,7:32,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},{4:17,5:s,7:33,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},{4:17,5:s,7:34,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},{4:17,5:s,7:35,8:o,9:r,11:n,13:i,14:14,15:15,16:16,17:19,23:21,31:l,32:u,33:h,34:f,35:d,36:p,44:g,62:m,63:y},{18:36,62:[1,37],63:[1,38]},{45:39,62:[1,40],63:[1,41]},{51:[1,42],53:[1,43]},t(x,[2,20]),t(x,[2,21]),t(x,[2,22]),t(x,[2,23]),t(x,[2,24]),t(x,[2,25]),t(b,[2,49]),t(b,[2,50]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{19:[1,44]},{19:[2,47]},{19:[2,48]},{19:[1,45]},{19:[2,53]},{19:[2,54]},{52:46,55:w,56:_,57:k,58:E,59:L,60:S,61:C},{52:54,55:w,56:_,57:k,58:E,59:L,60:S,61:C},{5:[1,55]},{5:[1,56]},{53:[1,57]},t(M,[2,40]),t(M,[2,41]),t(M,[2,42]),t(M,[2,43]),t(M,[2,44]),t(M,[2,45]),t(M,[2,46]),{54:[1,58]},{5:R,20:59,21:T,24:I,26:A,28:D,30:N},{5:O,30:B,46:66,47:P,49:$},{23:71,62:m,63:y},{23:72,62:m,63:y},t(z,[2,13]),{22:[1,73]},{22:[1,74]},{22:[1,75]},{22:[1,76]},{5:R,20:77,21:T,24:I,26:A,28:D,30:N},t(z,[2,19]),t(z,[2,33]),{22:[1,78]},{22:[1,79]},{5:O,30:B,46:80,47:P,49:$},t(z,[2,37]),t(z,[2,38]),t(z,[2,39]),{23:81,62:m,63:y},{25:82,62:[1,83],63:[1,84]},{27:85,37:[1,86],38:[1,87],39:[1,88]},{29:89,40:[1,90],41:[1,91],42:[1,92],43:[1,93]},t(z,[2,18]),{48:94,62:[1,95],63:[1,96]},{50:97,62:[1,98],63:[1,99]},t(z,[2,36]),{5:[1,100]},{5:[1,101]},{5:[2,51]},{5:[2,52]},{5:[1,102]},{5:[2,26]},{5:[2,27]},{5:[2,28]},{5:[1,103]},{5:[2,29]},{5:[2,30]},{5:[2,31]},{5:[2,32]},{5:[1,104]},{5:[2,55]},{5:[2,56]},{5:[1,105]},{5:[2,57]},{5:[2,58]},{5:R,20:106,21:T,24:I,26:A,28:D,30:N},{5:R,20:107,21:T,24:I,26:A,28:D,30:N},{5:R,20:108,21:T,24:I,26:A,28:D,30:N},{5:R,20:109,21:T,24:I,26:A,28:D,30:N},{5:O,30:B,46:110,47:P,49:$},{5:O,30:B,46:111,47:P,49:$},t(z,[2,14]),t(z,[2,15]),t(z,[2,16]),t(z,[2,17]),t(z,[2,34]),t(z,[2,35])],defaultActions:{8:[2,2],12:[2,1],30:[2,3],31:[2,8],32:[2,9],33:[2,10],34:[2,11],35:[2,12],37:[2,47],38:[2,48],40:[2,53],41:[2,54],83:[2,51],84:[2,52],86:[2,26],87:[2,27],88:[2,28],90:[2,29],91:[2,30],92:[2,31],93:[2,32],95:[2,55],96:[2,56],98:[2,57],99:[2,58]},parseError:v(function(K,ee){if(ee.recoverable)this.trace(K);else{var Q=new Error(K);throw Q.hash=ee,Q}},"parseError"),parse:v(function(K){var ee=this,Q=[0],W=[],Y=[null],Z=[],se=this.table,ce="",ue=0,te=0,Ne=0,ae=2,we=1,Ie=Z.slice.call(arguments,1),Ee=Object.create(this.lexer),Oe={yy:{}};for(var De in this.yy)Object.prototype.hasOwnProperty.call(this.yy,De)&&(Oe.yy[De]=this.yy[De]);Ee.setInput(K,Oe.yy),Oe.yy.lexer=Ee,Oe.yy.parser=this,typeof Ee.yylloc>"u"&&(Ee.yylloc={});var We=Ee.yylloc;Z.push(We);var Re=Ee.options&&Ee.options.ranges;typeof Oe.yy.parseError=="function"?this.parseError=Oe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Pe($e){Q.length=Q.length-2*$e,Y.length=Y.length-$e,Z.length=Z.length-$e}v(Pe,"popStack");function xe(){var $e;return $e=W.pop()||Ee.lex()||we,typeof $e!="number"&&($e instanceof Array&&(W=$e,$e=W.pop()),$e=ee.symbols_[$e]||$e),$e}v(xe,"lex");for(var q,de,ie,he,U,ke,j={},ye,Ae,Ge,Fe;;){if(ie=Q[Q.length-1],this.defaultActions[ie]?he=this.defaultActions[ie]:((q===null||typeof q>"u")&&(q=xe()),he=se[ie]&&se[ie][q]),typeof he>"u"||!he.length||!he[0]){var ge="";Fe=[];for(ye in se[ie])this.terminals_[ye]&&ye>ae&&Fe.push("'"+this.terminals_[ye]+"'");Ee.showPosition?ge="Parse error on line "+(ue+1)+`: `+Ee.showPosition()+` Expecting `+Fe.join(", ")+", got '"+(this.terminals_[q]||q)+"'":ge="Parse error on line "+(ue+1)+": Unexpected "+(q==we?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(ge,{text:Ee.match,token:this.terminals_[q]||q,line:Ee.yylineno,loc:We,expected:Fe})}if(he[0]instanceof Array&&he.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ie+", token: "+q);switch(he[0]){case 1:Q.push(q),Y.push(Ee.yytext),Z.push(Ee.yylloc),Q.push(he[1]),q=null,de?(q=de,de=null):(te=Ee.yyleng,ce=Ee.yytext,ue=Ee.yylineno,We=Ee.yylloc,Ne>0&&Ne--);break;case 2:if(Ae=this.productions_[he[1]][1],j.$=Y[Y.length-Ae],j._$={first_line:Z[Z.length-(Ae||1)].first_line,last_line:Z[Z.length-1].last_line,first_column:Z[Z.length-(Ae||1)].first_column,last_column:Z[Z.length-1].last_column},Re&&(j._$.range=[Z[Z.length-(Ae||1)].range[0],Z[Z.length-1].range[1]]),ke=this.performAction.apply(j,[ce,te,ue,Oe.yy,he[1],Y,Z].concat(Ie)),typeof ke<"u")return ke;Ae&&(Q=Q.slice(0,-1*Ae*2),Y=Y.slice(0,-1*Ae),Z=Z.slice(0,-1*Ae)),Q.push(this.productions_[he[1]][0]),Y.push(j.$),Z.push(j._$),Ge=se[Q[Q.length-2]][Q[Q.length-1]],Q.push(Ge);break;case 3:return!0}}return!0},"parse")},J=function(){var oe={EOF:1,parseError:v(function(ee,Q){if(this.yy.parser)this.yy.parser.parseError(ee,Q);else throw new Error(ee)},"parseError"),setInput:v(function(K,ee){return this.yy=ee||this.yy||{},this._input=K,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var K=this._input[0];this.yytext+=K,this.yyleng++,this.offset++,this.match+=K,this.matched+=K;var ee=K.match(/(?:\r\n?|\n).*/g);return ee?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),K},"input"),unput:v(function(K){var ee=K.length,Q=K.split(/(?:\r\n?|\n)/g);this._input=K+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-ee),this.offset-=ee;var W=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Q.length-1&&(this.yylineno-=Q.length-1);var Y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Q?(Q.length===W.length?this.yylloc.first_column:0)+W[W.length-Q.length].length-Q[0].length:this.yylloc.first_column-ee},this.options.ranges&&(this.yylloc.range=[Y[0],Y[0]+this.yyleng-ee]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(K){this.unput(this.match.slice(K))},"less"),pastInput:v(function(){var K=this.matched.substr(0,this.matched.length-this.match.length);return(K.length>20?"...":"")+K.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var K=this.match;return K.length<20&&(K+=this._input.substr(0,20-K.length)),(K.substr(0,20)+(K.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var K=this.pastInput(),ee=new Array(K.length+1).join("-");return K+this.upcomingInput()+` `+ee+"^"},"showPosition"),test_match:v(function(K,ee){var Q,W,Y;if(this.options.backtrack_lexer&&(Y={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Y.yylloc.range=this.yylloc.range.slice(0))),W=K[0].match(/(?:\r\n?|\n).*/g),W&&(this.yylineno+=W.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:W?W[W.length-1].length-W[W.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+K[0].length},this.yytext+=K[0],this.match+=K[0],this.matches=K,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(K[0].length),this.matched+=K[0],Q=this.performAction.call(this,this.yy,this,ee,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Q)return Q;if(this._backtrack){for(var Z in Y)this[Z]=Y[Z];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var K,ee,Q,W;this._more||(this.yytext="",this.match="");for(var Y=this._currentRules(),Z=0;Zee[0].length)){if(ee=Q,W=Z,this.options.backtrack_lexer){if(K=this.test_match(Q,Y[Z]),K!==!1)return K;if(this._backtrack){ee=!1;continue}else return!1}else if(!this.options.flex)break}return ee?(K=this.test_match(ee,Y[W]),K!==!1?K:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var ee=this.next();return ee||this.lex()},"lex"),begin:v(function(ee){this.conditionStack.push(ee)},"begin"),popState:v(function(){var ee=this.conditionStack.length-1;return ee>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(ee){return ee=this.conditionStack.length-1-Math.abs(ee||0),ee>=0?this.conditionStack[ee]:"INITIAL"},"topState"),pushState:v(function(ee){this.begin(ee)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(ee,Q,W,Y){var Z=Y;switch(W){case 0:return"title";case 1:return this.begin("acc_title"),9;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),11;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:return 8;case 13:return 6;case 14:return 19;case 15:return 30;case 16:return 22;case 17:return 21;case 18:return 24;case 19:return 26;case 20:return 28;case 21:return 31;case 22:return 32;case 23:return 33;case 24:return 34;case 25:return 35;case 26:return 36;case 27:return 37;case 28:return 38;case 29:return 39;case 30:return 40;case 31:return 41;case 32:return 42;case 33:return 43;case 34:return 44;case 35:return 55;case 36:return 56;case 37:return 57;case 38:return 58;case 39:return 59;case 40:return 60;case 41:return 61;case 42:return 47;case 43:return 49;case 44:return 51;case 45:return 54;case 46:return 53;case 47:this.begin("string");break;case 48:this.popState();break;case 49:return"qString";case 50:return Q.yytext=Q.yytext.trim(),62;break}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[48,49],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,50],inclusive:!0}}};return oe}();H.lexer=J;function X(){this.yy={}}return v(X,"Parser"),X.prototype=H,H.Parser=X,new X}();dM.parser=dM;qPe=dM,gM=[],Os={},Q2=new Map,uf={},J2=new Map,YPe={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},XPe={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},jPe={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},KPe={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},ZPe=v((t,e)=>(Q2.has(t)||Q2.set(t,{name:t,type:e,id:Os.id,text:Os.text,risk:Os.risk,verifyMethod:Os.verifyMethod}),Os={},Q2.get(t)),"addRequirement"),QPe=v(()=>Q2,"getRequirements"),JPe=v(t=>{Os!==void 0&&(Os.id=t)},"setNewReqId"),eBe=v(t=>{Os!==void 0&&(Os.text=t)},"setNewReqText"),tBe=v(t=>{Os!==void 0&&(Os.risk=t)},"setNewReqRisk"),rBe=v(t=>{Os!==void 0&&(Os.verifyMethod=t)},"setNewReqVerifyMethod"),nBe=v(t=>(J2.has(t)||(J2.set(t,{name:t,type:uf.type,docRef:uf.docRef}),re.info("Added new requirement: ",t)),uf={},J2.get(t)),"addElement"),iBe=v(()=>J2,"getElements"),aBe=v(t=>{uf!==void 0&&(uf.type=t)},"setNewElementType"),sBe=v(t=>{uf!==void 0&&(uf.docRef=t)},"setNewElementDocRef"),oBe=v((t,e,r)=>{gM.push({type:t,src:e,dst:r})},"addRelationship"),lBe=v(()=>gM,"getRelationships"),cBe=v(()=>{gM=[],Os={},Q2=new Map,uf={},J2=new Map,xr()},"clear"),uBe={RequirementType:YPe,RiskLevel:XPe,VerifyType:jPe,Relationships:KPe,getConfig:v(()=>pe().req,"getConfig"),addRequirement:ZPe,getRequirements:QPe,setNewReqId:JPe,setNewReqText:eBe,setNewReqRisk:tBe,setNewReqVerifyMethod:rBe,setAccTitle:Tr,getAccTitle:_r,setAccDescription:Lr,getAccDescription:Rr,addElement:nBe,getElements:iBe,setNewElementType:aBe,setNewElementDocRef:sBe,addRelationship:oBe,getRelationships:lBe,clear:cBe},hBe=v(t=>` marker { fill: ${t.relationColor}; stroke: ${t.relationColor}; } marker.cross { stroke: ${t.lineColor}; } svg { font-family: ${t.fontFamily}; font-size: ${t.fontSize}; } .reqBox { fill: ${t.requirementBackground}; fill-opacity: 1.0; stroke: ${t.requirementBorderColor}; stroke-width: ${t.requirementBorderSize}; } .reqTitle, .reqLabel{ fill: ${t.requirementTextColor}; } .reqLabelBox { fill: ${t.relationLabelBackground}; fill-opacity: 1.0; } .req-title-line { stroke: ${t.requirementBorderColor}; stroke-width: ${t.requirementBorderSize}; } .relationshipLine { stroke: ${t.relationColor}; stroke-width: 1; } .relationshipLabel { fill: ${t.relationLabelColor}; } `,"getStyles"),fBe=hBe,pM={CONTAINS:"contains",ARROW:"arrow"},dBe=v((t,e)=>{let r=t.append("defs").append("marker").attr("id",pM.CONTAINS+"_line_ending").attr("refX",0).attr("refY",e.line_height/2).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("g");r.append("circle").attr("cx",e.line_height/2).attr("cy",e.line_height/2).attr("r",e.line_height/2).attr("fill","none"),r.append("line").attr("x1",0).attr("x2",e.line_height).attr("y1",e.line_height/2).attr("y2",e.line_height/2).attr("stroke-width",1),r.append("line").attr("y1",0).attr("y2",e.line_height).attr("x1",e.line_height/2).attr("x2",e.line_height/2).attr("stroke-width",1),t.append("defs").append("marker").attr("id",pM.ARROW+"_line_ending").attr("refX",e.line_height).attr("refY",.5*e.line_height).attr("markerWidth",e.line_height).attr("markerHeight",e.line_height).attr("orient","auto").append("path").attr("d",`M0,0 L${e.line_height},${e.line_height/2} M${e.line_height},${e.line_height/2} L0,${e.line_height}`).attr("stroke-width",1)},"insertLineEndings"),sue={ReqMarkers:pM,insertLineEndings:dBe},ri={},aue=0,oue=v((t,e)=>t.insert("rect","#"+e).attr("class","req reqBox").attr("x",0).attr("y",0).attr("width",ri.rect_min_width+"px").attr("height",ri.rect_min_height+"px"),"newRectNode"),lue=v((t,e,r)=>{let n=ri.rect_min_width/2,i=t.append("text").attr("class","req reqLabel reqTitle").attr("id",e).attr("x",n).attr("y",ri.rect_padding).attr("dominant-baseline","hanging"),a=0;r.forEach(u=>{a==0?i.append("tspan").attr("text-anchor","middle").attr("x",ri.rect_min_width/2).attr("dy",0).text(u):i.append("tspan").attr("text-anchor","middle").attr("x",ri.rect_min_width/2).attr("dy",ri.line_height*.75).text(u),a++});let s=1.5*ri.rect_padding,o=a*ri.line_height*.75,l=s+o;return t.append("line").attr("class","req-title-line").attr("x1","0").attr("x2",ri.rect_min_width).attr("y1",l).attr("y2",l),{titleNode:i,y:l}},"newTitleNode"),cue=v((t,e,r,n)=>{let i=t.append("text").attr("class","req reqLabel").attr("id",e).attr("x",ri.rect_padding).attr("y",n).attr("dominant-baseline","hanging"),a=0,s=30,o=[];return r.forEach(l=>{let u=l.length;for(;u>s&&a<3;){let h=l.substring(0,s);l=l.substring(s,l.length),u=l.length,o[o.length]=h,a++}if(a==3){let h=o[o.length-1];o[o.length-1]=h.substring(0,h.length-4)+"..."}else o[o.length]=l;a=0}),o.forEach(l=>{i.append("tspan").attr("x",ri.rect_padding).attr("dy",ri.line_height).text(l)}),i},"newBodyNode"),pBe=v((t,e,r,n)=>{let i=e.node().getTotalLength(),a=e.node().getPointAtLength(i*.5),s="rel"+aue;aue++;let l=t.append("text").attr("class","req relationshipLabel").attr("id",s).attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(n).node().getBBox();t.insert("rect","#"+s).attr("class","req reqLabelBox").attr("x",a.x-l.width/2).attr("y",a.y-l.height/2).attr("width",l.width).attr("height",l.height).attr("fill","white").attr("fill-opacity","85%")},"addEdgeLabel"),gBe=v(function(t,e,r,n,i){let a=r.edge(Cm(e.src),Cm(e.dst)),s=ms().x(function(l){return l.x}).y(function(l){return l.y}),o=t.insert("path","#"+n).attr("class","er relationshipLine").attr("d",s(a.points)).attr("fill","none");e.type==i.db.Relationships.CONTAINS?o.attr("marker-start","url("+Xe.getUrl(ri.arrowMarkerAbsolute)+"#"+e.type+"_line_ending)"):(o.attr("stroke-dasharray","10,7"),o.attr("marker-end","url("+Xe.getUrl(ri.arrowMarkerAbsolute)+"#"+sue.ReqMarkers.ARROW+"_line_ending)")),pBe(t,o,ri,`<<${e.type}>>`)},"drawRelationshipFromLayout"),mBe=v((t,e,r)=>{t.forEach((n,i)=>{i=Cm(i),re.info("Added new requirement: ",i);let a=r.append("g").attr("id",i),s="req-"+i,o=oue(a,s),l=[],u=lue(a,i+"_title",[`<<${n.type}>>`,`${n.name}`]);l.push(u.titleNode);let h=cue(a,i+"_body",[`Id: ${n.id}`,`Text: ${n.text}`,`Risk: ${n.risk}`,`Verification: ${n.verifyMethod}`],u.y);l.push(h);let f=o.node().getBBox();e.setNode(i,{width:f.width,height:f.height,shape:"rect",id:i})})},"drawReqs"),vBe=v((t,e,r)=>{t.forEach((n,i)=>{let a=Cm(i),s=r.append("g").attr("id",a),o="element-"+a,l=oue(s,o),u=[],h=lue(s,o+"_title",["<>",`${i}`]);u.push(h.titleNode);let f=cue(s,o+"_body",[`Type: ${n.type||"Not Specified"}`,`Doc Ref: ${n.docRef||"None"}`],h.y);u.push(f);let d=l.node().getBBox();e.setNode(a,{width:d.width,height:d.height,shape:"rect",id:a})})},"drawElements"),yBe=v((t,e)=>(t.forEach(function(r){let n=Cm(r.src),i=Cm(r.dst);e.setEdge(n,i,{relationship:r})}),t),"addRelationships"),xBe=v(function(t,e){e.nodes().forEach(function(r){r!==void 0&&e.node(r)!==void 0&&(t.select("#"+r),t.select("#"+r).attr("transform","translate("+(e.node(r).x-e.node(r).width/2)+","+(e.node(r).y-e.node(r).height/2)+" )"))})},"adjustEntities"),Cm=v(t=>t.replace(/\s/g,"").replace(/\./g,"_"),"elementString"),bBe=v((t,e,r,n)=>{ri=pe().requirement;let i=ri.securityLevel,a;i==="sandbox"&&(a=Ve("#i"+e));let o=(i==="sandbox"?Ve(a.nodes()[0].contentDocument.body):Ve("body")).select(`[id='${e}']`);sue.insertLineEndings(o,ri);let l=new Sr({multigraph:!1,compound:!1,directed:!0}).setGraph({rankdir:ri.layoutDirection,marginx:20,marginy:20,nodesep:100,edgesep:100,ranksep:100}).setDefaultEdgeLabel(function(){return{}}),u=n.db.getRequirements(),h=n.db.getElements(),f=n.db.getRelationships();mBe(u,l,o),vBe(h,l,o),yBe(f,l),Ru(l),xBe(o,l),f.forEach(function(y){gBe(o,y,l,e,n)});let d=ri.rect_padding,p=o.node().getBBox(),g=p.width+d*2,m=p.height+d*2;Hr(o,m,g,ri.useMaxWidth),o.attr("viewBox",`${p.x-d} ${p.y-d} ${g} ${m}`)},"draw"),wBe={draw:bBe},kBe={parser:qPe,db:uBe,renderer:wBe,styles:fBe}});var Due={};vr(Due,{diagram:()=>kFe});function YT(t,e){if(t.links==null)t.links=e;else for(let r in e)t.links[r]=e[r]}function bM(t,e){if(t.properties==null)t.properties=e;else for(let r in e)t.properties[r]=e[r]}function xue(){Dt.records.currentBox=void 0}async function _ue(t,e){Qe.bumpVerticalPos(10);let{startx:r,stopx:n,message:i}=e,a=Xe.splitBreaks(i).length,s=Ei(i),o=s?await ep(i,pe()):Ut.calculateTextDimensions(i,x0(Le));if(!s){let f=o.height/a;e.height+=f,Qe.bumpVerticalPos(f)}let l,u=o.height-10,h=o.width;if(r===n){l=Qe.getVerticalPos()+u,Le.rightAngles||(u+=Le.boxMargin,l=Qe.getVerticalPos()+u),u+=30;let f=Xe.getMax(h/2,Le.width/2);Qe.insert(r-f,Qe.getVerticalPos()-10+u,n+f,Qe.getVerticalPos()+30+u)}else u+=Le.boxMargin,l=Qe.getVerticalPos()+u,Qe.insert(r,l-10,n,l);return Qe.bumpVerticalPos(u),e.height+=u,e.stopy=e.starty+e.height,Qe.insert(e.fromBounds,e.starty,e.toBounds,e.stopy),l}function Il(t,e,r,n,i){Qe.bumpVerticalPos(r);let a=n;if(e.id&&e.message&&t[e.id]){let s=t[e.id].width,o=x0(Le);e.message=Ut.wrapLabel(`[${e.message}]`,s-2*Le.wrapPadding,o),e.width=s,e.wrap=!0;let l=Ut.calculateTextDimensions(e.message,o),u=Xe.getMax(l.height,Le.labelBoxHeight);a=n+u,re.debug(`${u} - ${e.message}`)}i(e),Qe.bumpVerticalPos(a)}function Nue(t,e,r,n,i,a,s){function o(u,h){u.x{let s=x0(Le),o=a.actorKeys.reduce((h,f)=>h+=t.get(f).width+(t.get(f).margin||0),0);o-=2*Le.boxTextMargin,a.wrap&&(a.name=Ut.wrapLabel(a.name,o-2*Le.wrapPadding,s));let l=Ut.calculateTextDimensions(a.name,s);i=Xe.getMax(l.height,i);let u=Xe.getMax(o,l.width+2*Le.wrapPadding);if(a.margin=Le.boxTextMargin,oa.textMaxHeight=i),Xe.getMax(n,Le.height)}var wM,mM,TBe,Dt,EBe,vM,SBe,CBe,ui,ABe,_Be,LBe,RBe,NBe,IBe,MBe,tx,DBe,OBe,PBe,BBe,FBe,gue,y0,zBe,$Be,GBe,ex,UBe,VBe,mue,vue,WBe,yue,bue,HBe,wue,fue,qBe,YBe,v0,kue,Tue,XBe,due,kM,jBe,KBe,qT,_m,Eue,zc,Sue,ZBe,QBe,JBe,eFe,tFe,rFe,nFe,Cue,iFe,aFe,sFe,oFe,lFe,cFe,uFe,Aue,hFe,TM,fFe,hi,Le,Qe,dFe,x0,Am,yM,pFe,gFe,xM,Lue,Rue,XT,pue,mFe,vFe,yFe,xFe,bFe,wFe,kFe,Oue=F(()=>{Rw();Hw();kn();or();lr();wM=Gi(hp(),1),mM=function(){var t=v(function(W,Y,Z,se){for(Z=Z||{},se=W.length;se--;Z[W[se]]=Y);return Z},"o"),e=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,13],l=[1,14],u=[1,16],h=[1,17],f=[1,18],d=[1,24],p=[1,25],g=[1,26],m=[1,27],y=[1,28],x=[1,29],b=[1,30],w=[1,31],_=[1,32],k=[1,33],E=[1,34],L=[1,35],S=[1,36],C=[1,37],M=[1,38],R=[1,39],T=[1,41],I=[1,42],A=[1,43],D=[1,44],N=[1,45],O=[1,46],B=[1,4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,48,49,50,52,53,54,59,60,61,62,70],P=[4,5,16,50,52,53],$=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],z=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,49,50,52,53,54,59,60,61,62,70],H=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,48,50,52,53,54,59,60,61,62,70],J=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,50,52,53,54,59,60,61,62,70],X=[68,69,70],oe=[1,122],K={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,box_section:10,box_line:11,participant_statement:12,create:13,box:14,restOfLine:15,end:16,signal:17,autonumber:18,NUM:19,off:20,activate:21,actor:22,deactivate:23,note_statement:24,links_statement:25,link_statement:26,properties_statement:27,details_statement:28,title:29,legacy_title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,loop:36,rect:37,opt:38,alt:39,else_sections:40,par:41,par_sections:42,par_over:43,critical:44,option_sections:45,break:46,option:47,and:48,else:49,participant:50,AS:51,participant_actor:52,destroy:53,note:54,placement:55,text2:56,over:57,actor_pair:58,links:59,link:60,properties:61,details:62,spaceList:63,",":64,left_of:65,right_of:66,signaltype:67,"+":68,"-":69,ACTOR:70,SOLID_OPEN_ARROW:71,DOTTED_OPEN_ARROW:72,SOLID_ARROW:73,BIDIRECTIONAL_SOLID_ARROW:74,DOTTED_ARROW:75,BIDIRECTIONAL_DOTTED_ARROW:76,SOLID_CROSS:77,DOTTED_CROSS:78,SOLID_POINT:79,DOTTED_POINT:80,TXT:81,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",13:"create",14:"box",15:"restOfLine",16:"end",18:"autonumber",19:"NUM",20:"off",21:"activate",23:"deactivate",29:"title",30:"legacy_title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"loop",37:"rect",38:"opt",39:"alt",41:"par",43:"par_over",44:"critical",46:"break",47:"option",48:"and",49:"else",50:"participant",51:"AS",52:"participant_actor",53:"destroy",54:"note",57:"over",59:"links",60:"link",61:"properties",62:"details",64:",",65:"left_of",66:"right_of",68:"+",69:"-",70:"ACTOR",71:"SOLID_OPEN_ARROW",72:"DOTTED_OPEN_ARROW",73:"SOLID_ARROW",74:"BIDIRECTIONAL_SOLID_ARROW",75:"DOTTED_ARROW",76:"BIDIRECTIONAL_DOTTED_ARROW",77:"SOLID_CROSS",78:"DOTTED_CROSS",79:"SOLID_POINT",80:"DOTTED_POINT",81:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[10,0],[10,2],[11,2],[11,1],[11,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[45,1],[45,4],[42,1],[42,4],[40,1],[40,4],[12,5],[12,3],[12,5],[12,3],[12,3],[24,4],[24,4],[25,3],[26,3],[27,3],[28,3],[63,2],[63,1],[58,3],[58,1],[55,1],[55,1],[17,5],[17,5],[17,4],[22,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[56,1]],performAction:v(function(Y,Z,se,ce,ue,te,Ne){var ae=te.length-1;switch(ue){case 3:return ce.apply(te[ae]),te[ae];break;case 4:case 9:this.$=[];break;case 5:case 10:te[ae-1].push(te[ae]),this.$=te[ae-1];break;case 6:case 7:case 11:case 12:this.$=te[ae];break;case 8:case 13:this.$=[];break;case 15:te[ae].type="createParticipant",this.$=te[ae];break;case 16:te[ae-1].unshift({type:"boxStart",boxData:ce.parseBoxData(te[ae-2])}),te[ae-1].push({type:"boxEnd",boxText:te[ae-2]}),this.$=te[ae-1];break;case 18:this.$={type:"sequenceIndex",sequenceIndex:Number(te[ae-2]),sequenceIndexStep:Number(te[ae-1]),sequenceVisible:!0,signalType:ce.LINETYPE.AUTONUMBER};break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(te[ae-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:ce.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:ce.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:ce.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"activeStart",signalType:ce.LINETYPE.ACTIVE_START,actor:te[ae-1].actor};break;case 23:this.$={type:"activeEnd",signalType:ce.LINETYPE.ACTIVE_END,actor:te[ae-1].actor};break;case 29:ce.setDiagramTitle(te[ae].substring(6)),this.$=te[ae].substring(6);break;case 30:ce.setDiagramTitle(te[ae].substring(7)),this.$=te[ae].substring(7);break;case 31:this.$=te[ae].trim(),ce.setAccTitle(this.$);break;case 32:case 33:this.$=te[ae].trim(),ce.setAccDescription(this.$);break;case 34:te[ae-1].unshift({type:"loopStart",loopText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.LOOP_START}),te[ae-1].push({type:"loopEnd",loopText:te[ae-2],signalType:ce.LINETYPE.LOOP_END}),this.$=te[ae-1];break;case 35:te[ae-1].unshift({type:"rectStart",color:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.RECT_START}),te[ae-1].push({type:"rectEnd",color:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.RECT_END}),this.$=te[ae-1];break;case 36:te[ae-1].unshift({type:"optStart",optText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.OPT_START}),te[ae-1].push({type:"optEnd",optText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.OPT_END}),this.$=te[ae-1];break;case 37:te[ae-1].unshift({type:"altStart",altText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.ALT_START}),te[ae-1].push({type:"altEnd",signalType:ce.LINETYPE.ALT_END}),this.$=te[ae-1];break;case 38:te[ae-1].unshift({type:"parStart",parText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.PAR_START}),te[ae-1].push({type:"parEnd",signalType:ce.LINETYPE.PAR_END}),this.$=te[ae-1];break;case 39:te[ae-1].unshift({type:"parStart",parText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.PAR_OVER_START}),te[ae-1].push({type:"parEnd",signalType:ce.LINETYPE.PAR_END}),this.$=te[ae-1];break;case 40:te[ae-1].unshift({type:"criticalStart",criticalText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.CRITICAL_START}),te[ae-1].push({type:"criticalEnd",signalType:ce.LINETYPE.CRITICAL_END}),this.$=te[ae-1];break;case 41:te[ae-1].unshift({type:"breakStart",breakText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.BREAK_START}),te[ae-1].push({type:"breakEnd",optText:ce.parseMessage(te[ae-2]),signalType:ce.LINETYPE.BREAK_END}),this.$=te[ae-1];break;case 43:this.$=te[ae-3].concat([{type:"option",optionText:ce.parseMessage(te[ae-1]),signalType:ce.LINETYPE.CRITICAL_OPTION},te[ae]]);break;case 45:this.$=te[ae-3].concat([{type:"and",parText:ce.parseMessage(te[ae-1]),signalType:ce.LINETYPE.PAR_AND},te[ae]]);break;case 47:this.$=te[ae-3].concat([{type:"else",altText:ce.parseMessage(te[ae-1]),signalType:ce.LINETYPE.ALT_ELSE},te[ae]]);break;case 48:te[ae-3].draw="participant",te[ae-3].type="addParticipant",te[ae-3].description=ce.parseMessage(te[ae-1]),this.$=te[ae-3];break;case 49:te[ae-1].draw="participant",te[ae-1].type="addParticipant",this.$=te[ae-1];break;case 50:te[ae-3].draw="actor",te[ae-3].type="addParticipant",te[ae-3].description=ce.parseMessage(te[ae-1]),this.$=te[ae-3];break;case 51:te[ae-1].draw="actor",te[ae-1].type="addParticipant",this.$=te[ae-1];break;case 52:te[ae-1].type="destroyParticipant",this.$=te[ae-1];break;case 53:this.$=[te[ae-1],{type:"addNote",placement:te[ae-2],actor:te[ae-1].actor,text:te[ae]}];break;case 54:te[ae-2]=[].concat(te[ae-1],te[ae-1]).slice(0,2),te[ae-2][0]=te[ae-2][0].actor,te[ae-2][1]=te[ae-2][1].actor,this.$=[te[ae-1],{type:"addNote",placement:ce.PLACEMENT.OVER,actor:te[ae-2].slice(0,2),text:te[ae]}];break;case 55:this.$=[te[ae-1],{type:"addLinks",actor:te[ae-1].actor,text:te[ae]}];break;case 56:this.$=[te[ae-1],{type:"addALink",actor:te[ae-1].actor,text:te[ae]}];break;case 57:this.$=[te[ae-1],{type:"addProperties",actor:te[ae-1].actor,text:te[ae]}];break;case 58:this.$=[te[ae-1],{type:"addDetails",actor:te[ae-1].actor,text:te[ae]}];break;case 61:this.$=[te[ae-2],te[ae]];break;case 62:this.$=te[ae];break;case 63:this.$=ce.PLACEMENT.LEFTOF;break;case 64:this.$=ce.PLACEMENT.RIGHTOF;break;case 65:this.$=[te[ae-4],te[ae-1],{type:"addMessage",from:te[ae-4].actor,to:te[ae-1].actor,signalType:te[ae-3],msg:te[ae],activate:!0},{type:"activeStart",signalType:ce.LINETYPE.ACTIVE_START,actor:te[ae-1].actor}];break;case 66:this.$=[te[ae-4],te[ae-1],{type:"addMessage",from:te[ae-4].actor,to:te[ae-1].actor,signalType:te[ae-3],msg:te[ae]},{type:"activeEnd",signalType:ce.LINETYPE.ACTIVE_END,actor:te[ae-4].actor}];break;case 67:this.$=[te[ae-3],te[ae-1],{type:"addMessage",from:te[ae-3].actor,to:te[ae-1].actor,signalType:te[ae-2],msg:te[ae]}];break;case 68:this.$={type:"addParticipant",actor:te[ae]};break;case 69:this.$=ce.LINETYPE.SOLID_OPEN;break;case 70:this.$=ce.LINETYPE.DOTTED_OPEN;break;case 71:this.$=ce.LINETYPE.SOLID;break;case 72:this.$=ce.LINETYPE.BIDIRECTIONAL_SOLID;break;case 73:this.$=ce.LINETYPE.DOTTED;break;case 74:this.$=ce.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 75:this.$=ce.LINETYPE.SOLID_CROSS;break;case 76:this.$=ce.LINETYPE.DOTTED_CROSS;break;case 77:this.$=ce.LINETYPE.SOLID_POINT;break;case 78:this.$=ce.LINETYPE.DOTTED_POINT;break;case 79:this.$=ce.parseMessage(te[ae].trim().substring(1));break}},"anonymous"),table:[{3:1,4:e,5:r,6:n},{1:[3]},{3:5,4:e,5:r,6:n},{3:6,4:e,5:r,6:n},t([1,4,5,13,14,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,12:12,13:o,14:l,17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},t(B,[2,5]),{9:47,12:12,13:o,14:l,17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},t(B,[2,7]),t(B,[2,8]),t(B,[2,14]),{12:48,50:C,52:M,53:R},{15:[1,49]},{5:[1,50]},{5:[1,53],19:[1,51],20:[1,52]},{22:54,70:O},{22:55,70:O},{5:[1,56]},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},t(B,[2,29]),t(B,[2,30]),{32:[1,61]},{34:[1,62]},t(B,[2,33]),{15:[1,63]},{15:[1,64]},{15:[1,65]},{15:[1,66]},{15:[1,67]},{15:[1,68]},{15:[1,69]},{15:[1,70]},{22:71,70:O},{22:72,70:O},{22:73,70:O},{67:74,71:[1,75],72:[1,76],73:[1,77],74:[1,78],75:[1,79],76:[1,80],77:[1,81],78:[1,82],79:[1,83],80:[1,84]},{55:85,57:[1,86],65:[1,87],66:[1,88]},{22:89,70:O},{22:90,70:O},{22:91,70:O},{22:92,70:O},t([5,51,64,71,72,73,74,75,76,77,78,79,80,81],[2,68]),t(B,[2,6]),t(B,[2,15]),t(P,[2,9],{10:93}),t(B,[2,17]),{5:[1,95],19:[1,94]},{5:[1,96]},t(B,[2,21]),{5:[1,97]},{5:[1,98]},t(B,[2,24]),t(B,[2,25]),t(B,[2,26]),t(B,[2,27]),t(B,[2,28]),t(B,[2,31]),t(B,[2,32]),t($,i,{7:99}),t($,i,{7:100}),t($,i,{7:101}),t(z,i,{40:102,7:103}),t(H,i,{42:104,7:105}),t(H,i,{7:105,42:106}),t(J,i,{45:107,7:108}),t($,i,{7:109}),{5:[1,111],51:[1,110]},{5:[1,113],51:[1,112]},{5:[1,114]},{22:117,68:[1,115],69:[1,116],70:O},t(X,[2,69]),t(X,[2,70]),t(X,[2,71]),t(X,[2,72]),t(X,[2,73]),t(X,[2,74]),t(X,[2,75]),t(X,[2,76]),t(X,[2,77]),t(X,[2,78]),{22:118,70:O},{22:120,58:119,70:O},{70:[2,63]},{70:[2,64]},{56:121,81:oe},{56:123,81:oe},{56:124,81:oe},{56:125,81:oe},{4:[1,128],5:[1,130],11:127,12:129,16:[1,126],50:C,52:M,53:R},{5:[1,131]},t(B,[2,19]),t(B,[2,20]),t(B,[2,22]),t(B,[2,23]),{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[1,132],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[1,133],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[1,134],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{16:[1,135]},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[2,46],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,49:[1,136],50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{16:[1,137]},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[2,44],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,48:[1,138],50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{16:[1,139]},{16:[1,140]},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[2,42],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,47:[1,141],50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{4:a,5:s,8:8,9:10,12:12,13:o,14:l,16:[1,142],17:15,18:u,21:h,22:40,23:f,24:19,25:20,26:21,27:22,28:23,29:d,30:p,31:g,33:m,35:y,36:x,37:b,38:w,39:_,41:k,43:E,44:L,46:S,50:C,52:M,53:R,54:T,59:I,60:A,61:D,62:N,70:O},{15:[1,143]},t(B,[2,49]),{15:[1,144]},t(B,[2,51]),t(B,[2,52]),{22:145,70:O},{22:146,70:O},{56:147,81:oe},{56:148,81:oe},{56:149,81:oe},{64:[1,150],81:[2,62]},{5:[2,55]},{5:[2,79]},{5:[2,56]},{5:[2,57]},{5:[2,58]},t(B,[2,16]),t(P,[2,10]),{12:151,50:C,52:M,53:R},t(P,[2,12]),t(P,[2,13]),t(B,[2,18]),t(B,[2,34]),t(B,[2,35]),t(B,[2,36]),t(B,[2,37]),{15:[1,152]},t(B,[2,38]),{15:[1,153]},t(B,[2,39]),t(B,[2,40]),{15:[1,154]},t(B,[2,41]),{5:[1,155]},{5:[1,156]},{56:157,81:oe},{56:158,81:oe},{5:[2,67]},{5:[2,53]},{5:[2,54]},{22:159,70:O},t(P,[2,11]),t(z,i,{7:103,40:160}),t(H,i,{7:105,42:161}),t(J,i,{7:108,45:162}),t(B,[2,48]),t(B,[2,50]),{5:[2,65]},{5:[2,66]},{81:[2,61]},{16:[2,47]},{16:[2,45]},{16:[2,43]}],defaultActions:{5:[2,1],6:[2,2],87:[2,63],88:[2,64],121:[2,55],122:[2,79],123:[2,56],124:[2,57],125:[2,58],147:[2,67],148:[2,53],149:[2,54],157:[2,65],158:[2,66],159:[2,61],160:[2,47],161:[2,45],162:[2,43]},parseError:v(function(Y,Z){if(Z.recoverable)this.trace(Y);else{var se=new Error(Y);throw se.hash=Z,se}},"parseError"),parse:v(function(Y){var Z=this,se=[0],ce=[],ue=[null],te=[],Ne=this.table,ae="",we=0,Ie=0,Ee=0,Oe=2,De=1,We=te.slice.call(arguments,1),Re=Object.create(this.lexer),Pe={yy:{}};for(var xe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,xe)&&(Pe.yy[xe]=this.yy[xe]);Re.setInput(Y,Pe.yy),Pe.yy.lexer=Re,Pe.yy.parser=this,typeof Re.yylloc>"u"&&(Re.yylloc={});var q=Re.yylloc;te.push(q);var de=Re.options&&Re.options.ranges;typeof Pe.yy.parseError=="function"?this.parseError=Pe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ie(xt){se.length=se.length-2*xt,ue.length=ue.length-xt,te.length=te.length-xt}v(ie,"popStack");function he(){var xt;return xt=ce.pop()||Re.lex()||De,typeof xt!="number"&&(xt instanceof Array&&(ce=xt,xt=ce.pop()),xt=Z.symbols_[xt]||xt),xt}v(he,"lex");for(var U,ke,j,ye,Ae,Ge,Fe={},ge,$e,Ce,qe;;){if(j=se[se.length-1],this.defaultActions[j]?ye=this.defaultActions[j]:((U===null||typeof U>"u")&&(U=he()),ye=Ne[j]&&Ne[j][U]),typeof ye>"u"||!ye.length||!ye[0]){var lt="";qe=[];for(ge in Ne[j])this.terminals_[ge]&&ge>Oe&&qe.push("'"+this.terminals_[ge]+"'");Re.showPosition?lt="Parse error on line "+(we+1)+`: `+Re.showPosition()+` Expecting `+qe.join(", ")+", got '"+(this.terminals_[U]||U)+"'":lt="Parse error on line "+(we+1)+": Unexpected "+(U==De?"end of input":"'"+(this.terminals_[U]||U)+"'"),this.parseError(lt,{text:Re.match,token:this.terminals_[U]||U,line:Re.yylineno,loc:q,expected:qe})}if(ye[0]instanceof Array&&ye.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+U);switch(ye[0]){case 1:se.push(U),ue.push(Re.yytext),te.push(Re.yylloc),se.push(ye[1]),U=null,ke?(U=ke,ke=null):(Ie=Re.yyleng,ae=Re.yytext,we=Re.yylineno,q=Re.yylloc,Ee>0&&Ee--);break;case 2:if($e=this.productions_[ye[1]][1],Fe.$=ue[ue.length-$e],Fe._$={first_line:te[te.length-($e||1)].first_line,last_line:te[te.length-1].last_line,first_column:te[te.length-($e||1)].first_column,last_column:te[te.length-1].last_column},de&&(Fe._$.range=[te[te.length-($e||1)].range[0],te[te.length-1].range[1]]),Ge=this.performAction.apply(Fe,[ae,Ie,we,Pe.yy,ye[1],ue,te].concat(We)),typeof Ge<"u")return Ge;$e&&(se=se.slice(0,-1*$e*2),ue=ue.slice(0,-1*$e),te=te.slice(0,-1*$e)),se.push(this.productions_[ye[1]][0]),ue.push(Fe.$),te.push(Fe._$),Ce=Ne[se[se.length-2]][se[se.length-1]],se.push(Ce);break;case 3:return!0}}return!0},"parse")},ee=function(){var W={EOF:1,parseError:v(function(Z,se){if(this.yy.parser)this.yy.parser.parseError(Z,se);else throw new Error(Z)},"parseError"),setInput:v(function(Y,Z){return this.yy=Z||this.yy||{},this._input=Y,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var Y=this._input[0];this.yytext+=Y,this.yyleng++,this.offset++,this.match+=Y,this.matched+=Y;var Z=Y.match(/(?:\r\n?|\n).*/g);return Z?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Y},"input"),unput:v(function(Y){var Z=Y.length,se=Y.split(/(?:\r\n?|\n)/g);this._input=Y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Z),this.offset-=Z;var ce=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),se.length-1&&(this.yylineno-=se.length-1);var ue=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:se?(se.length===ce.length?this.yylloc.first_column:0)+ce[ce.length-se.length].length-se[0].length:this.yylloc.first_column-Z},this.options.ranges&&(this.yylloc.range=[ue[0],ue[0]+this.yyleng-Z]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(Y){this.unput(this.match.slice(Y))},"less"),pastInput:v(function(){var Y=this.matched.substr(0,this.matched.length-this.match.length);return(Y.length>20?"...":"")+Y.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var Y=this.match;return Y.length<20&&(Y+=this._input.substr(0,20-Y.length)),(Y.substr(0,20)+(Y.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var Y=this.pastInput(),Z=new Array(Y.length+1).join("-");return Y+this.upcomingInput()+` `+Z+"^"},"showPosition"),test_match:v(function(Y,Z){var se,ce,ue;if(this.options.backtrack_lexer&&(ue={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(ue.yylloc.range=this.yylloc.range.slice(0))),ce=Y[0].match(/(?:\r\n?|\n).*/g),ce&&(this.yylineno+=ce.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ce?ce[ce.length-1].length-ce[ce.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Y[0].length},this.yytext+=Y[0],this.match+=Y[0],this.matches=Y,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Y[0].length),this.matched+=Y[0],se=this.performAction.call(this,this.yy,this,Z,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),se)return se;if(this._backtrack){for(var te in ue)this[te]=ue[te];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Y,Z,se,ce;this._more||(this.yytext="",this.match="");for(var ue=this._currentRules(),te=0;teZ[0].length)){if(Z=se,ce=te,this.options.backtrack_lexer){if(Y=this.test_match(se,ue[te]),Y!==!1)return Y;if(this._backtrack){Z=!1;continue}else return!1}else if(!this.options.flex)break}return Z?(Y=this.test_match(Z,ue[ce]),Y!==!1?Y:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var Z=this.next();return Z||this.lex()},"lex"),begin:v(function(Z){this.conditionStack.push(Z)},"begin"),popState:v(function(){var Z=this.conditionStack.length-1;return Z>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(Z){return Z=this.conditionStack.length-1-Math.abs(Z||0),Z>=0?this.conditionStack[Z]:"INITIAL"},"topState"),pushState:v(function(Z){this.begin(Z)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(Z,se,ce,ue){var te=ue;switch(ce){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 19;case 7:return this.begin("LINE"),14;break;case 8:return this.begin("ID"),50;break;case 9:return this.begin("ID"),52;break;case 10:return 13;case 11:return this.begin("ID"),53;break;case 12:return se.yytext=se.yytext.trim(),this.begin("ALIAS"),70;break;case 13:return this.popState(),this.popState(),this.begin("LINE"),51;break;case 14:return this.popState(),this.popState(),5;break;case 15:return this.begin("LINE"),36;break;case 16:return this.begin("LINE"),37;break;case 17:return this.begin("LINE"),38;break;case 18:return this.begin("LINE"),39;break;case 19:return this.begin("LINE"),49;break;case 20:return this.begin("LINE"),41;break;case 21:return this.begin("LINE"),43;break;case 22:return this.begin("LINE"),48;break;case 23:return this.begin("LINE"),44;break;case 24:return this.begin("LINE"),47;break;case 25:return this.begin("LINE"),46;break;case 26:return this.popState(),15;break;case 27:return 16;case 28:return 65;case 29:return 66;case 30:return 59;case 31:return 60;case 32:return 61;case 33:return 62;case 34:return 57;case 35:return 54;case 36:return this.begin("ID"),21;break;case 37:return this.begin("ID"),23;break;case 38:return 29;case 39:return 30;case 40:return this.begin("acc_title"),31;break;case 41:return this.popState(),"acc_title_value";break;case 42:return this.begin("acc_descr"),33;break;case 43:return this.popState(),"acc_descr_value";break;case 44:this.begin("acc_descr_multiline");break;case 45:this.popState();break;case 46:return"acc_descr_multiline_value";case 47:return 6;case 48:return 18;case 49:return 20;case 50:return 64;case 51:return 5;case 52:return se.yytext=se.yytext.trim(),70;break;case 53:return 73;case 54:return 74;case 55:return 75;case 56:return 76;case 57:return 71;case 58:return 72;case 59:return 77;case 60:return 78;case 61:return 79;case 62:return 80;case 63:return 81;case 64:return 68;case 65:return 69;case 66:return 5;case 67:return"INVALID"}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:[^\<->\->:\n,;]+?([\-]*[^\<->\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\<->\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\<->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[45,46],inclusive:!1},acc_descr:{rules:[43],inclusive:!1},acc_title:{rules:[41],inclusive:!1},ID:{rules:[2,3,12],inclusive:!1},ALIAS:{rules:[2,3,13,14],inclusive:!1},LINE:{rules:[2,3,26],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,7,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,44,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],inclusive:!0}}};return W}();K.lexer=ee;function Q(){this.yy={}}return v(Q,"Parser"),Q.prototype=K,K.Parser=Q,new Q}();mM.parser=mM;TBe=mM,Dt=new Rg(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),EBe=v(function(t){Dt.records.boxes.push({name:t.text,wrap:t.wrap??y0(),fill:t.color,actorKeys:[]}),Dt.records.currentBox=Dt.records.boxes.slice(-1)[0]},"addBox"),vM=v(function(t,e,r,n){let i=Dt.records.currentBox,a=Dt.records.actors.get(t);if(a){if(Dt.records.currentBox&&a.box&&Dt.records.currentBox!==a.box)throw new Error(`A same participant should only be defined in one Box: ${a.name} can't be in '${a.box.name}' and in '${Dt.records.currentBox.name}' at the same time.`);if(i=a.box?a.box:Dt.records.currentBox,a.box=i,a&&e===a.name&&r==null)return}if(r?.text==null&&(r={text:e,type:n}),(n==null||r.text==null)&&(r={text:e,type:n}),Dt.records.actors.set(t,{box:i,name:e,description:r.text,wrap:r.wrap??y0(),prevActor:Dt.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:n??"participant"}),Dt.records.prevActor){let s=Dt.records.actors.get(Dt.records.prevActor);s&&(s.nextActor=t)}Dt.records.currentBox&&Dt.records.currentBox.actorKeys.push(t),Dt.records.prevActor=t},"addActor"),SBe=v(t=>{let e,r=0;if(!t)return 0;for(e=0;e>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},s}return Dt.records.messages.push({from:t,to:e,message:r?.text??"",wrap:r?.wrap??y0(),type:n,activate:i}),!0},"addSignal"),ABe=v(function(){return Dt.records.boxes.length>0},"hasAtLeastOneBox"),_Be=v(function(){return Dt.records.boxes.some(t=>t.name)},"hasAtLeastOneBoxWithTitle"),LBe=v(function(){return Dt.records.messages},"getMessages"),RBe=v(function(){return Dt.records.boxes},"getBoxes"),NBe=v(function(){return Dt.records.actors},"getActors"),IBe=v(function(){return Dt.records.createdActors},"getCreatedActors"),MBe=v(function(){return Dt.records.destroyedActors},"getDestroyedActors"),tx=v(function(t){return Dt.records.actors.get(t)},"getActor"),DBe=v(function(){return[...Dt.records.actors.keys()]},"getActorKeys"),OBe=v(function(){Dt.records.sequenceNumbersEnabled=!0},"enableSequenceNumbers"),PBe=v(function(){Dt.records.sequenceNumbersEnabled=!1},"disableSequenceNumbers"),BBe=v(()=>Dt.records.sequenceNumbersEnabled,"showSequenceNumbers"),FBe=v(function(t){Dt.records.wrapEnabled=t},"setWrap"),gue=v(t=>{if(t===void 0)return{};t=t.trim();let e=/^:?wrap:/.exec(t)!==null?!0:/^:?nowrap:/.exec(t)!==null?!1:void 0;return{cleanedText:(e===void 0?t:t.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:e}},"extractWrap"),y0=v(()=>Dt.records.wrapEnabled!==void 0?Dt.records.wrapEnabled:pe().sequence?.wrap??!1,"autoWrap"),zBe=v(function(){Dt.reset(),xr()},"clear"),$Be=v(function(t){let e=t.trim(),{wrap:r,cleanedText:n}=gue(e),i={text:n,wrap:r};return re.debug(`parseMessage: ${JSON.stringify(i)}`),i},"parseMessage"),GBe=v(function(t){let e=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t),r=e?.[1]?e[1].trim():"transparent",n=e?.[2]?e[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",r)||(r="transparent",n=t.trim());else{let s=new Option().style;s.color=r,s.color!==r&&(r="transparent",n=t.trim())}let{wrap:i,cleanedText:a}=gue(n);return{text:a?yr(a,pe()):void 0,color:r,wrap:i}},"parseBoxData"),ex={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34},UBe={FILLED:0,OPEN:1},VBe={LEFTOF:0,RIGHTOF:1,OVER:2},mue=v(function(t,e,r){let n={actor:t,placement:e,message:r.text,wrap:r.wrap??y0()},i=[].concat(t,t);Dt.records.notes.push(n),Dt.records.messages.push({from:i[0],to:i[1],message:r.text,wrap:r.wrap??y0(),type:ex.NOTE,placement:e})},"addNote"),vue=v(function(t,e){let r=tx(t);try{let n=yr(e.text,pe());n=n.replace(/&/g,"&"),n=n.replace(/=/g,"=");let i=JSON.parse(n);YT(r,i)}catch(n){re.error("error while parsing actor link text",n)}},"addLinks"),WBe=v(function(t,e){let r=tx(t);try{let n={},i=yr(e.text,pe()),a=i.indexOf("@");i=i.replace(/&/g,"&"),i=i.replace(/=/g,"=");let s=i.slice(0,a-1).trim(),o=i.slice(a+1).trim();n[s]=o,YT(r,n)}catch(n){re.error("error while parsing actor link text",n)}},"addALink");v(YT,"insertLinks");yue=v(function(t,e){let r=tx(t);try{let n=yr(e.text,pe()),i=JSON.parse(n);bM(r,i)}catch(n){re.error("error while parsing actor properties text",n)}},"addProperties");v(bM,"insertProperties");v(xue,"boxEnd");bue=v(function(t,e){let r=tx(t),n=document.getElementById(e.text);try{let i=n.innerHTML,a=JSON.parse(i);a.properties&&bM(r,a.properties),a.links&&YT(r,a.links)}catch(i){re.error("error while parsing actor details text",i)}},"addDetails"),HBe=v(function(t,e){if(t?.properties!==void 0)return t.properties[e]},"getActorProperty"),wue=v(function(t){if(Array.isArray(t))t.forEach(function(e){wue(e)});else switch(t.type){case"sequenceIndex":Dt.records.messages.push({from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":vM(t.actor,t.actor,t.description,t.draw);break;case"createParticipant":if(Dt.records.actors.has(t.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");Dt.records.lastCreated=t.actor,vM(t.actor,t.actor,t.description,t.draw),Dt.records.createdActors.set(t.actor,Dt.records.messages.length);break;case"destroyParticipant":Dt.records.lastDestroyed=t.actor,Dt.records.destroyedActors.set(t.actor,Dt.records.messages.length);break;case"activeStart":ui(t.actor,void 0,void 0,t.signalType);break;case"activeEnd":ui(t.actor,void 0,void 0,t.signalType);break;case"addNote":mue(t.actor,t.placement,t.text);break;case"addLinks":vue(t.actor,t.text);break;case"addALink":WBe(t.actor,t.text);break;case"addProperties":yue(t.actor,t.text);break;case"addDetails":bue(t.actor,t.text);break;case"addMessage":if(Dt.records.lastCreated){if(t.to!==Dt.records.lastCreated)throw new Error("The created participant "+Dt.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");Dt.records.lastCreated=void 0}else if(Dt.records.lastDestroyed){if(t.to!==Dt.records.lastDestroyed&&t.from!==Dt.records.lastDestroyed)throw new Error("The destroyed participant "+Dt.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");Dt.records.lastDestroyed=void 0}ui(t.from,t.to,t.msg,t.signalType,t.activate);break;case"boxStart":EBe(t.boxData);break;case"boxEnd":xue();break;case"loopStart":ui(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":ui(void 0,void 0,void 0,t.signalType);break;case"rectStart":ui(void 0,void 0,t.color,t.signalType);break;case"rectEnd":ui(void 0,void 0,void 0,t.signalType);break;case"optStart":ui(void 0,void 0,t.optText,t.signalType);break;case"optEnd":ui(void 0,void 0,void 0,t.signalType);break;case"altStart":ui(void 0,void 0,t.altText,t.signalType);break;case"else":ui(void 0,void 0,t.altText,t.signalType);break;case"altEnd":ui(void 0,void 0,void 0,t.signalType);break;case"setAccTitle":Tr(t.text);break;case"parStart":ui(void 0,void 0,t.parText,t.signalType);break;case"and":ui(void 0,void 0,t.parText,t.signalType);break;case"parEnd":ui(void 0,void 0,void 0,t.signalType);break;case"criticalStart":ui(void 0,void 0,t.criticalText,t.signalType);break;case"option":ui(void 0,void 0,t.optionText,t.signalType);break;case"criticalEnd":ui(void 0,void 0,void 0,t.signalType);break;case"breakStart":ui(void 0,void 0,t.breakText,t.signalType);break;case"breakEnd":ui(void 0,void 0,void 0,t.signalType);break}},"apply"),fue={addActor:vM,addMessage:CBe,addSignal:ui,addLinks:vue,addDetails:bue,addProperties:yue,autoWrap:y0,setWrap:FBe,enableSequenceNumbers:OBe,disableSequenceNumbers:PBe,showSequenceNumbers:BBe,getMessages:LBe,getActors:NBe,getCreatedActors:IBe,getDestroyedActors:MBe,getActor:tx,getActorKeys:DBe,getActorProperty:HBe,getAccTitle:_r,getBoxes:RBe,getDiagramTitle:qr,setDiagramTitle:tn,getConfig:v(()=>pe().sequence,"getConfig"),clear:zBe,parseMessage:$Be,parseBoxData:GBe,LINETYPE:ex,ARROWTYPE:UBe,PLACEMENT:VBe,addNote:mue,setAccTitle:Tr,apply:wue,setAccDescription:Lr,getAccDescription:Rr,hasAtLeastOneBox:ABe,hasAtLeastOneBoxWithTitle:_Be},qBe=v(t=>`.actor { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; } text.actor > tspan { fill: ${t.actorTextColor}; stroke: none; } .actor-line { stroke: ${t.actorLineColor}; } .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: ${t.signalColor}; } .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: ${t.signalColor}; } #arrowhead path { fill: ${t.signalColor}; stroke: ${t.signalColor}; } .sequenceNumber { fill: ${t.sequenceNumberColor}; } #sequencenumber { fill: ${t.signalColor}; } #crosshead path { fill: ${t.signalColor}; stroke: ${t.signalColor}; } .messageText { fill: ${t.signalTextColor}; stroke: none; } .labelBox { stroke: ${t.labelBoxBorderColor}; fill: ${t.labelBoxBkgColor}; } .labelText, .labelText > tspan { fill: ${t.labelTextColor}; stroke: none; } .loopText, .loopText > tspan { fill: ${t.loopTextColor}; stroke: none; } .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: ${t.labelBoxBorderColor}; fill: ${t.labelBoxBorderColor}; } .note { //stroke: #decc93; stroke: ${t.noteBorderColor}; fill: ${t.noteBkgColor}; } .noteText, .noteText > tspan { fill: ${t.noteTextColor}; stroke: none; } .activation0 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .activation1 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .activation2 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .actorPopupMenu { position: absolute; } .actorPopupMenuPanel { position: absolute; fill: ${t.actorBkg}; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)); } .actor-man line { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; } .actor-man circle, line { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; stroke-width: 2px; } `,"getStyles"),YBe=qBe,v0=18*2,kue="actor-top",Tue="actor-bottom",XBe="actor-box",due="actor-man",kM=v(function(t,e){return Dd(t,e)},"drawRect"),jBe=v(function(t,e,r,n,i){if(e.links===void 0||e.links===null||Object.keys(e.links).length===0)return{height:0,width:0};let a=e.links,s=e.actorCnt,o=e.rectData;var l="none";i&&(l="block !important");let u=t.append("g");u.attr("id","actor"+s+"_popup"),u.attr("class","actorPopupMenu"),u.attr("display",l);var h="";o.class!==void 0&&(h=" "+o.class);let f=o.width>r?o.width:r,d=u.append("rect");if(d.attr("class","actorPopupMenuPanel"+h),d.attr("x",o.x),d.attr("y",o.height),d.attr("fill",o.fill),d.attr("stroke",o.stroke),d.attr("width",f),d.attr("height",o.height),d.attr("rx",o.rx),d.attr("ry",o.ry),a!=null){var p=20;for(let y in a){var g=u.append("a"),m=(0,wM.sanitizeUrl)(a[y]);g.attr("xlink:href",m),g.attr("target","_blank"),fFe(n)(y,g,o.x+10,o.height+p,f,20,{class:"actor"},n),p+=30}}return d.attr("height",p),{height:o.height+p,width:f}},"drawPopup"),KBe=v(function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),qT=v(async function(t,e,r=null){let n=t.append("foreignObject"),i=await fh(e.text,Or()),s=n.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(i).node().getBoundingClientRect();if(n.attr("height",Math.round(s.height)).attr("width",Math.round(s.width)),e.class==="noteText"){let o=t.node().firstChild;o.setAttribute("height",s.height+2*e.textMargin);let l=o.getBBox();n.attr("x",Math.round(l.x+l.width/2-s.width/2)).attr("y",Math.round(l.y+l.height/2-s.height/2))}else if(r){let{startx:o,stopx:l,starty:u}=r;if(o>l){let h=o;o=l,l=h}n.attr("x",Math.round(o+Math.abs(o-l)/2-s.width/2)),e.class==="loopText"?n.attr("y",Math.round(u)):n.attr("y",Math.round(u-s.height))}return[n]},"drawKatex"),_m=v(function(t,e){let r=0,n=0,i=e.text.split(Xe.lineBreakRegex),[a,s]=Ro(e.fontSize),o=[],l=0,u=v(()=>e.y,"yfunc");if(e.valign!==void 0&&e.textMargin!==void 0&&e.textMargin>0)switch(e.valign){case"top":case"start":u=v(()=>Math.round(e.y+e.textMargin),"yfunc");break;case"middle":case"center":u=v(()=>Math.round(e.y+(r+n+e.textMargin)/2),"yfunc");break;case"bottom":case"end":u=v(()=>Math.round(e.y+(r+n+2*e.textMargin)-e.textMargin),"yfunc");break}if(e.anchor!==void 0&&e.textMargin!==void 0&&e.width!==void 0)switch(e.anchor){case"left":case"start":e.x=Math.round(e.x+e.textMargin),e.anchor="start",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"middle":case"center":e.x=Math.round(e.x+e.width/2),e.anchor="middle",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"right":case"end":e.x=Math.round(e.x+e.width-e.textMargin),e.anchor="end",e.dominantBaseline="middle",e.alignmentBaseline="middle";break}for(let[h,f]of i.entries()){e.textMargin!==void 0&&e.textMargin===0&&a!==void 0&&(l=h*a);let d=t.append("text");d.attr("x",e.x),d.attr("y",u()),e.anchor!==void 0&&d.attr("text-anchor",e.anchor).attr("dominant-baseline",e.dominantBaseline).attr("alignment-baseline",e.alignmentBaseline),e.fontFamily!==void 0&&d.style("font-family",e.fontFamily),s!==void 0&&d.style("font-size",s),e.fontWeight!==void 0&&d.style("font-weight",e.fontWeight),e.fill!==void 0&&d.attr("fill",e.fill),e.class!==void 0&&d.attr("class",e.class),e.dy!==void 0?d.attr("dy",e.dy):l!==0&&d.attr("dy",l);let p=f||iA;if(e.tspan){let g=d.append("tspan");g.attr("x",e.x),e.fill!==void 0&&g.attr("fill",e.fill),g.text(p)}else d.text(p);e.valign!==void 0&&e.textMargin!==void 0&&e.textMargin>0&&(n+=(d._groups||d)[0][0].getBBox().height,r=n),o.push(d)}return o},"drawText"),Eue=v(function(t,e){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}v(r,"genPoints");let n=t.append("polygon");return n.attr("points",r(e.x,e.y,e.width,e.height,7)),n.attr("class","labelBox"),e.y=e.y+e.height/2,_m(t,e),n},"drawLabel"),zc=-1,Sue=v((t,e,r,n)=>{t.select&&r.forEach(i=>{let a=e.get(i),s=t.select("#actor"+a.actorCnt);!n.mirrorActors&&a.stopy?s.attr("y2",a.stopy+a.height/2):n.mirrorActors&&s.attr("y2",a.stopy)})},"fixLifeLineHeights"),ZBe=v(function(t,e,r,n){let i=n?e.stopy:e.starty,a=e.x+e.width/2,s=i+e.height,o=t.append("g").lower();var l=o;n||(zc++,Object.keys(e.links||{}).length&&!r.forceMenus&&l.attr("onclick",KBe(`actor${zc}_popup`)).attr("cursor","pointer"),l.append("line").attr("id","actor"+zc).attr("x1",a).attr("y1",s).attr("x2",a).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",e.name),l=o.append("g"),e.actorCnt=zc,e.links!=null&&l.attr("id","root-"+zc));let u=Tc();var h="actor";e.properties?.class?h=e.properties.class:u.fill="#eaeaea",n?h+=` ${Tue}`:h+=` ${kue}`,u.x=e.x,u.y=i,u.width=e.width,u.height=e.height,u.class=h,u.rx=3,u.ry=3,u.name=e.name;let f=kM(l,u);if(e.rectData=u,e.properties?.icon){let p=e.properties.icon.trim();p.charAt(0)==="@"?rne(l,u.x+u.width-20,u.y+10,p.substr(1)):tne(l,u.x+u.width-20,u.y+10,p)}TM(r,Ei(e.description))(e.description,l,u.x,u.y,u.width,u.height,{class:`actor ${XBe}`},r);let d=e.height;if(f.node){let p=f.node().getBBox();e.height=p.height,d=p.height}return d},"drawActorTypeParticipant"),QBe=v(function(t,e,r,n){let i=n?e.stopy:e.starty,a=e.x+e.width/2,s=i+80,o=t.append("g").lower();n||(zc++,o.append("line").attr("id","actor"+zc).attr("x1",a).attr("y1",s).attr("x2",a).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",e.name),e.actorCnt=zc);let l=t.append("g"),u=due;n?u+=` ${Tue}`:u+=` ${kue}`,l.attr("class",u),l.attr("name",e.name);let h=Tc();h.x=e.x,h.y=i,h.fill="#eaeaea",h.width=e.width,h.height=e.height,h.class="actor",h.rx=3,h.ry=3,l.append("line").attr("id","actor-man-torso"+zc).attr("x1",a).attr("y1",i+25).attr("x2",a).attr("y2",i+45),l.append("line").attr("id","actor-man-arms"+zc).attr("x1",a-v0/2).attr("y1",i+33).attr("x2",a+v0/2).attr("y2",i+33),l.append("line").attr("x1",a-v0/2).attr("y1",i+60).attr("x2",a).attr("y2",i+45),l.append("line").attr("x1",a).attr("y1",i+45).attr("x2",a+v0/2-2).attr("y2",i+60);let f=l.append("circle");f.attr("cx",e.x+e.width/2),f.attr("cy",i+10),f.attr("r",15),f.attr("width",e.width),f.attr("height",e.height);let d=l.node().getBBox();return e.height=d.height,TM(r,Ei(e.description))(e.description,l,h.x,h.y+35,h.width,h.height,{class:`actor ${due}`},r),e.height},"drawActorTypeActor"),JBe=v(async function(t,e,r,n){switch(e.type){case"actor":return await QBe(t,e,r,n);case"participant":return await ZBe(t,e,r,n)}},"drawActor"),eFe=v(function(t,e,r){let i=t.append("g");Cue(i,e),e.name&&TM(r)(e.name,i,e.x,e.y+(e.textMaxHeight||0)/2,e.width,0,{class:"text"},r),i.lower()},"drawBox"),tFe=v(function(t){return t.append("g")},"anchorElement"),rFe=v(function(t,e,r,n,i){let a=Tc(),s=e.anchored;a.x=e.startx,a.y=e.starty,a.class="activation"+i%3,a.width=e.stopx-e.startx,a.height=r-e.starty,kM(s,a)},"drawActivation"),nFe=v(async function(t,e,r,n){let{boxMargin:i,boxTextMargin:a,labelBoxHeight:s,labelBoxWidth:o,messageFontFamily:l,messageFontSize:u,messageFontWeight:h}=n,f=t.append("g"),d=v(function(m,y,x,b){return f.append("line").attr("x1",m).attr("y1",y).attr("x2",x).attr("y2",b).attr("class","loopLine")},"drawLoopLine");d(e.startx,e.starty,e.stopx,e.starty),d(e.stopx,e.starty,e.stopx,e.stopy),d(e.startx,e.stopy,e.stopx,e.stopy),d(e.startx,e.starty,e.startx,e.stopy),e.sections!==void 0&&e.sections.forEach(function(m){d(e.startx,m.y,e.stopx,m.y).style("stroke-dasharray","3, 3")});let p=Lw();p.text=r,p.x=e.startx,p.y=e.starty,p.fontFamily=l,p.fontSize=u,p.fontWeight=h,p.anchor="middle",p.valign="middle",p.tspan=!1,p.width=o||50,p.height=s||20,p.textMargin=a,p.class="labelText",Eue(f,p),p=Aue(),p.text=e.title,p.x=e.startx+o/2+(e.stopx-e.startx)/2,p.y=e.starty+i+a,p.anchor="middle",p.valign="middle",p.textMargin=a,p.class="loopText",p.fontFamily=l,p.fontSize=u,p.fontWeight=h,p.wrap=!0;let g=Ei(p.text)?await qT(f,p,e):_m(f,p);if(e.sectionTitles!==void 0){for(let[m,y]of Object.entries(e.sectionTitles))if(y.message){p.text=y.message,p.x=e.startx+(e.stopx-e.startx)/2,p.y=e.sections[m].y+i+a,p.class="loopText",p.anchor="middle",p.valign="middle",p.tspan=!1,p.fontFamily=l,p.fontSize=u,p.fontWeight=h,p.wrap=e.wrap,Ei(p.text)?(e.starty=e.sections[m].y,await qT(f,p,e)):_m(f,p);let x=Math.round(g.map(b=>(b._groups||b)[0][0].getBBox().height).reduce((b,w)=>b+w));e.sections[m].height+=x-(i+a)}}return e.height=Math.round(e.stopy-e.starty),f},"drawLoop"),Cue=v(function(t,e){_w(t,e)},"drawBackgroundRect"),iFe=v(function(t){t.append("defs").append("symbol").attr("id","database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),aFe=v(function(t){t.append("defs").append("symbol").attr("id","computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),sFe=v(function(t){t.append("defs").append("symbol").attr("id","clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),oFe=v(function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),lFe=v(function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),cFe=v(function(t){t.append("defs").append("marker").attr("id","sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),uFe=v(function(t){t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),Aue=v(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),hFe=v(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),TM=function(){function t(a,s,o,l,u,h,f){let d=s.append("text").attr("x",o+u/2).attr("y",l+h/2+5).style("text-anchor","middle").text(a);i(d,f)}v(t,"byText");function e(a,s,o,l,u,h,f,d){let{actorFontSize:p,actorFontFamily:g,actorFontWeight:m}=d,[y,x]=Ro(p),b=a.split(Xe.lineBreakRegex);for(let w=0;wt.height||0))+(this.loops.length===0?0:this.loops.map(t=>t.height||0).reduce((t,e)=>t+e))+(this.messages.length===0?0:this.messages.map(t=>t.height||0).reduce((t,e)=>t+e))+(this.notes.length===0?0:this.notes.map(t=>t.height||0).reduce((t,e)=>t+e))},"getHeight"),clear:v(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:v(function(t){this.boxes.push(t)},"addBox"),addActor:v(function(t){this.actors.push(t)},"addActor"),addLoop:v(function(t){this.loops.push(t)},"addLoop"),addMessage:v(function(t){this.messages.push(t)},"addMessage"),addNote:v(function(t){this.notes.push(t)},"addNote"),lastActor:v(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:v(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:v(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:v(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:v(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,Rue(pe())},"init"),updateVal:v(function(t,e,r,n){t[e]===void 0?t[e]=r:t[e]=n(r,t[e])},"updateVal"),updateBounds:v(function(t,e,r,n){let i=this,a=0;function s(o){return v(function(u){a++;let h=i.sequenceItems.length-a+1;i.updateVal(u,"starty",e-h*Le.boxMargin,Math.min),i.updateVal(u,"stopy",n+h*Le.boxMargin,Math.max),i.updateVal(Qe.data,"startx",t-h*Le.boxMargin,Math.min),i.updateVal(Qe.data,"stopx",r+h*Le.boxMargin,Math.max),o!=="activation"&&(i.updateVal(u,"startx",t-h*Le.boxMargin,Math.min),i.updateVal(u,"stopx",r+h*Le.boxMargin,Math.max),i.updateVal(Qe.data,"starty",e-h*Le.boxMargin,Math.min),i.updateVal(Qe.data,"stopy",n+h*Le.boxMargin,Math.max))},"updateItemBounds")}v(s,"updateFn"),this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},"updateBounds"),insert:v(function(t,e,r,n){let i=Xe.getMin(t,r),a=Xe.getMax(t,r),s=Xe.getMin(e,n),o=Xe.getMax(e,n);this.updateVal(Qe.data,"startx",i,Math.min),this.updateVal(Qe.data,"starty",s,Math.min),this.updateVal(Qe.data,"stopx",a,Math.max),this.updateVal(Qe.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),newActivation:v(function(t,e,r){let n=r.get(t.from),i=XT(t.from).length||0,a=n.x+n.width/2+(i-1)*Le.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+Le.activationWidth,stopy:void 0,actor:t.from,anchored:hi.anchorElement(e)})},"newActivation"),endActivation:v(function(t){let e=this.activations.map(function(r){return r.actor}).lastIndexOf(t.from);return this.activations.splice(e,1)[0]},"endActivation"),createLoop:v(function(t={message:void 0,wrap:!1,width:void 0},e){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:t.message,wrap:t.wrap,width:t.width,height:0,fill:e}},"createLoop"),newLoop:v(function(t={message:void 0,wrap:!1,width:void 0},e){this.sequenceItems.push(this.createLoop(t,e))},"newLoop"),endLoop:v(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:v(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:v(function(t){let e=this.sequenceItems.pop();e.sections=e.sections||[],e.sectionTitles=e.sectionTitles||[],e.sections.push({y:Qe.getVerticalPos(),height:0}),e.sectionTitles.push(t),this.sequenceItems.push(e)},"addSectionToLoop"),saveVerticalPos:v(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:v(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:v(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=Xe.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:v(function(){return this.verticalPos},"getVerticalPos"),getBounds:v(function(){return{bounds:this.data,models:this.models}},"getBounds")},dFe=v(async function(t,e){Qe.bumpVerticalPos(Le.boxMargin),e.height=Le.boxMargin,e.starty=Qe.getVerticalPos();let r=Tc();r.x=e.startx,r.y=e.starty,r.width=e.width||Le.width,r.class="note";let n=t.append("g"),i=hi.drawRect(n,r),a=Lw();a.x=e.startx,a.y=e.starty,a.width=r.width,a.dy="1em",a.text=e.message,a.class="noteText",a.fontFamily=Le.noteFontFamily,a.fontSize=Le.noteFontSize,a.fontWeight=Le.noteFontWeight,a.anchor=Le.noteAlign,a.textMargin=Le.noteMargin,a.valign="center";let s=Ei(a.text)?await qT(n,a):_m(n,a),o=Math.round(s.map(l=>(l._groups||l)[0][0].getBBox().height).reduce((l,u)=>l+u));i.attr("height",o+2*Le.noteMargin),e.height+=o+2*Le.noteMargin,Qe.bumpVerticalPos(o+2*Le.noteMargin),e.stopy=e.starty+o+2*Le.noteMargin,e.stopx=e.startx+r.width,Qe.insert(e.startx,e.starty,e.stopx,e.stopy),Qe.models.addNote(e)},"drawNote"),x0=v(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont"),Am=v(t=>({fontFamily:t.noteFontFamily,fontSize:t.noteFontSize,fontWeight:t.noteFontWeight}),"noteFont"),yM=v(t=>({fontFamily:t.actorFontFamily,fontSize:t.actorFontSize,fontWeight:t.actorFontWeight}),"actorFont");v(_ue,"boundMessage");pFe=v(async function(t,e,r,n){let{startx:i,stopx:a,starty:s,message:o,type:l,sequenceIndex:u,sequenceVisible:h}=e,f=Ut.calculateTextDimensions(o,x0(Le)),d=Lw();d.x=i,d.y=s+10,d.width=a-i,d.class="messageText",d.dy="1em",d.text=o,d.fontFamily=Le.messageFontFamily,d.fontSize=Le.messageFontSize,d.fontWeight=Le.messageFontWeight,d.anchor=Le.messageAlign,d.valign="center",d.textMargin=Le.wrapPadding,d.tspan=!1,Ei(d.text)?await qT(t,d,{startx:i,stopx:a,starty:r}):_m(t,d);let p=f.width,g;i===a?Le.rightAngles?g=t.append("path").attr("d",`M ${i},${r} H ${i+Xe.getMax(Le.width/2,p/2)} V ${r+25} H ${i}`):g=t.append("path").attr("d","M "+i+","+r+" C "+(i+60)+","+(r-10)+" "+(i+60)+","+(r+30)+" "+i+","+(r+20)):(g=t.append("line"),g.attr("x1",i),g.attr("y1",r),g.attr("x2",a),g.attr("y2",r)),l===n.db.LINETYPE.DOTTED||l===n.db.LINETYPE.DOTTED_CROSS||l===n.db.LINETYPE.DOTTED_POINT||l===n.db.LINETYPE.DOTTED_OPEN||l===n.db.LINETYPE.BIDIRECTIONAL_DOTTED?(g.style("stroke-dasharray","3, 3"),g.attr("class","messageLine1")):g.attr("class","messageLine0");let m="";Le.arrowMarkerAbsolute&&(m=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,m=m.replace(/\(/g,"\\("),m=m.replace(/\)/g,"\\)")),g.attr("stroke-width",2),g.attr("stroke","none"),g.style("fill","none"),(l===n.db.LINETYPE.SOLID||l===n.db.LINETYPE.DOTTED)&&g.attr("marker-end","url("+m+"#arrowhead)"),(l===n.db.LINETYPE.BIDIRECTIONAL_SOLID||l===n.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(g.attr("marker-start","url("+m+"#arrowhead)"),g.attr("marker-end","url("+m+"#arrowhead)")),(l===n.db.LINETYPE.SOLID_POINT||l===n.db.LINETYPE.DOTTED_POINT)&&g.attr("marker-end","url("+m+"#filled-head)"),(l===n.db.LINETYPE.SOLID_CROSS||l===n.db.LINETYPE.DOTTED_CROSS)&&g.attr("marker-end","url("+m+"#crosshead)"),(h||Le.showSequenceNumbers)&&(g.attr("marker-start","url("+m+"#sequencenumber)"),t.append("text").attr("x",i).attr("y",r+4).attr("font-family","sans-serif").attr("font-size","12px").attr("text-anchor","middle").attr("class","sequenceNumber").text(u))},"drawMessage"),gFe=v(function(t,e,r,n,i,a,s){let o=0,l=0,u,h=0;for(let f of n){let d=e.get(f),p=d.box;u&&u!=p&&(s||Qe.models.addBox(u),l+=Le.boxMargin+u.margin),p&&p!=u&&(s||(p.x=o+l,p.y=i),l+=p.margin),d.width=d.width||Le.width,d.height=Xe.getMax(d.height||Le.height,Le.height),d.margin=d.margin||Le.actorMargin,h=Xe.getMax(h,d.height),r.get(d.name)&&(l+=d.width/2),d.x=o+l,d.starty=Qe.getVerticalPos(),Qe.insert(d.x,i,d.x+d.width,d.height),o+=d.width+l,d.box&&(d.box.width=o+p.margin-d.box.x),l=d.margin,u=d.box,Qe.models.addActor(d)}u&&!s&&Qe.models.addBox(u),Qe.bumpVerticalPos(h)},"addActorRenderingData"),xM=v(async function(t,e,r,n){if(n){let i=0;Qe.bumpVerticalPos(Le.boxMargin*2);for(let a of r){let s=e.get(a);s.stopy||(s.stopy=Qe.getVerticalPos());let o=await hi.drawActor(t,s,Le,!0);i=Xe.getMax(i,o)}Qe.bumpVerticalPos(i+Le.boxMargin)}else for(let i of r){let a=e.get(i);await hi.drawActor(t,a,Le,!1)}},"drawActors"),Lue=v(function(t,e,r,n){let i=0,a=0;for(let s of r){let o=e.get(s),l=vFe(o),u=hi.drawPopup(t,o,l,Le,Le.forceMenus,n);u.height>i&&(i=u.height),u.width+o.x>a&&(a=u.width+o.x)}return{maxHeight:i,maxWidth:a}},"drawActorsPopup"),Rue=v(function(t){Hn(Le,t),t.fontFamily&&(Le.actorFontFamily=Le.noteFontFamily=Le.messageFontFamily=t.fontFamily),t.fontSize&&(Le.actorFontSize=Le.noteFontSize=Le.messageFontSize=t.fontSize),t.fontWeight&&(Le.actorFontWeight=Le.noteFontWeight=Le.messageFontWeight=t.fontWeight)},"setConf"),XT=v(function(t){return Qe.activations.filter(function(e){return e.actor===t})},"actorActivations"),pue=v(function(t,e){let r=e.get(t),n=XT(t),i=n.reduce(function(s,o){return Xe.getMin(s,o.startx)},r.x+r.width/2-1),a=n.reduce(function(s,o){return Xe.getMax(s,o.stopx)},r.x+r.width/2+1);return[i,a]},"activationBounds");v(Il,"adjustLoopHeightForWrap");v(Nue,"adjustCreatedDestroyedData");mFe=v(async function(t,e,r,n){let{securityLevel:i,sequence:a}=pe();Le=a;let s;i==="sandbox"&&(s=Ve("#i"+e));let o=i==="sandbox"?Ve(s.nodes()[0].contentDocument.body):Ve("body"),l=i==="sandbox"?s.nodes()[0].contentDocument:document;Qe.init(),re.debug(n.db);let u=i==="sandbox"?o.select(`[id="${e}"]`):Ve(`[id="${e}"]`),h=n.db.getActors(),f=n.db.getCreatedActors(),d=n.db.getDestroyedActors(),p=n.db.getBoxes(),g=n.db.getActorKeys(),m=n.db.getMessages(),y=n.db.getDiagramTitle(),x=n.db.hasAtLeastOneBox(),b=n.db.hasAtLeastOneBoxWithTitle(),w=await Iue(h,m,n);if(Le.height=await Mue(h,w,p),hi.insertComputerIcon(u),hi.insertDatabaseIcon(u),hi.insertClockIcon(u),x&&(Qe.bumpVerticalPos(Le.boxMargin),b&&Qe.bumpVerticalPos(p[0].textMaxHeight)),Le.hideUnusedParticipants===!0){let B=new Set;m.forEach(P=>{B.add(P.from),B.add(P.to)}),g=g.filter(P=>B.has(P))}gFe(u,h,f,g,0,m,!1);let _=await bFe(m,h,w,n);hi.insertArrowHead(u),hi.insertArrowCrossHead(u),hi.insertArrowFilledHead(u),hi.insertSequenceNumber(u);function k(B,P){let $=Qe.endActivation(B);$.starty+18>P&&($.starty=P-6,P+=12),hi.drawActivation(u,$,P,Le,XT(B.from).length),Qe.insert($.startx,P-10,$.stopx,P)}v(k,"activeEnd");let E=1,L=1,S=[],C=[],M=0;for(let B of m){let P,$,z;switch(B.type){case n.db.LINETYPE.NOTE:Qe.resetVerticalPos(),$=B.noteModel,await dFe(u,$);break;case n.db.LINETYPE.ACTIVE_START:Qe.newActivation(B,u,h);break;case n.db.LINETYPE.ACTIVE_END:k(B,Qe.getVerticalPos());break;case n.db.LINETYPE.LOOP_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H));break;case n.db.LINETYPE.LOOP_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"loop",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;case n.db.LINETYPE.RECT_START:Il(_,B,Le.boxMargin,Le.boxMargin,H=>Qe.newLoop(void 0,H.message));break;case n.db.LINETYPE.RECT_END:P=Qe.endLoop(),C.push(P),Qe.models.addLoop(P),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos());break;case n.db.LINETYPE.OPT_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H));break;case n.db.LINETYPE.OPT_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"opt",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;case n.db.LINETYPE.ALT_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H));break;case n.db.LINETYPE.ALT_ELSE:Il(_,B,Le.boxMargin+Le.boxTextMargin,Le.boxMargin,H=>Qe.addSectionToLoop(H));break;case n.db.LINETYPE.ALT_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"alt",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H)),Qe.saveVerticalPos();break;case n.db.LINETYPE.PAR_AND:Il(_,B,Le.boxMargin+Le.boxTextMargin,Le.boxMargin,H=>Qe.addSectionToLoop(H));break;case n.db.LINETYPE.PAR_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"par",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;case n.db.LINETYPE.AUTONUMBER:E=B.message.start||E,L=B.message.step||L,B.message.visible?n.db.enableSequenceNumbers():n.db.disableSequenceNumbers();break;case n.db.LINETYPE.CRITICAL_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H));break;case n.db.LINETYPE.CRITICAL_OPTION:Il(_,B,Le.boxMargin+Le.boxTextMargin,Le.boxMargin,H=>Qe.addSectionToLoop(H));break;case n.db.LINETYPE.CRITICAL_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"critical",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;case n.db.LINETYPE.BREAK_START:Il(_,B,Le.boxMargin,Le.boxMargin+Le.boxTextMargin,H=>Qe.newLoop(H));break;case n.db.LINETYPE.BREAK_END:P=Qe.endLoop(),await hi.drawLoop(u,P,"break",Le),Qe.bumpVerticalPos(P.stopy-Qe.getVerticalPos()),Qe.models.addLoop(P);break;default:try{z=B.msgModel,z.starty=Qe.getVerticalPos(),z.sequenceIndex=E,z.sequenceVisible=n.db.showSequenceNumbers();let H=await _ue(u,z);Nue(B,z,H,M,h,f,d),S.push({messageModel:z,lineStartY:H}),Qe.models.addMessage(z)}catch(H){re.error("error while drawing message",H)}}[n.db.LINETYPE.SOLID_OPEN,n.db.LINETYPE.DOTTED_OPEN,n.db.LINETYPE.SOLID,n.db.LINETYPE.DOTTED,n.db.LINETYPE.SOLID_CROSS,n.db.LINETYPE.DOTTED_CROSS,n.db.LINETYPE.SOLID_POINT,n.db.LINETYPE.DOTTED_POINT,n.db.LINETYPE.BIDIRECTIONAL_SOLID,n.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(B.type)&&(E=E+L),M++}re.debug("createdActors",f),re.debug("destroyedActors",d),await xM(u,h,g,!1);for(let B of S)await pFe(u,B.messageModel,B.lineStartY,n);Le.mirrorActors&&await xM(u,h,g,!0),C.forEach(B=>hi.drawBackgroundRect(u,B)),Sue(u,h,g,Le);for(let B of Qe.models.boxes)B.height=Qe.getVerticalPos()-B.y,Qe.insert(B.x,B.y,B.x+B.width,B.height),B.startx=B.x,B.starty=B.y,B.stopx=B.startx+B.width,B.stopy=B.starty+B.height,B.stroke="rgb(0,0,0, 0.5)",hi.drawBox(u,B,Le);x&&Qe.bumpVerticalPos(Le.boxMargin);let R=Lue(u,h,g,l),{bounds:T}=Qe.getBounds();T.startx===void 0&&(T.startx=0),T.starty===void 0&&(T.starty=0),T.stopx===void 0&&(T.stopx=0),T.stopy===void 0&&(T.stopy=0);let I=T.stopy-T.starty;I2,f=v(m=>o?-m:m,"adjustValue");t.from===t.to?u=l:(t.activate&&!h&&(u+=f(Le.activationWidth/2-1)),[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN].includes(t.type)||(u+=f(3)),[r.db.LINETYPE.BIDIRECTIONAL_SOLID,r.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(t.type)&&(l-=f(3)));let d=[n,i,a,s],p=Math.abs(l-u);t.wrap&&t.message&&(t.message=Ut.wrapLabel(t.message,Xe.getMax(p+2*Le.wrapPadding,Le.width),x0(Le)));let g=Ut.calculateTextDimensions(t.message,x0(Le));return{width:Xe.getMax(t.wrap?0:g.width+2*Le.wrapPadding,p+2*Le.wrapPadding,Le.width),height:0,startx:l,stopx:u,starty:0,stopy:0,message:t.message,type:t.type,wrap:t.wrap,fromBounds:Math.min.apply(null,d),toBounds:Math.max.apply(null,d)}},"buildMessageModel"),bFe=v(async function(t,e,r,n){let i={},a=[],s,o,l;for(let u of t){switch(u.id=Ut.random({length:10}),u.type){case n.db.LINETYPE.LOOP_START:case n.db.LINETYPE.ALT_START:case n.db.LINETYPE.OPT_START:case n.db.LINETYPE.PAR_START:case n.db.LINETYPE.PAR_OVER_START:case n.db.LINETYPE.CRITICAL_START:case n.db.LINETYPE.BREAK_START:a.push({id:u.id,msg:u.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case n.db.LINETYPE.ALT_ELSE:case n.db.LINETYPE.PAR_AND:case n.db.LINETYPE.CRITICAL_OPTION:u.message&&(s=a.pop(),i[s.id]=s,i[u.id]=s,a.push(s));break;case n.db.LINETYPE.LOOP_END:case n.db.LINETYPE.ALT_END:case n.db.LINETYPE.OPT_END:case n.db.LINETYPE.PAR_END:case n.db.LINETYPE.CRITICAL_END:case n.db.LINETYPE.BREAK_END:s=a.pop(),i[s.id]=s;break;case n.db.LINETYPE.ACTIVE_START:{let f=e.get(u.from?u.from:u.to.actor),d=XT(u.from?u.from:u.to.actor).length,p=f.x+f.width/2+(d-1)*Le.activationWidth/2,g={startx:p,stopx:p+Le.activationWidth,actor:u.from,enabled:!0};Qe.activations.push(g)}break;case n.db.LINETYPE.ACTIVE_END:{let f=Qe.activations.map(d=>d.actor).lastIndexOf(u.from);Qe.activations.splice(f,1).splice(0,1)}break}u.placement!==void 0?(o=await yFe(u,e,n),u.noteModel=o,a.forEach(f=>{s=f,s.from=Xe.getMin(s.from,o.startx),s.to=Xe.getMax(s.to,o.startx+o.width),s.width=Xe.getMax(s.width,Math.abs(s.from-s.to))-Le.labelBoxWidth})):(l=xFe(u,e,n),u.msgModel=l,l.startx&&l.stopx&&a.length>0&&a.forEach(f=>{if(s=f,l.startx===l.stopx){let d=e.get(u.from),p=e.get(u.to);s.from=Xe.getMin(d.x-l.width/2,d.x-d.width/2,s.from),s.to=Xe.getMax(p.x+l.width/2,p.x+d.width/2,s.to),s.width=Xe.getMax(s.width,Math.abs(s.to-s.from))-Le.labelBoxWidth}else s.from=Xe.getMin(l.startx,s.from),s.to=Xe.getMax(l.stopx,s.to),s.width=Xe.getMax(s.width,l.width)-Le.labelBoxWidth}))}return Qe.activations=[],re.debug("Loop type widths:",i),i},"calculateLoopBounds"),wFe={bounds:Qe,drawActors:xM,drawActorsPopup:Lue,setConf:Rue,draw:mFe},kFe={parser:TBe,db:fue,renderer:wFe,styles:YBe,init:v(({wrap:t})=>{fue.setWrap(t)},"init")}});function CM(t){let e;switch(t){case 0:e="aggregation";break;case 1:e="extension";break;case 2:e="composition";break;case 3:e="dependency";break;case 4:e="lollipop";break;default:e="none"}return e}var EM,jT,Pue,Bue,KT,ZT,An,Fue,rx,Rm,zue,Ml,SM,nx,b0,w0,TFe,Lm,$ue,Gue,EFe,SFe,CFe,AFe,_Fe,LFe,RFe,Uue,NFe,IFe,MFe,AM,DFe,OFe,PFe,BFe,FFe,zFe,$Fe,GFe,hf,Vue,_M,Wue,UFe,VFe,WFe,HFe,qFe,YFe,XFe,Nm,jFe,QT,KFe,ZFe,QFe,JT,LM=F(()=>{Kh();Nu();kn();or();lr();EM=function(){var t=v(function(Pe,xe,q,de){for(q=q||{},de=Pe.length;de--;q[Pe[de]]=xe);return q},"o"),e=[1,18],r=[1,19],n=[1,20],i=[1,41],a=[1,42],s=[1,26],o=[1,24],l=[1,25],u=[1,32],h=[1,33],f=[1,34],d=[1,45],p=[1,35],g=[1,36],m=[1,37],y=[1,38],x=[1,27],b=[1,28],w=[1,29],_=[1,30],k=[1,31],E=[1,44],L=[1,46],S=[1,43],C=[1,47],M=[1,9],R=[1,8,9],T=[1,58],I=[1,59],A=[1,60],D=[1,61],N=[1,62],O=[1,63],B=[1,64],P=[1,8,9,41],$=[1,76],z=[1,8,9,12,13,22,39,41,44,66,67,68,69,70,71,72,77,79],H=[1,8,9,12,13,17,20,22,39,41,44,48,58,66,67,68,69,70,71,72,77,79,84,99,101,102],J=[13,58,84,99,101,102],X=[13,58,71,72,84,99,101,102],oe=[13,58,66,67,68,69,70,84,99,101,102],K=[1,98],ee=[1,115],Q=[1,107],W=[1,113],Y=[1,108],Z=[1,109],se=[1,110],ce=[1,111],ue=[1,112],te=[1,114],Ne=[22,58,59,80,84,85,86,87,88,89],ae=[1,8,9,39,41,44],we=[1,8,9,22],Ie=[1,143],Ee=[1,8,9,59],Oe=[1,8,9,22,58,59,80,84,85,86,87,88,89],De={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,DOT:17,className:18,classLiteralName:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,CLASS:46,ANNOTATION_START:47,ANNOTATION_END:48,MEMBER:49,SEPARATOR:50,relation:51,NOTE_FOR:52,noteText:53,NOTE:54,CLASSDEF:55,classList:56,stylesOpt:57,ALPHA:58,COMMA:59,direction_tb:60,direction_bt:61,direction_rl:62,direction_lr:63,relationType:64,lineType:65,AGGREGATION:66,EXTENSION:67,COMPOSITION:68,DEPENDENCY:69,LOLLIPOP:70,LINE:71,DOTTED_LINE:72,CALLBACK:73,LINK:74,LINK_TARGET:75,CLICK:76,CALLBACK_NAME:77,CALLBACK_ARGS:78,HREF:79,STYLE:80,CSSCLASS:81,style:82,styleComponent:83,NUM:84,COLON:85,UNIT:86,SPACE:87,BRKT:88,PCT:89,commentToken:90,textToken:91,graphCodeTokens:92,textNoTagsToken:93,TAGSTART:94,TAGEND:95,"==":96,"--":97,DEFAULT:98,MINUS:99,keywords:100,UNICODE_TEXT:101,BQUOTE_STR:102,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",17:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"CLASS",47:"ANNOTATION_START",48:"ANNOTATION_END",49:"MEMBER",50:"SEPARATOR",52:"NOTE_FOR",54:"NOTE",55:"CLASSDEF",58:"ALPHA",59:"COMMA",60:"direction_tb",61:"direction_bt",62:"direction_rl",63:"direction_lr",66:"AGGREGATION",67:"EXTENSION",68:"COMPOSITION",69:"DEPENDENCY",70:"LOLLIPOP",71:"LINE",72:"DOTTED_LINE",73:"CALLBACK",74:"LINK",75:"LINK_TARGET",76:"CLICK",77:"CALLBACK_NAME",78:"CALLBACK_ARGS",79:"HREF",80:"STYLE",81:"CSSCLASS",84:"NUM",85:"COLON",86:"UNIT",87:"SPACE",88:"BRKT",89:"PCT",92:"graphCodeTokens",94:"TAGSTART",95:"TAGEND",96:"==",97:"--",98:"DEFAULT",99:"MINUS",100:"keywords",101:"UNICODE_TEXT",102:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,3],[15,2],[18,1],[18,3],[18,1],[18,2],[18,2],[18,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,6],[43,2],[43,3],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[56,1],[56,3],[32,1],[32,1],[32,1],[32,1],[51,3],[51,2],[51,2],[51,1],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[57,1],[57,3],[82,1],[82,2],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[90,1],[90,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[93,1],[93,1],[93,1],[93,1],[16,1],[16,1],[16,1],[16,1],[19,1],[53,1]],performAction:v(function(xe,q,de,ie,he,U,ke){var j=U.length-1;switch(he){case 8:this.$=U[j-1];break;case 9:case 12:case 14:this.$=U[j];break;case 10:case 13:this.$=U[j-2]+"."+U[j];break;case 11:case 15:this.$=U[j-1]+U[j];break;case 16:case 17:this.$=U[j-1]+"~"+U[j]+"~";break;case 18:ie.addRelation(U[j]);break;case 19:U[j-1].title=ie.cleanupLabel(U[j]),ie.addRelation(U[j-1]);break;case 30:this.$=U[j].trim(),ie.setAccTitle(this.$);break;case 31:case 32:this.$=U[j].trim(),ie.setAccDescription(this.$);break;case 33:ie.addClassesToNamespace(U[j-3],U[j-1]);break;case 34:ie.addClassesToNamespace(U[j-4],U[j-1]);break;case 35:this.$=U[j],ie.addNamespace(U[j]);break;case 36:this.$=[U[j]];break;case 37:this.$=[U[j-1]];break;case 38:U[j].unshift(U[j-2]),this.$=U[j];break;case 40:ie.setCssClass(U[j-2],U[j]);break;case 41:ie.addMembers(U[j-3],U[j-1]);break;case 42:ie.setCssClass(U[j-5],U[j-3]),ie.addMembers(U[j-5],U[j-1]);break;case 43:this.$=U[j],ie.addClass(U[j]);break;case 44:this.$=U[j-1],ie.addClass(U[j-1]),ie.setClassLabel(U[j-1],U[j]);break;case 45:ie.addAnnotation(U[j],U[j-2]);break;case 46:case 59:this.$=[U[j]];break;case 47:U[j].push(U[j-1]),this.$=U[j];break;case 48:break;case 49:ie.addMember(U[j-1],ie.cleanupLabel(U[j]));break;case 50:break;case 51:break;case 52:this.$={id1:U[j-2],id2:U[j],relation:U[j-1],relationTitle1:"none",relationTitle2:"none"};break;case 53:this.$={id1:U[j-3],id2:U[j],relation:U[j-1],relationTitle1:U[j-2],relationTitle2:"none"};break;case 54:this.$={id1:U[j-3],id2:U[j],relation:U[j-2],relationTitle1:"none",relationTitle2:U[j-1]};break;case 55:this.$={id1:U[j-4],id2:U[j],relation:U[j-2],relationTitle1:U[j-3],relationTitle2:U[j-1]};break;case 56:ie.addNote(U[j],U[j-1]);break;case 57:ie.addNote(U[j]);break;case 58:this.$=U[j-2],ie.defineClass(U[j-1],U[j]);break;case 60:this.$=U[j-2].concat([U[j]]);break;case 61:ie.setDirection("TB");break;case 62:ie.setDirection("BT");break;case 63:ie.setDirection("RL");break;case 64:ie.setDirection("LR");break;case 65:this.$={type1:U[j-2],type2:U[j],lineType:U[j-1]};break;case 66:this.$={type1:"none",type2:U[j],lineType:U[j-1]};break;case 67:this.$={type1:U[j-1],type2:"none",lineType:U[j]};break;case 68:this.$={type1:"none",type2:"none",lineType:U[j]};break;case 69:this.$=ie.relationType.AGGREGATION;break;case 70:this.$=ie.relationType.EXTENSION;break;case 71:this.$=ie.relationType.COMPOSITION;break;case 72:this.$=ie.relationType.DEPENDENCY;break;case 73:this.$=ie.relationType.LOLLIPOP;break;case 74:this.$=ie.lineType.LINE;break;case 75:this.$=ie.lineType.DOTTED_LINE;break;case 76:case 82:this.$=U[j-2],ie.setClickEvent(U[j-1],U[j]);break;case 77:case 83:this.$=U[j-3],ie.setClickEvent(U[j-2],U[j-1]),ie.setTooltip(U[j-2],U[j]);break;case 78:this.$=U[j-2],ie.setLink(U[j-1],U[j]);break;case 79:this.$=U[j-3],ie.setLink(U[j-2],U[j-1],U[j]);break;case 80:this.$=U[j-3],ie.setLink(U[j-2],U[j-1]),ie.setTooltip(U[j-2],U[j]);break;case 81:this.$=U[j-4],ie.setLink(U[j-3],U[j-2],U[j]),ie.setTooltip(U[j-3],U[j-1]);break;case 84:this.$=U[j-3],ie.setClickEvent(U[j-2],U[j-1],U[j]);break;case 85:this.$=U[j-4],ie.setClickEvent(U[j-3],U[j-2],U[j-1]),ie.setTooltip(U[j-3],U[j]);break;case 86:this.$=U[j-3],ie.setLink(U[j-2],U[j]);break;case 87:this.$=U[j-4],ie.setLink(U[j-3],U[j-1],U[j]);break;case 88:this.$=U[j-4],ie.setLink(U[j-3],U[j-1]),ie.setTooltip(U[j-3],U[j]);break;case 89:this.$=U[j-5],ie.setLink(U[j-4],U[j-2],U[j]),ie.setTooltip(U[j-4],U[j-1]);break;case 90:this.$=U[j-2],ie.setCssStyle(U[j-1],U[j]);break;case 91:ie.setCssClass(U[j-1],U[j]);break;case 92:this.$=[U[j]];break;case 93:U[j-2].push(U[j]),this.$=U[j-2];break;case 95:this.$=U[j-1]+U[j];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:e,35:r,37:n,38:22,42:i,43:23,46:a,47:s,49:o,50:l,52:u,54:h,55:f,58:d,60:p,61:g,62:m,63:y,73:x,74:b,76:w,80:_,81:k,84:E,99:L,101:S,102:C},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(M,[2,5],{8:[1,48]}),{8:[1,49]},t(R,[2,18],{22:[1,50]}),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(R,[2,23]),t(R,[2,24]),t(R,[2,25]),t(R,[2,26]),t(R,[2,27]),t(R,[2,28]),t(R,[2,29]),{34:[1,51]},{36:[1,52]},t(R,[2,32]),t(R,[2,48],{51:53,64:56,65:57,13:[1,54],22:[1,55],66:T,67:I,68:A,69:D,70:N,71:O,72:B}),{39:[1,65]},t(P,[2,39],{39:[1,67],44:[1,66]}),t(R,[2,50]),t(R,[2,51]),{16:68,58:d,84:E,99:L,101:S},{16:39,18:69,19:40,58:d,84:E,99:L,101:S,102:C},{16:39,18:70,19:40,58:d,84:E,99:L,101:S,102:C},{16:39,18:71,19:40,58:d,84:E,99:L,101:S,102:C},{58:[1,72]},{13:[1,73]},{16:39,18:74,19:40,58:d,84:E,99:L,101:S,102:C},{13:$,53:75},{56:77,58:[1,78]},t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(z,[2,12],{16:39,19:40,18:80,17:[1,79],20:[1,81],58:d,84:E,99:L,101:S,102:C}),t(z,[2,14],{20:[1,82]}),{15:83,16:84,58:d,84:E,99:L,101:S},{16:39,18:85,19:40,58:d,84:E,99:L,101:S,102:C},t(H,[2,118]),t(H,[2,119]),t(H,[2,120]),t(H,[2,121]),t([1,8,9,12,13,20,22,39,41,44,66,67,68,69,70,71,72,77,79],[2,122]),t(M,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,18:21,38:22,43:23,16:39,19:40,5:86,33:e,35:r,37:n,42:i,46:a,47:s,49:o,50:l,52:u,54:h,55:f,58:d,60:p,61:g,62:m,63:y,73:x,74:b,76:w,80:_,81:k,84:E,99:L,101:S,102:C}),{5:87,10:5,16:39,18:21,19:40,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:e,35:r,37:n,38:22,42:i,43:23,46:a,47:s,49:o,50:l,52:u,54:h,55:f,58:d,60:p,61:g,62:m,63:y,73:x,74:b,76:w,80:_,81:k,84:E,99:L,101:S,102:C},t(R,[2,19]),t(R,[2,30]),t(R,[2,31]),{13:[1,89],16:39,18:88,19:40,58:d,84:E,99:L,101:S,102:C},{51:90,64:56,65:57,66:T,67:I,68:A,69:D,70:N,71:O,72:B},t(R,[2,49]),{65:91,71:O,72:B},t(J,[2,68],{64:92,66:T,67:I,68:A,69:D,70:N}),t(X,[2,69]),t(X,[2,70]),t(X,[2,71]),t(X,[2,72]),t(X,[2,73]),t(oe,[2,74]),t(oe,[2,75]),{8:[1,94],24:95,40:93,43:23,46:a},{16:96,58:d,84:E,99:L,101:S},{45:97,49:K},{48:[1,99]},{13:[1,100]},{13:[1,101]},{77:[1,102],79:[1,103]},{22:ee,57:104,58:Q,80:W,82:105,83:106,84:Y,85:Z,86:se,87:ce,88:ue,89:te},{58:[1,116]},{13:$,53:117},t(R,[2,57]),t(R,[2,123]),{22:ee,57:118,58:Q,59:[1,119],80:W,82:105,83:106,84:Y,85:Z,86:se,87:ce,88:ue,89:te},t(Ne,[2,59]),{16:39,18:120,19:40,58:d,84:E,99:L,101:S,102:C},t(z,[2,15]),t(z,[2,16]),t(z,[2,17]),{39:[2,35]},{15:122,16:84,17:[1,121],39:[2,9],58:d,84:E,99:L,101:S},t(ae,[2,43],{11:123,12:[1,124]}),t(M,[2,7]),{9:[1,125]},t(we,[2,52]),{16:39,18:126,19:40,58:d,84:E,99:L,101:S,102:C},{13:[1,128],16:39,18:127,19:40,58:d,84:E,99:L,101:S,102:C},t(J,[2,67],{64:129,66:T,67:I,68:A,69:D,70:N}),t(J,[2,66]),{41:[1,130]},{24:95,40:131,43:23,46:a},{8:[1,132],41:[2,36]},t(P,[2,40],{39:[1,133]}),{41:[1,134]},{41:[2,46],45:135,49:K},{16:39,18:136,19:40,58:d,84:E,99:L,101:S,102:C},t(R,[2,76],{13:[1,137]}),t(R,[2,78],{13:[1,139],75:[1,138]}),t(R,[2,82],{13:[1,140],78:[1,141]}),{13:[1,142]},t(R,[2,90],{59:Ie}),t(Ee,[2,92],{83:144,22:ee,58:Q,80:W,84:Y,85:Z,86:se,87:ce,88:ue,89:te}),t(Oe,[2,94]),t(Oe,[2,96]),t(Oe,[2,97]),t(Oe,[2,98]),t(Oe,[2,99]),t(Oe,[2,100]),t(Oe,[2,101]),t(Oe,[2,102]),t(Oe,[2,103]),t(Oe,[2,104]),t(R,[2,91]),t(R,[2,56]),t(R,[2,58],{59:Ie}),{58:[1,145]},t(z,[2,13]),{15:146,16:84,58:d,84:E,99:L,101:S},{39:[2,11]},t(ae,[2,44]),{13:[1,147]},{1:[2,4]},t(we,[2,54]),t(we,[2,53]),{16:39,18:148,19:40,58:d,84:E,99:L,101:S,102:C},t(J,[2,65]),t(R,[2,33]),{41:[1,149]},{24:95,40:150,41:[2,37],43:23,46:a},{45:151,49:K},t(P,[2,41]),{41:[2,47]},t(R,[2,45]),t(R,[2,77]),t(R,[2,79]),t(R,[2,80],{75:[1,152]}),t(R,[2,83]),t(R,[2,84],{13:[1,153]}),t(R,[2,86],{13:[1,155],75:[1,154]}),{22:ee,58:Q,80:W,82:156,83:106,84:Y,85:Z,86:se,87:ce,88:ue,89:te},t(Oe,[2,95]),t(Ne,[2,60]),{39:[2,10]},{14:[1,157]},t(we,[2,55]),t(R,[2,34]),{41:[2,38]},{41:[1,158]},t(R,[2,81]),t(R,[2,85]),t(R,[2,87]),t(R,[2,88],{75:[1,159]}),t(Ee,[2,93],{83:144,22:ee,58:Q,80:W,84:Y,85:Z,86:se,87:ce,88:ue,89:te}),t(ae,[2,8]),t(P,[2,42]),t(R,[2,89])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],83:[2,35],122:[2,11],125:[2,4],135:[2,47],146:[2,10],150:[2,38]},parseError:v(function(xe,q){if(q.recoverable)this.trace(xe);else{var de=new Error(xe);throw de.hash=q,de}},"parseError"),parse:v(function(xe){var q=this,de=[0],ie=[],he=[null],U=[],ke=this.table,j="",ye=0,Ae=0,Ge=0,Fe=2,ge=1,$e=U.slice.call(arguments,1),Ce=Object.create(this.lexer),qe={yy:{}};for(var lt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,lt)&&(qe.yy[lt]=this.yy[lt]);Ce.setInput(xe,qe.yy),qe.yy.lexer=Ce,qe.yy.parser=this,typeof Ce.yylloc>"u"&&(Ce.yylloc={});var xt=Ce.yylloc;U.push(xt);var ft=Ce.options&&Ce.options.ranges;typeof qe.yy.parseError=="function"?this.parseError=qe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ze(Qt){de.length=de.length-2*Qt,he.length=he.length-Qt,U.length=U.length-Qt}v(Ze,"popStack");function st(){var Qt;return Qt=ie.pop()||Ce.lex()||ge,typeof Qt!="number"&&(Qt instanceof Array&&(ie=Qt,Qt=ie.pop()),Qt=q.symbols_[Qt]||Qt),Qt}v(st,"lex");for(var Ue,Ke,it,mt,Ht,ot,et={},ht,bt,tt,_t;;){if(it=de[de.length-1],this.defaultActions[it]?mt=this.defaultActions[it]:((Ue===null||typeof Ue>"u")&&(Ue=st()),mt=ke[it]&&ke[it][Ue]),typeof mt>"u"||!mt.length||!mt[0]){var ur="";_t=[];for(ht in ke[it])this.terminals_[ht]&&ht>Fe&&_t.push("'"+this.terminals_[ht]+"'");Ce.showPosition?ur="Parse error on line "+(ye+1)+`: `+Ce.showPosition()+` Expecting `+_t.join(", ")+", got '"+(this.terminals_[Ue]||Ue)+"'":ur="Parse error on line "+(ye+1)+": Unexpected "+(Ue==ge?"end of input":"'"+(this.terminals_[Ue]||Ue)+"'"),this.parseError(ur,{text:Ce.match,token:this.terminals_[Ue]||Ue,line:Ce.yylineno,loc:xt,expected:_t})}if(mt[0]instanceof Array&&mt.length>1)throw new Error("Parse Error: multiple actions possible at state: "+it+", token: "+Ue);switch(mt[0]){case 1:de.push(Ue),he.push(Ce.yytext),U.push(Ce.yylloc),de.push(mt[1]),Ue=null,Ke?(Ue=Ke,Ke=null):(Ae=Ce.yyleng,j=Ce.yytext,ye=Ce.yylineno,xt=Ce.yylloc,Ge>0&&Ge--);break;case 2:if(bt=this.productions_[mt[1]][1],et.$=he[he.length-bt],et._$={first_line:U[U.length-(bt||1)].first_line,last_line:U[U.length-1].last_line,first_column:U[U.length-(bt||1)].first_column,last_column:U[U.length-1].last_column},ft&&(et._$.range=[U[U.length-(bt||1)].range[0],U[U.length-1].range[1]]),ot=this.performAction.apply(et,[j,Ae,ye,qe.yy,mt[1],he,U].concat($e)),typeof ot<"u")return ot;bt&&(de=de.slice(0,-1*bt*2),he=he.slice(0,-1*bt),U=U.slice(0,-1*bt)),de.push(this.productions_[mt[1]][0]),he.push(et.$),U.push(et._$),tt=ke[de[de.length-2]][de[de.length-1]],de.push(tt);break;case 3:return!0}}return!0},"parse")},We=function(){var Pe={EOF:1,parseError:v(function(q,de){if(this.yy.parser)this.yy.parser.parseError(q,de);else throw new Error(q)},"parseError"),setInput:v(function(xe,q){return this.yy=q||this.yy||{},this._input=xe,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var xe=this._input[0];this.yytext+=xe,this.yyleng++,this.offset++,this.match+=xe,this.matched+=xe;var q=xe.match(/(?:\r\n?|\n).*/g);return q?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),xe},"input"),unput:v(function(xe){var q=xe.length,de=xe.split(/(?:\r\n?|\n)/g);this._input=xe+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-q),this.offset-=q;var ie=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),de.length-1&&(this.yylineno-=de.length-1);var he=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:de?(de.length===ie.length?this.yylloc.first_column:0)+ie[ie.length-de.length].length-de[0].length:this.yylloc.first_column-q},this.options.ranges&&(this.yylloc.range=[he[0],he[0]+this.yyleng-q]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(xe){this.unput(this.match.slice(xe))},"less"),pastInput:v(function(){var xe=this.matched.substr(0,this.matched.length-this.match.length);return(xe.length>20?"...":"")+xe.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var xe=this.match;return xe.length<20&&(xe+=this._input.substr(0,20-xe.length)),(xe.substr(0,20)+(xe.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var xe=this.pastInput(),q=new Array(xe.length+1).join("-");return xe+this.upcomingInput()+` `+q+"^"},"showPosition"),test_match:v(function(xe,q){var de,ie,he;if(this.options.backtrack_lexer&&(he={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(he.yylloc.range=this.yylloc.range.slice(0))),ie=xe[0].match(/(?:\r\n?|\n).*/g),ie&&(this.yylineno+=ie.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ie?ie[ie.length-1].length-ie[ie.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+xe[0].length},this.yytext+=xe[0],this.match+=xe[0],this.matches=xe,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(xe[0].length),this.matched+=xe[0],de=this.performAction.call(this,this.yy,this,q,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),de)return de;if(this._backtrack){for(var U in he)this[U]=he[U];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var xe,q,de,ie;this._more||(this.yytext="",this.match="");for(var he=this._currentRules(),U=0;Uq[0].length)){if(q=de,ie=U,this.options.backtrack_lexer){if(xe=this.test_match(de,he[U]),xe!==!1)return xe;if(this._backtrack){q=!1;continue}else return!1}else if(!this.options.flex)break}return q?(xe=this.test_match(q,he[ie]),xe!==!1?xe:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var q=this.next();return q||this.lex()},"lex"),begin:v(function(q){this.conditionStack.push(q)},"begin"),popState:v(function(){var q=this.conditionStack.length-1;return q>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(q){return q=this.conditionStack.length-1-Math.abs(q||0),q>=0?this.conditionStack[q]:"INITIAL"},"topState"),pushState:v(function(q){this.begin(q)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:v(function(q,de,ie,he){var U=he;switch(ie){case 0:return 60;case 1:return 61;case 2:return 62;case 3:return 63;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),35;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 77;case 22:this.popState();break;case 23:return 78;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 80;case 28:return 55;case 29:return this.begin("namespace"),42;break;case 30:return this.popState(),8;break;case 31:break;case 32:return this.begin("namespace-body"),39;break;case 33:return this.popState(),41;break;case 34:return"EOF_IN_STRUCT";case 35:return 8;case 36:break;case 37:return"EDGE_STATE";case 38:return this.begin("class"),46;break;case 39:return this.popState(),8;break;case 40:break;case 41:return this.popState(),this.popState(),41;break;case 42:return this.begin("class-body"),39;break;case 43:return this.popState(),41;break;case 44:return"EOF_IN_STRUCT";case 45:return"EDGE_STATE";case 46:return"OPEN_IN_STRUCT";case 47:break;case 48:return"MEMBER";case 49:return 81;case 50:return 73;case 51:return 74;case 52:return 76;case 53:return 52;case 54:return 54;case 55:return 47;case 56:return 48;case 57:return 79;case 58:this.popState();break;case 59:return"GENERICTYPE";case 60:this.begin("generic");break;case 61:this.popState();break;case 62:return"BQUOTE_STR";case 63:this.begin("bqstring");break;case 64:return 75;case 65:return 75;case 66:return 75;case 67:return 75;case 68:return 67;case 69:return 67;case 70:return 69;case 71:return 69;case 72:return 68;case 73:return 66;case 74:return 70;case 75:return 71;case 76:return 72;case 77:return 22;case 78:return 44;case 79:return 99;case 80:return 17;case 81:return"PLUS";case 82:return 85;case 83:return 59;case 84:return 88;case 85:return 88;case 86:return 89;case 87:return"EQUALS";case 88:return"EQUALS";case 89:return 58;case 90:return 12;case 91:return 14;case 92:return"PUNCTUATION";case 93:return 84;case 94:return 101;case 95:return 87;case 96:return 87;case 97:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,33,34,35,36,37,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},namespace:{rules:[26,29,30,31,32,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},"class-body":{rules:[26,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},class:{rules:[26,39,40,41,42,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_descr:{rules:[9,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},acc_title:{rules:[7,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_args:{rules:[22,23,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},callback_name:{rules:[19,20,21,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},href:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},struct:{rules:[26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},generic:{rules:[26,49,50,51,52,53,54,55,56,57,58,59,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},bqstring:{rules:[26,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},string:{rules:[24,25,26,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,86,87,88,89,90,91,92,93,94,95,97],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,38,49,50,51,52,53,54,55,56,57,60,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],inclusive:!0}}};return Pe}();De.lexer=We;function Re(){this.yy={}}return v(Re,"Parser"),Re.prototype=De,De.Parser=Re,new Re}();EM.parser=EM;jT=EM,Pue=["#","+","~","-",""],Bue=class{static{v(this,"ClassMember")}constructor(t,e){this.memberType=e,this.visibility="",this.classifier="",this.text="";let r=yr(t,pe());this.parseMember(r)}getDisplayDetails(){let t=this.visibility+iu(this.id);this.memberType==="method"&&(t+=`(${iu(this.parameters.trim())})`,this.returnType&&(t+=" : "+iu(this.returnType))),t=t.trim();let e=this.parseClassifier();return{displayText:t,cssStyle:e}}parseMember(t){let e="";if(this.memberType==="method"){let i=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(t);if(i){let a=i[1]?i[1].trim():"";if(Pue.includes(a)&&(this.visibility=a),this.id=i[2],this.parameters=i[3]?i[3].trim():"",e=i[4]?i[4].trim():"",this.returnType=i[5]?i[5].trim():"",e===""){let s=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(s)&&(e=s,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{let n=t.length,i=t.substring(0,1),a=t.substring(n-1);Pue.includes(i)&&(this.visibility=i),/[$*]/.exec(a)&&(e=a),this.id=t.substring(this.visibility===""?0:1,e===""?n:n-1)}this.classifier=e,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();let r=`${this.visibility?"\\"+this.visibility:""}${iu(this.id)}${this.memberType==="method"?`(${iu(this.parameters)})${this.returnType?" : "+iu(this.returnType):""}`:""}`;this.text=r.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}},KT="classId-",ZT=[],An=new Map,Fue=new Map,rx=[],Rm=[],zue=0,Ml=new Map,SM=0,nx=[],b0=v(t=>Xe.sanitizeText(t,pe()),"sanitizeText"),w0=v(function(t){let e=Xe.sanitizeText(t,pe()),r="",n=e;if(e.indexOf("~")>0){let i=e.split("~");n=b0(i[0]),r=b0(i[1])}return{className:n,type:r}},"splitClassNameAndType"),TFe=v(function(t,e){let r=Xe.sanitizeText(t,pe());e&&(e=b0(e));let{className:n}=w0(r);An.get(n).label=e,An.get(n).text=`${e}${An.get(n).type?`<${An.get(n).type}>`:""}`},"setClassLabel"),Lm=v(function(t){let e=Xe.sanitizeText(t,pe()),{className:r,type:n}=w0(e);if(An.has(r))return;let i=Xe.sanitizeText(r,pe());An.set(i,{id:i,type:n,label:i,text:`${i}${n?`<${n}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:KT+i+"-"+zue}),zue++},"addClass"),$ue=v(function(t,e){let r={id:`interface${Rm.length}`,label:t,classId:e};Rm.push(r)},"addInterface"),Gue=v(function(t){let e=Xe.sanitizeText(t,pe());if(An.has(e))return An.get(e).domId;throw new Error("Class not found: "+e)},"lookUpDomId"),EFe=v(function(){ZT=[],An=new Map,rx=[],Rm=[],nx=[],nx.push(Vue),Ml=new Map,SM=0,_M="TB",xr()},"clear"),SFe=v(function(t){return An.get(t)},"getClass"),CFe=v(function(){return An},"getClasses"),AFe=v(function(){return ZT},"getRelations"),_Fe=v(function(){return rx},"getNotes"),LFe=v(function(t){re.debug("Adding relation: "+JSON.stringify(t));let e=[hf.LOLLIPOP,hf.AGGREGATION,hf.COMPOSITION,hf.DEPENDENCY,hf.EXTENSION];t.relation.type1===hf.LOLLIPOP&&!e.includes(t.relation.type2)?(Lm(t.id2),$ue(t.id1,t.id2),t.id1=`interface${Rm.length-1}`):t.relation.type2===hf.LOLLIPOP&&!e.includes(t.relation.type1)?(Lm(t.id1),$ue(t.id2,t.id1),t.id2=`interface${Rm.length-1}`):(Lm(t.id1),Lm(t.id2)),t.id1=w0(t.id1).className,t.id2=w0(t.id2).className,t.relationTitle1=Xe.sanitizeText(t.relationTitle1.trim(),pe()),t.relationTitle2=Xe.sanitizeText(t.relationTitle2.trim(),pe()),ZT.push(t)},"addRelation"),RFe=v(function(t,e){let r=w0(t).className;An.get(r).annotations.push(e)},"addAnnotation"),Uue=v(function(t,e){Lm(t);let r=w0(t).className,n=An.get(r);if(typeof e=="string"){let i=e.trim();i.startsWith("<<")&&i.endsWith(">>")?n.annotations.push(b0(i.substring(2,i.length-2))):i.indexOf(")")>0?n.methods.push(new Bue(i,"method")):i&&n.members.push(new Bue(i,"attribute"))}},"addMember"),NFe=v(function(t,e){Array.isArray(e)&&(e.reverse(),e.forEach(r=>Uue(t,r)))},"addMembers"),IFe=v(function(t,e){let r={id:`note${rx.length}`,class:e,text:t};rx.push(r)},"addNote"),MFe=v(function(t){return t.startsWith(":")&&(t=t.substring(1)),b0(t.trim())},"cleanupLabel"),AM=v(function(t,e){t.split(",").forEach(function(r){let n=r;/\d/.exec(r[0])&&(n=KT+n);let i=An.get(n);i&&(i.cssClasses+=" "+e)})},"setCssClass"),DFe=v(function(t,e){for(let r of t){let n=Fue.get(r);n===void 0&&(n={id:r,styles:[],textStyles:[]},Fue.set(r,n)),e&&e.forEach(function(i){if(/color/.exec(i)){let a=i.replace("fill","bgFill");n.textStyles.push(a)}n.styles.push(i)}),An.forEach(i=>{i.cssClasses.includes(r)&&i.styles.push(...e.flatMap(a=>a.split(",")))})}},"defineClass"),OFe=v(function(t,e){t.split(",").forEach(function(r){e!==void 0&&(An.get(r).tooltip=b0(e))})},"setTooltip"),PFe=v(function(t,e){return e&&Ml.has(e)?Ml.get(e).classes.get(t).tooltip:An.get(t).tooltip},"getTooltip"),BFe=v(function(t,e,r){let n=pe();t.split(",").forEach(function(i){let a=i;/\d/.exec(i[0])&&(a=KT+a);let s=An.get(a);s&&(s.link=Ut.formatUrl(e,n),n.securityLevel==="sandbox"?s.linkTarget="_top":typeof r=="string"?s.linkTarget=b0(r):s.linkTarget="_blank")}),AM(t,"clickable")},"setLink"),FFe=v(function(t,e,r){t.split(",").forEach(function(n){zFe(n,e,r),An.get(n).haveCallback=!0}),AM(t,"clickable")},"setClickEvent"),zFe=v(function(t,e,r){let n=Xe.sanitizeText(t,pe());if(pe().securityLevel!=="loose"||e===void 0)return;let a=n;if(An.has(a)){let s=Gue(a),o=[];if(typeof r=="string"){o=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let l=0;l")),i.classed("hover",!0)}).on("mouseout",function(){e.transition().duration(500).style("opacity",0),Ve(this).classed("hover",!1)})},"setupToolTips");nx.push(Vue);_M="TB",Wue=v(()=>_M,"getDirection"),UFe=v(t=>{_M=t},"setDirection"),VFe=v(function(t){Ml.has(t)||(Ml.set(t,{id:t,classes:new Map,children:{},domId:KT+t+"-"+SM}),SM++)},"addNamespace"),WFe=v(function(t){return Ml.get(t)},"getNamespace"),HFe=v(function(){return Ml},"getNamespaces"),qFe=v(function(t,e){if(Ml.has(t))for(let r of e){let{className:n}=w0(r);An.get(n).parent=t,Ml.get(t).classes.set(n,An.get(n))}},"addClassesToNamespace"),YFe=v(function(t,e){let r=An.get(t);if(!(!e||!r))for(let n of e)n.includes(",")?r.styles.push(...n.split(",")):r.styles.push(n)},"setCssStyle");v(CM,"getArrowMarker");XFe=v(()=>{let t=[],e=[],r=pe();for(let i of Ml.keys()){let a=Ml.get(i);if(a){let s={id:a.id,label:a.id,isGroup:!0,padding:r.class.padding??16,shape:"rect",cssStyles:["fill: none","stroke: black"],look:r.look};t.push(s)}}for(let i of An.keys()){let a=An.get(i);if(a){let s=a;s.parentId=a.parent,s.look=r.look,t.push(s)}}let n=0;for(let i of rx){n++;let a={id:i.id,label:i.text,isGroup:!1,shape:"note",padding:r.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${r.themeVariables.noteBkgColor}`,`stroke: ${r.themeVariables.noteBorderColor}`],look:r.look};t.push(a);let s=An.get(i.class)?.id??"";if(s){let o={id:`edgeNote${n}`,start:i.id,end:s,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:r.look};e.push(o)}}for(let i of Rm){let a={id:i.id,label:i.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:r.look};t.push(a)}n=0;for(let i of ZT){n++;let a={id:V3(i.id1,i.id2,{prefix:"id",counter:n}),start:i.id1,end:i.id2,type:"normal",label:i.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:CM(i.relation.type1),arrowTypeEnd:CM(i.relation.type2),startLabelRight:i.relationTitle1==="none"?"":i.relationTitle1,endLabelLeft:i.relationTitle2==="none"?"":i.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:i.style||"",pattern:i.relation.lineType==1?"dashed":"solid",look:r.look};e.push(a)}return{nodes:t,edges:e,other:{},config:r,direction:Wue()}},"getData"),Nm={setAccTitle:Tr,getAccTitle:_r,getAccDescription:Rr,setAccDescription:Lr,getConfig:v(()=>pe().class,"getConfig"),addClass:Lm,bindFunctions:$Fe,clear:EFe,getClass:SFe,getClasses:CFe,getNotes:_Fe,addAnnotation:RFe,addNote:IFe,getRelations:AFe,addRelation:LFe,getDirection:Wue,setDirection:UFe,addMember:Uue,addMembers:NFe,cleanupLabel:MFe,lineType:GFe,relationType:hf,setClickEvent:FFe,setCssClass:AM,defineClass:DFe,setLink:BFe,getTooltip:PFe,setTooltip:OFe,lookUpDomId:Gue,setDiagramTitle:tn,getDiagramTitle:qr,setClassLabel:TFe,addNamespace:VFe,addClassesToNamespace:qFe,getNamespace:WFe,getNamespaces:HFe,setCssStyle:YFe,getData:XFe},jFe=v(t=>`g.classGroup text { fill: ${t.nodeBorder||t.classText}; stroke: none; font-family: ${t.fontFamily}; font-size: 10px; .title { font-weight: bolder; } } .nodeLabel, .edgeLabel { color: ${t.classText}; } .edgeLabel .label rect { fill: ${t.mainBkg}; } .label text { fill: ${t.classText}; } .labelBkg { background: ${t.mainBkg}; } .edgeLabel .label span { background: ${t.mainBkg}; } .classTitle { font-weight: bolder; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: 1px; } .divider { stroke: ${t.nodeBorder}; stroke-width: 1; } g.clickable { cursor: pointer; } g.classGroup rect { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; } g.classGroup line { stroke: ${t.nodeBorder}; stroke-width: 1; } .classLabel .box { stroke: none; stroke-width: 0; fill: ${t.mainBkg}; opacity: 0.5; } .classLabel .label { fill: ${t.nodeBorder}; font-size: 10px; } .relation { stroke: ${t.lineColor}; stroke-width: 1; fill: none; } .dashed-line{ stroke-dasharray: 3; } .dotted-line{ stroke-dasharray: 1 2; } #compositionStart, .composition { fill: ${t.lineColor} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #compositionEnd, .composition { fill: ${t.lineColor} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #dependencyStart, .dependency { fill: ${t.lineColor} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #dependencyStart, .dependency { fill: ${t.lineColor} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #extensionStart, .extension { fill: transparent !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #extensionEnd, .extension { fill: transparent !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #aggregationStart, .aggregation { fill: transparent !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #aggregationEnd, .aggregation { fill: transparent !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #lollipopStart, .lollipop { fill: ${t.mainBkg} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } #lollipopEnd, .lollipop { fill: ${t.mainBkg} !important; stroke: ${t.lineColor} !important; stroke-width: 1; } .edgeTerminals { font-size: 11px; line-height: initial; } .classTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } `,"getStyles"),QT=jFe,KFe=v((t,e="TB")=>{if(!t.doc)return e;let r=e;for(let n of t.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),ZFe=v(function(t,e){return e.db.getClasses()},"getClasses"),QFe=v(async function(t,e,r,n){re.info("REF0:"),re.info("Drawing class diagram (v3)",e);let{securityLevel:i,state:a,layout:s}=pe(),o=n.db.getData(),l=Ag(e,i);o.type=n.type,o.layoutAlgorithm=vw(s),o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,o.markers=["aggregation","extension","composition","dependency","lollipop"],o.diagramId=e,await kg(o,l);let u=8;Ut.insertTitle(l,"classDiagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),_g(l,u,"classDiagram",a?.useMaxWidth??!0)},"draw"),JT={getClasses:ZFe,draw:QFe,getDir:KFe}});var Hue={};vr(Hue,{diagram:()=>JFe});var JFe,que=F(()=>{LM();Kh();Nu();_u();yl();sl();pc();bo();Ya();kn();or();JFe={parser:jT,db:Nm,renderer:JT,styles:QT,init:v(t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Nm.clear()},"init")}});var Yue={};vr(Yue,{diagram:()=>eze});var eze,Xue=F(()=>{LM();Kh();Nu();_u();yl();sl();pc();bo();Ya();kn();or();eze={parser:jT,db:Nm,renderer:JT,styles:QT,init:v(t=>{t.class||(t.class={}),t.class.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Nm.clear()},"init")}});function r6(t="",e=0,r="",n=OM){let i=r!==null&&r.length>0?`${n}${r}`:"";return`${xze}-${t}${i}-${e}`}function ix(t,e,r){if(!e.id||e.id===""||e.id==="")return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(i=>{if(r.get(i)){let a=r.get(i);e.cssCompiledStyles=[...e.cssCompiledStyles,...a.styles]}}));let n=t.find(i=>i.id===e.id);n?Object.assign(n,e):t.push(e)}function phe(t){return t?.classes?.join(" ")??""}function ghe(t){return t?.styles??[]}function BM(){return new Map}function l6(t=""){let e=t;return t===PM&&(sx++,e=`${mhe}${sx}`),e}function c6(t="",e=ox){return t===PM?mhe:e}function The(t=""){let e=t;return t===vhe&&(sx++,e=`${yhe}${sx}`),e}function Ehe(t="",e=ox){return t===vhe?yhe:e}function She(t,e,r){let n=l6(t.id.trim()),i=c6(t.id.trim(),t.type),a=l6(e.id.trim()),s=c6(e.id.trim(),e.type);df(n,i,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),df(a,s,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),Ps.relations.push({id1:n,id2:a,relationTitle:Xe.sanitizeText(r,pe())})}var IM,u6,tze,rhe,i6,DM,rze,nze,ize,ox,nhe,ihe,ahe,she,ohe,lhe,RM,NM,aze,sze,jue,Kue,oze,lze,lx,cze,uze,che,hze,fze,dze,pze,gze,mze,vze,yze,uhe,hhe,xze,OM,bze,Zue,fhe,wze,kze,dhe,t6,ff,Tze,Que,ax,Eze,PM,mhe,vhe,yhe,Jue,ehe,Sze,Cze,a6,FM,xhe,s6,Im,bhe,o6,Ps,sx,the,Aze,_ze,e6,Lze,Rze,n6,zM,Nze,df,whe,k0,khe,Ize,Mze,Che,MM,Dze,Oze,Ahe,Pze,$M,Bze,Fze,zze,$ze,Gze,Uze,Dl,Vze,h6,GM=F(()=>{Kh();Nu();kn();or();IM=function(){var t=v(function(B,P,$,z){for($=$||{},z=B.length;z--;$[B[z]]=P);return $},"o"),e=[1,2],r=[1,3],n=[1,4],i=[2,4],a=[1,9],s=[1,11],o=[1,16],l=[1,17],u=[1,18],h=[1,19],f=[1,32],d=[1,20],p=[1,21],g=[1,22],m=[1,23],y=[1,24],x=[1,26],b=[1,27],w=[1,28],_=[1,29],k=[1,30],E=[1,31],L=[1,34],S=[1,35],C=[1,36],M=[1,37],R=[1,33],T=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],I=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],A=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],D={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,classDef:38,CLASSDEF_ID:39,CLASSDEF_STYLEOPTS:40,DEFAULT:41,style:42,STYLE_IDS:43,STYLEDEF_STYLEOPTS:44,class:45,CLASSENTITY_IDS:46,STYLECLASS:47,direction_tb:48,direction_bt:49,direction_rl:50,direction_lr:51,eol:52,";":53,EDGE_STATE:54,STYLE_SEPARATOR:55,left_of:56,right_of:57,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"classDef",39:"CLASSDEF_ID",40:"CLASSDEF_STYLEOPTS",41:"DEFAULT",42:"style",43:"STYLE_IDS",44:"STYLEDEF_STYLEOPTS",45:"class",46:"CLASSENTITY_IDS",47:"STYLECLASS",48:"direction_tb",49:"direction_bt",50:"direction_rl",51:"direction_lr",53:";",54:"EDGE_STATE",55:"STYLE_SEPARATOR",56:"left_of",57:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[52,1],[52,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:v(function(P,$,z,H,J,X,oe){var K=X.length-1;switch(J){case 3:return H.setRootDoc(X[K]),X[K];break;case 4:this.$=[];break;case 5:X[K]!="nl"&&(X[K-1].push(X[K]),this.$=X[K-1]);break;case 6:case 7:this.$=X[K];break;case 8:this.$="nl";break;case 12:this.$=X[K];break;case 13:let Y=X[K-1];Y.description=H.trimColon(X[K]),this.$=Y;break;case 14:this.$={stmt:"relation",state1:X[K-2],state2:X[K]};break;case 15:let Z=H.trimColon(X[K]);this.$={stmt:"relation",state1:X[K-3],state2:X[K-1],description:Z};break;case 19:this.$={stmt:"state",id:X[K-3],type:"default",description:"",doc:X[K-1]};break;case 20:var ee=X[K],Q=X[K-2].trim();if(X[K].match(":")){var W=X[K].split(":");ee=W[0],Q=[Q,W[1]]}this.$={stmt:"state",id:ee,type:"default",description:Q};break;case 21:this.$={stmt:"state",id:X[K-3],type:"default",description:X[K-5],doc:X[K-1]};break;case 22:this.$={stmt:"state",id:X[K],type:"fork"};break;case 23:this.$={stmt:"state",id:X[K],type:"join"};break;case 24:this.$={stmt:"state",id:X[K],type:"choice"};break;case 25:this.$={stmt:"state",id:H.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:X[K-1].trim(),note:{position:X[K-2].trim(),text:X[K].trim()}};break;case 29:this.$=X[K].trim(),H.setAccTitle(this.$);break;case 30:case 31:this.$=X[K].trim(),H.setAccDescription(this.$);break;case 32:case 33:this.$={stmt:"classDef",id:X[K-1].trim(),classes:X[K].trim()};break;case 34:this.$={stmt:"style",id:X[K-1].trim(),styleClass:X[K].trim()};break;case 35:this.$={stmt:"applyClass",id:X[K-1].trim(),styleClass:X[K].trim()};break;case 36:H.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 37:H.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 38:H.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 39:H.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 42:case 43:this.$={stmt:"state",id:X[K].trim(),type:"default",description:""};break;case 44:this.$={stmt:"state",id:X[K-2].trim(),classes:[X[K].trim()],type:"default",description:""};break;case 45:this.$={stmt:"state",id:X[K-2].trim(),classes:[X[K].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:r,6:n},{1:[3]},{3:5,4:e,5:r,6:n},{3:6,4:e,5:r,6:n},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,42,45,48,49,50,51,54],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:g,28:m,29:y,32:25,33:x,35:b,37:w,38:_,42:k,45:E,48:L,49:S,50:C,51:M,54:R},t(T,[2,5]),{9:38,10:12,11:13,12:14,13:15,16:o,17:l,19:u,22:h,24:f,25:d,26:p,27:g,28:m,29:y,32:25,33:x,35:b,37:w,38:_,42:k,45:E,48:L,49:S,50:C,51:M,54:R},t(T,[2,7]),t(T,[2,8]),t(T,[2,9]),t(T,[2,10]),t(T,[2,11]),t(T,[2,12],{14:[1,39],15:[1,40]}),t(T,[2,16]),{18:[1,41]},t(T,[2,18],{20:[1,42]}),{23:[1,43]},t(T,[2,22]),t(T,[2,23]),t(T,[2,24]),t(T,[2,25]),{30:44,31:[1,45],56:[1,46],57:[1,47]},t(T,[2,28]),{34:[1,48]},{36:[1,49]},t(T,[2,31]),{39:[1,50],41:[1,51]},{43:[1,52]},{46:[1,53]},t(I,[2,42],{55:[1,54]}),t(I,[2,43],{55:[1,55]}),t(T,[2,36]),t(T,[2,37]),t(T,[2,38]),t(T,[2,39]),t(T,[2,6]),t(T,[2,13]),{13:56,24:f,54:R},t(T,[2,17]),t(A,i,{7:57}),{24:[1,58]},{24:[1,59]},{23:[1,60]},{24:[2,46]},{24:[2,47]},t(T,[2,29]),t(T,[2,30]),{40:[1,61]},{40:[1,62]},{44:[1,63]},{47:[1,64]},{24:[1,65]},{24:[1,66]},t(T,[2,14],{14:[1,67]}),{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,68],22:h,24:f,25:d,26:p,27:g,28:m,29:y,32:25,33:x,35:b,37:w,38:_,42:k,45:E,48:L,49:S,50:C,51:M,54:R},t(T,[2,20],{20:[1,69]}),{31:[1,70]},{24:[1,71]},t(T,[2,32]),t(T,[2,33]),t(T,[2,34]),t(T,[2,35]),t(I,[2,44]),t(I,[2,45]),t(T,[2,15]),t(T,[2,19]),t(A,i,{7:72}),t(T,[2,26]),t(T,[2,27]),{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:o,17:l,19:u,21:[1,73],22:h,24:f,25:d,26:p,27:g,28:m,29:y,32:25,33:x,35:b,37:w,38:_,42:k,45:E,48:L,49:S,50:C,51:M,54:R},t(T,[2,21])],defaultActions:{5:[2,1],6:[2,2],46:[2,46],47:[2,47]},parseError:v(function(P,$){if($.recoverable)this.trace(P);else{var z=new Error(P);throw z.hash=$,z}},"parseError"),parse:v(function(P){var $=this,z=[0],H=[],J=[null],X=[],oe=this.table,K="",ee=0,Q=0,W=0,Y=2,Z=1,se=X.slice.call(arguments,1),ce=Object.create(this.lexer),ue={yy:{}};for(var te in this.yy)Object.prototype.hasOwnProperty.call(this.yy,te)&&(ue.yy[te]=this.yy[te]);ce.setInput(P,ue.yy),ue.yy.lexer=ce,ue.yy.parser=this,typeof ce.yylloc>"u"&&(ce.yylloc={});var Ne=ce.yylloc;X.push(Ne);var ae=ce.options&&ce.options.ranges;typeof ue.yy.parseError=="function"?this.parseError=ue.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function we(ke){z.length=z.length-2*ke,J.length=J.length-ke,X.length=X.length-ke}v(we,"popStack");function Ie(){var ke;return ke=H.pop()||ce.lex()||Z,typeof ke!="number"&&(ke instanceof Array&&(H=ke,ke=H.pop()),ke=$.symbols_[ke]||ke),ke}v(Ie,"lex");for(var Ee,Oe,De,We,Re,Pe,xe={},q,de,ie,he;;){if(De=z[z.length-1],this.defaultActions[De]?We=this.defaultActions[De]:((Ee===null||typeof Ee>"u")&&(Ee=Ie()),We=oe[De]&&oe[De][Ee]),typeof We>"u"||!We.length||!We[0]){var U="";he=[];for(q in oe[De])this.terminals_[q]&&q>Y&&he.push("'"+this.terminals_[q]+"'");ce.showPosition?U="Parse error on line "+(ee+1)+`: `+ce.showPosition()+` Expecting `+he.join(", ")+", got '"+(this.terminals_[Ee]||Ee)+"'":U="Parse error on line "+(ee+1)+": Unexpected "+(Ee==Z?"end of input":"'"+(this.terminals_[Ee]||Ee)+"'"),this.parseError(U,{text:ce.match,token:this.terminals_[Ee]||Ee,line:ce.yylineno,loc:Ne,expected:he})}if(We[0]instanceof Array&&We.length>1)throw new Error("Parse Error: multiple actions possible at state: "+De+", token: "+Ee);switch(We[0]){case 1:z.push(Ee),J.push(ce.yytext),X.push(ce.yylloc),z.push(We[1]),Ee=null,Oe?(Ee=Oe,Oe=null):(Q=ce.yyleng,K=ce.yytext,ee=ce.yylineno,Ne=ce.yylloc,W>0&&W--);break;case 2:if(de=this.productions_[We[1]][1],xe.$=J[J.length-de],xe._$={first_line:X[X.length-(de||1)].first_line,last_line:X[X.length-1].last_line,first_column:X[X.length-(de||1)].first_column,last_column:X[X.length-1].last_column},ae&&(xe._$.range=[X[X.length-(de||1)].range[0],X[X.length-1].range[1]]),Pe=this.performAction.apply(xe,[K,Q,ee,ue.yy,We[1],J,X].concat(se)),typeof Pe<"u")return Pe;de&&(z=z.slice(0,-1*de*2),J=J.slice(0,-1*de),X=X.slice(0,-1*de)),z.push(this.productions_[We[1]][0]),J.push(xe.$),X.push(xe._$),ie=oe[z[z.length-2]][z[z.length-1]],z.push(ie);break;case 3:return!0}}return!0},"parse")},N=function(){var B={EOF:1,parseError:v(function($,z){if(this.yy.parser)this.yy.parser.parseError($,z);else throw new Error($)},"parseError"),setInput:v(function(P,$){return this.yy=$||this.yy||{},this._input=P,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var P=this._input[0];this.yytext+=P,this.yyleng++,this.offset++,this.match+=P,this.matched+=P;var $=P.match(/(?:\r\n?|\n).*/g);return $?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),P},"input"),unput:v(function(P){var $=P.length,z=P.split(/(?:\r\n?|\n)/g);this._input=P+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-$),this.offset-=$;var H=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),z.length-1&&(this.yylineno-=z.length-1);var J=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:z?(z.length===H.length?this.yylloc.first_column:0)+H[H.length-z.length].length-z[0].length:this.yylloc.first_column-$},this.options.ranges&&(this.yylloc.range=[J[0],J[0]+this.yyleng-$]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(P){this.unput(this.match.slice(P))},"less"),pastInput:v(function(){var P=this.matched.substr(0,this.matched.length-this.match.length);return(P.length>20?"...":"")+P.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var P=this.match;return P.length<20&&(P+=this._input.substr(0,20-P.length)),(P.substr(0,20)+(P.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var P=this.pastInput(),$=new Array(P.length+1).join("-");return P+this.upcomingInput()+` `+$+"^"},"showPosition"),test_match:v(function(P,$){var z,H,J;if(this.options.backtrack_lexer&&(J={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(J.yylloc.range=this.yylloc.range.slice(0))),H=P[0].match(/(?:\r\n?|\n).*/g),H&&(this.yylineno+=H.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:H?H[H.length-1].length-H[H.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+P[0].length},this.yytext+=P[0],this.match+=P[0],this.matches=P,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(P[0].length),this.matched+=P[0],z=this.performAction.call(this,this.yy,this,$,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),z)return z;if(this._backtrack){for(var X in J)this[X]=J[X];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var P,$,z,H;this._more||(this.yytext="",this.match="");for(var J=this._currentRules(),X=0;X$[0].length)){if($=z,H=X,this.options.backtrack_lexer){if(P=this.test_match(z,J[X]),P!==!1)return P;if(this._backtrack){$=!1;continue}else return!1}else if(!this.options.flex)break}return $?(P=this.test_match($,J[H]),P!==!1?P:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var $=this.next();return $||this.lex()},"lex"),begin:v(function($){this.conditionStack.push($)},"begin"),popState:v(function(){var $=this.conditionStack.length-1;return $>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function($){return $=this.conditionStack.length-1-Math.abs($||0),$>=0?this.conditionStack[$]:"INITIAL"},"topState"),pushState:v(function($){this.begin($)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function($,z,H,J){var X=J;switch(H){case 0:return 41;case 1:return 48;case 2:return 49;case 3:return 50;case 4:return 51;case 5:break;case 6:break;case 7:return 5;case 8:break;case 9:break;case 10:break;case 11:break;case 12:return this.pushState("SCALE"),17;break;case 13:return 18;case 14:this.popState();break;case 15:return this.begin("acc_title"),33;break;case 16:return this.popState(),"acc_title_value";break;case 17:return this.begin("acc_descr"),35;break;case 18:return this.popState(),"acc_descr_value";break;case 19:this.begin("acc_descr_multiline");break;case 20:this.popState();break;case 21:return"acc_descr_multiline_value";case 22:return this.pushState("CLASSDEF"),38;break;case 23:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 24:return this.popState(),this.pushState("CLASSDEFID"),39;break;case 25:return this.popState(),40;break;case 26:return this.pushState("CLASS"),45;break;case 27:return this.popState(),this.pushState("CLASS_STYLE"),46;break;case 28:return this.popState(),47;break;case 29:return this.pushState("STYLE"),42;break;case 30:return this.popState(),this.pushState("STYLEDEF_STYLES"),43;break;case 31:return this.popState(),44;break;case 32:return this.pushState("SCALE"),17;break;case 33:return 18;case 34:this.popState();break;case 35:this.pushState("STATE");break;case 36:return this.popState(),z.yytext=z.yytext.slice(0,-8).trim(),25;break;case 37:return this.popState(),z.yytext=z.yytext.slice(0,-8).trim(),26;break;case 38:return this.popState(),z.yytext=z.yytext.slice(0,-10).trim(),27;break;case 39:return this.popState(),z.yytext=z.yytext.slice(0,-8).trim(),25;break;case 40:return this.popState(),z.yytext=z.yytext.slice(0,-8).trim(),26;break;case 41:return this.popState(),z.yytext=z.yytext.slice(0,-10).trim(),27;break;case 42:return 48;case 43:return 49;case 44:return 50;case 45:return 51;case 46:this.pushState("STATE_STRING");break;case 47:return this.pushState("STATE_ID"),"AS";break;case 48:return this.popState(),"ID";break;case 49:this.popState();break;case 50:return"STATE_DESCR";case 51:return 19;case 52:this.popState();break;case 53:return this.popState(),this.pushState("struct"),20;break;case 54:break;case 55:return this.popState(),21;break;case 56:break;case 57:return this.begin("NOTE"),29;break;case 58:return this.popState(),this.pushState("NOTE_ID"),56;break;case 59:return this.popState(),this.pushState("NOTE_ID"),57;break;case 60:this.popState(),this.pushState("FLOATING_NOTE");break;case 61:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 62:break;case 63:return"NOTE_TEXT";case 64:return this.popState(),"ID";break;case 65:return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 66:return this.popState(),z.yytext=z.yytext.substr(2).trim(),31;break;case 67:return this.popState(),z.yytext=z.yytext.slice(0,-8).trim(),31;break;case 68:return 6;case 69:return 6;case 70:return 16;case 71:return 54;case 72:return 24;case 73:return z.yytext=z.yytext.trim(),14;break;case 74:return 15;case 75:return 28;case 76:return 55;case 77:return 5;case 78:return"INVALID"}},"anonymous"),rules:[/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[9,10],inclusive:!1},struct:{rules:[9,10,22,26,29,35,42,43,44,45,54,55,56,57,71,72,73,74,75],inclusive:!1},FLOATING_NOTE_ID:{rules:[64],inclusive:!1},FLOATING_NOTE:{rules:[61,62,63],inclusive:!1},NOTE_TEXT:{rules:[66,67],inclusive:!1},NOTE_ID:{rules:[65],inclusive:!1},NOTE:{rules:[58,59,60],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[31],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[30],inclusive:!1},CLASS_STYLE:{rules:[28],inclusive:!1},CLASS:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[25],inclusive:!1},CLASSDEF:{rules:[23,24],inclusive:!1},acc_descr_multiline:{rules:[20,21],inclusive:!1},acc_descr:{rules:[18],inclusive:!1},acc_title:{rules:[16],inclusive:!1},SCALE:{rules:[13,14,33,34],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[48],inclusive:!1},STATE_STRING:{rules:[49,50],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[9,10,36,37,38,39,40,41,46,47,51,52,53],inclusive:!1},ID:{rules:[9,10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,10,11,12,15,17,19,22,26,29,32,35,53,57,68,69,70,71,72,73,74,76,77,78],inclusive:!0}}};return B}();D.lexer=N;function O(){this.yy={}}return v(O,"Parser"),O.prototype=D,D.Parser=O,new O}();IM.parser=IM;u6=IM,tze="LR",rhe="TB",i6="state",DM="relation",rze="classDef",nze="style",ize="applyClass",ox="default",nhe="divider",ihe="fill:none",ahe="fill: #333",she="c",ohe="text",lhe="normal",RM="rect",NM="rectWithTitle",aze="stateStart",sze="stateEnd",jue="divider",Kue="roundedWithTitle",oze="note",lze="noteGroup",lx="statediagram",cze="state",uze=`${lx}-${cze}`,che="transition",hze="note",fze="note-edge",dze=`${che} ${fze}`,pze=`${lx}-${hze}`,gze="cluster",mze=`${lx}-${gze}`,vze="cluster-alt",yze=`${lx}-${vze}`,uhe="parent",hhe="note",xze="state",OM="----",bze=`${OM}${hhe}`,Zue=`${OM}${uhe}`,fhe=v((t,e=rhe)=>{if(!t.doc)return e;let r=e;for(let n of t.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir"),wze=v(function(t,e){return e.db.extract(e.db.getRootDocV2()),e.db.getClasses()},"getClasses"),kze=v(async function(t,e,r,n){re.info("REF0:"),re.info("Drawing state diagram (v2)",e);let{securityLevel:i,state:a,layout:s}=pe();n.db.extract(n.db.getRootDocV2());let o=n.db.getData(),l=Ag(e,i);o.type=n.type,o.layoutAlgorithm=s,o.nodeSpacing=a?.nodeSpacing||50,o.rankSpacing=a?.rankSpacing||50,o.markers=["barb"],o.diagramId=e,await kg(o,l);let u=8;Ut.insertTitle(l,"statediagramTitleText",a?.titleTopMargin??25,n.db.getDiagramTitle()),_g(l,u,lx,a?.useMaxWidth??!0)},"draw"),dhe={getClasses:wze,draw:kze,getDir:fhe},t6=new Map,ff=0;v(r6,"stateDomId");Tze=v((t,e,r,n,i,a,s,o)=>{re.trace("items",e),e.forEach(l=>{switch(l.stmt){case i6:ax(t,l,r,n,i,a,s,o);break;case ox:ax(t,l,r,n,i,a,s,o);break;case DM:{ax(t,l.state1,r,n,i,a,s,o),ax(t,l.state2,r,n,i,a,s,o);let u={id:"edge"+ff,start:l.state1.id,end:l.state2.id,arrowhead:"normal",arrowTypeEnd:"arrow_barb",style:ihe,labelStyle:"",label:Xe.sanitizeText(l.description,pe()),arrowheadStyle:ahe,labelpos:she,labelType:ohe,thickness:lhe,classes:che,look:s};i.push(u),ff++}break}})},"setupDoc"),Que=v((t,e=rhe)=>{let r=e;if(t.doc)for(let n of t.doc)n.stmt==="dir"&&(r=n.value);return r},"getDir");v(ix,"insertOrUpdateNode");v(phe,"getClassesFromDbInfo");v(ghe,"getStylesFromDbInfo");ax=v((t,e,r,n,i,a,s,o)=>{let l=e.id,u=r.get(l),h=phe(u),f=ghe(u);if(re.info("dataFetcher parsedItem",e,u,f),l!=="root"){let d=RM;e.start===!0?d=aze:e.start===!1&&(d=sze),e.type!==ox&&(d=e.type),t6.get(l)||t6.set(l,{id:l,shape:d,description:Xe.sanitizeText(l,pe()),cssClasses:`${h} ${uze}`,cssStyles:f});let p=t6.get(l);e.description&&(Array.isArray(p.description)?(p.shape=NM,p.description.push(e.description)):p.description?.length>0?(p.shape=NM,p.description===l?p.description=[e.description]:p.description=[p.description,e.description]):(p.shape=RM,p.description=e.description),p.description=Xe.sanitizeTextOrArray(p.description,pe())),p.description?.length===1&&p.shape===NM&&(p.type==="group"?p.shape=Kue:p.shape=RM),!p.type&&e.doc&&(re.info("Setting cluster for XCX",l,Que(e)),p.type="group",p.isGroup=!0,p.dir=Que(e),p.shape=e.type===nhe?jue:Kue,p.cssClasses=`${p.cssClasses} ${mze} ${a?yze:""}`);let g={labelStyle:"",shape:p.shape,label:p.description,cssClasses:p.cssClasses,cssCompiledStyles:[],cssStyles:p.cssStyles,id:l,dir:p.dir,domId:r6(l,ff),type:p.type,isGroup:p.type==="group",padding:8,rx:10,ry:10,look:s};if(g.shape===jue&&(g.label=""),t&&t.id!=="root"&&(re.trace("Setting node ",l," to be child of its parent ",t.id),g.parentId=t.id),g.centerLabel=!0,e.note){let m={labelStyle:"",shape:oze,label:e.note.text,cssClasses:pze,cssStyles:[],cssCompilesStyles:[],id:l+bze+"-"+ff,domId:r6(l,ff,hhe),type:p.type,isGroup:p.type==="group",padding:pe().flowchart.padding,look:s,position:e.note.position},y=l+Zue,x={labelStyle:"",shape:lze,label:e.note.text,cssClasses:p.cssClasses,cssStyles:[],id:l+Zue,domId:r6(l,ff,uhe),type:"group",isGroup:!0,padding:16,look:s,position:e.note.position};ff++,x.id=y,m.parentId=y,ix(n,x,o),ix(n,m,o),ix(n,g,o);let b=l,w=m.id;e.note.position==="left of"&&(b=m.id,w=l),i.push({id:b+"-"+w,start:b,end:w,arrowhead:"none",arrowTypeEnd:"",style:ihe,labelStyle:"",classes:dze,arrowheadStyle:ahe,labelpos:she,labelType:ohe,thickness:lhe,look:s})}else ix(n,g,o)}e.doc&&(re.trace("Adding nodes children "),Tze(e,e.doc,r,n,i,!a,s,o))},"dataFetcher"),Eze=v(()=>{t6.clear(),ff=0},"reset"),PM="[*]",mhe="start",vhe=PM,yhe="end",Jue="color",ehe="fill",Sze="bgFill",Cze=",";v(BM,"newClassesList");a6=[],FM=[],xhe=tze,s6=[],Im=BM(),bhe=v(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),o6={root:bhe()},Ps=o6.root,sx=0,the=0,Aze={LINE:0,DOTTED_LINE:1},_ze={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3},e6=v(t=>JSON.parse(JSON.stringify(t)),"clone"),Lze=v(t=>{re.info("Setting root doc",t),s6=t},"setRootDoc"),Rze=v(()=>s6,"getRootDoc"),n6=v((t,e,r)=>{if(e.stmt===DM)n6(t,e.state1,!0),n6(t,e.state2,!1);else if(e.stmt===i6&&(e.id==="[*]"?(e.id=r?t.id+"_start":t.id+"_end",e.start=r):e.id=e.id.trim()),e.doc){let n=[],i=[],a;for(a=0;a0&&i.length>0){let s={stmt:i6,id:oA(),type:"divider",doc:e6(i)};n.push(e6(s)),e.doc=n}e.doc.forEach(s=>n6(e,s,!0))}},"docTranslator"),zM=v(()=>(n6({id:"root"},{id:"root",doc:s6},!0),{id:"root",doc:s6}),"getRootDocV2"),Nze=v(t=>{let e;t.doc?e=t.doc:e=t,re.info(e),whe(!0),re.info("Extract initial document:",e),e.forEach(a=>{switch(re.warn("Statement",a.stmt),a.stmt){case i6:df(a.id.trim(),a.type,a.doc,a.description,a.note,a.classes,a.styles,a.textStyles);break;case DM:Che(a.state1,a.state2,a.description);break;case rze:Ahe(a.id.trim(),a.classes);break;case nze:{let s=a.id.trim().split(","),o=a.styleClass.split(",");s.forEach(l=>{let u=k0(l);if(u===void 0){let h=l.trim();df(h),u=k0(h)}u.styles=o.map(h=>h.replace(/;/g,"")?.trim())})}break;case ize:$M(a.id.trim(),a.styleClass);break}});let r=khe(),i=pe().look;Eze(),ax(void 0,zM(),r,a6,FM,!0,i,Im),a6.forEach(a=>{if(Array.isArray(a.label)){if(a.description=a.label.slice(1),a.isGroup&&a.description.length>0)throw new Error("Group nodes can only have label. Remove the additional description for node ["+a.id+"]");a.label=a.label[0]}})},"extract"),df=v(function(t,e=ox,r=null,n=null,i=null,a=null,s=null,o=null){let l=t?.trim();if(Ps.states.has(l)?(Ps.states.get(l).doc||(Ps.states.get(l).doc=r),Ps.states.get(l).type||(Ps.states.get(l).type=e)):(re.info("Adding state ",l,n),Ps.states.set(l,{id:l,descriptions:[],type:e,doc:r,note:i,classes:[],styles:[],textStyles:[]})),n&&(re.info("Setting state description",l,n),typeof n=="string"&&MM(l,n.trim()),typeof n=="object"&&n.forEach(u=>MM(l,u.trim()))),i){let u=Ps.states.get(l);u.note=i,u.note.text=Xe.sanitizeText(u.note.text,pe())}a&&(re.info("Setting state classes",l,a),(typeof a=="string"?[a]:a).forEach(h=>$M(l,h.trim()))),s&&(re.info("Setting state styles",l,s),(typeof s=="string"?[s]:s).forEach(h=>Bze(l,h.trim()))),o&&(re.info("Setting state styles",l,s),(typeof o=="string"?[o]:o).forEach(h=>Fze(l,h.trim())))},"addState"),whe=v(function(t){a6=[],FM=[],o6={root:bhe()},Ps=o6.root,sx=0,Im=BM(),t||xr()},"clear"),k0=v(function(t){return Ps.states.get(t)},"getState"),khe=v(function(){return Ps.states},"getStates"),Ize=v(function(){re.info("Documents = ",o6)},"logDocuments"),Mze=v(function(){return Ps.relations},"getRelations");v(l6,"startIdIfNeeded");v(c6,"startTypeIfNeeded");v(The,"endIdIfNeeded");v(Ehe,"endTypeIfNeeded");v(She,"addRelationObjs");Che=v(function(t,e,r){if(typeof t=="object")She(t,e,r);else{let n=l6(t.trim()),i=c6(t),a=The(e.trim()),s=Ehe(e);df(n,i),df(a,s),Ps.relations.push({id1:n,id2:a,title:Xe.sanitizeText(r,pe())})}},"addRelation"),MM=v(function(t,e){let r=Ps.states.get(t),n=e.startsWith(":")?e.replace(":","").trim():e;r.descriptions.push(Xe.sanitizeText(n,pe()))},"addDescription"),Dze=v(function(t){return t.substring(0,1)===":"?t.substr(2).trim():t.trim()},"cleanupLabel"),Oze=v(()=>(the++,"divider-id-"+the),"getDividerId"),Ahe=v(function(t,e=""){Im.has(t)||Im.set(t,{id:t,styles:[],textStyles:[]});let r=Im.get(t);e?.split(Cze).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Jue).exec(n)){let s=i.replace(ehe,Sze).replace(Jue,ehe);r.textStyles.push(s)}r.styles.push(i)})},"addStyleClass"),Pze=v(function(){return Im},"getClasses"),$M=v(function(t,e){t.split(",").forEach(function(r){let n=k0(r);if(n===void 0){let i=r.trim();df(i),n=k0(i)}n.classes.push(e)})},"setCssClass"),Bze=v(function(t,e){let r=k0(t);r!==void 0&&r.styles.push(e)},"setStyle"),Fze=v(function(t,e){let r=k0(t);r!==void 0&&r.textStyles.push(e)},"setTextStyle"),zze=v(()=>xhe,"getDirection"),$ze=v(t=>{xhe=t},"setDirection"),Gze=v(t=>t&&t[0]===":"?t.substr(1).trim():t.trim(),"trimColon"),Uze=v(()=>{let t=pe();return{nodes:a6,edges:FM,other:{},config:t,direction:fhe(zM())}},"getData"),Dl={getConfig:v(()=>pe().state,"getConfig"),getData:Uze,addState:df,clear:whe,getState:k0,getStates:khe,getRelations:Mze,getClasses:Pze,getDirection:zze,addRelation:Che,getDividerId:Oze,setDirection:$ze,cleanupLabel:Dze,lineType:Aze,relationType:_ze,logDocuments:Ize,getRootDoc:Rze,setRootDoc:Lze,getRootDocV2:zM,extract:Nze,trimColon:Gze,getAccTitle:_r,setAccTitle:Tr,getAccDescription:Rr,setAccDescription:Lr,addStyleClass:Ahe,setCssClass:$M,addDescription:MM,setDiagramTitle:tn,getDiagramTitle:qr},Vze=v(t=>` defs #statediagram-barbEnd { fill: ${t.transitionColor}; stroke: ${t.transitionColor}; } g.stateGroup text { fill: ${t.nodeBorder}; stroke: none; font-size: 10px; } g.stateGroup text { fill: ${t.textColor}; stroke: none; font-size: 10px; } g.stateGroup .state-title { font-weight: bolder; fill: ${t.stateLabelColor}; } g.stateGroup rect { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; } g.stateGroup line { stroke: ${t.lineColor}; stroke-width: 1; } .transition { stroke: ${t.transitionColor}; stroke-width: 1; fill: none; } .stateGroup .composit { fill: ${t.background}; border-bottom: 1px } .stateGroup .alt-composit { fill: #e0e0e0; border-bottom: 1px } .state-note { stroke: ${t.noteBorderColor}; fill: ${t.noteBkgColor}; text { fill: ${t.noteTextColor}; stroke: none; font-size: 10px; } } .stateLabel .box { stroke: none; stroke-width: 0; fill: ${t.mainBkg}; opacity: 0.5; } .edgeLabel .label rect { fill: ${t.labelBackgroundColor}; opacity: 0.5; } .edgeLabel { background-color: ${t.edgeLabelBackground}; p { background-color: ${t.edgeLabelBackground}; } rect { opacity: 0.5; background-color: ${t.edgeLabelBackground}; fill: ${t.edgeLabelBackground}; } text-align: center; } .edgeLabel .label text { fill: ${t.transitionLabelColor||t.tertiaryTextColor}; } .label div .edgeLabel { color: ${t.transitionLabelColor||t.tertiaryTextColor}; } .stateLabel text { fill: ${t.stateLabelColor}; font-size: 10px; font-weight: bold; } .node circle.state-start { fill: ${t.specialStateColor}; stroke: ${t.specialStateColor}; } .node .fork-join { fill: ${t.specialStateColor}; stroke: ${t.specialStateColor}; } .node circle.state-end { fill: ${t.innerEndBackground}; stroke: ${t.background}; stroke-width: 1.5 } .end-state-inner { fill: ${t.compositeBackground||t.background}; // stroke: ${t.background}; stroke-width: 1.5 } .node rect { fill: ${t.stateBkg||t.mainBkg}; stroke: ${t.stateBorder||t.nodeBorder}; stroke-width: 1px; } .node polygon { fill: ${t.mainBkg}; stroke: ${t.stateBorder||t.nodeBorder};; stroke-width: 1px; } #statediagram-barbEnd { fill: ${t.lineColor}; } .statediagram-cluster rect { fill: ${t.compositeTitleBackground}; stroke: ${t.stateBorder||t.nodeBorder}; stroke-width: 1px; } .cluster-label, .nodeLabel { color: ${t.stateLabelColor}; // line-height: 1; } .statediagram-cluster rect.outer { rx: 5px; ry: 5px; } .statediagram-state .divider { stroke: ${t.stateBorder||t.nodeBorder}; } .statediagram-state .title-state { rx: 5px; ry: 5px; } .statediagram-cluster.statediagram-cluster .inner { fill: ${t.compositeBackground||t.background}; } .statediagram-cluster.statediagram-cluster-alt .inner { fill: ${t.altBackground?t.altBackground:"#efefef"}; } .statediagram-cluster .inner { rx:0; ry:0; } .statediagram-state rect.basic { rx: 5px; ry: 5px; } .statediagram-state rect.divider { stroke-dasharray: 10,10; fill: ${t.altBackground?t.altBackground:"#efefef"}; } .note-edge { stroke-dasharray: 5; } .statediagram-note rect { fill: ${t.noteBkgColor}; stroke: ${t.noteBorderColor}; stroke-width: 1px; rx: 0; ry: 0; } .statediagram-note rect { fill: ${t.noteBkgColor}; stroke: ${t.noteBorderColor}; stroke-width: 1px; rx: 0; ry: 0; } .statediagram-note text { fill: ${t.noteTextColor}; } .statediagram-note .nodeLabel { color: ${t.noteTextColor}; } .statediagram .edgeLabel { color: red; // ${t.noteTextColor}; } #dependencyStart, #dependencyEnd { fill: ${t.lineColor}; stroke: ${t.lineColor}; stroke-width: 1; } .statediagramTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } `,"getStyles"),h6=Vze});var Ihe={};vr(Ihe,{diagram:()=>c$e});var VM,Wze,Hze,Rhe,qze,Yze,Xze,jze,Kze,Zze,Qze,Jze,e$e,t$e,r$e,_he,Lhe,n$e,lo,UM,i$e,a$e,s$e,o$e,Nhe,l$e,c$e,Mhe=F(()=>{GM();Kh();Nu();_u();yl();sl();pc();bo();Ya();kn();or();lr();uy();As();lr();VM={},Wze=v((t,e)=>{VM[t]=e},"set"),Hze=v(t=>VM[t],"get"),Rhe=v(()=>Object.keys(VM),"keys"),qze=v(()=>Rhe().length,"size"),Yze={get:Hze,set:Wze,keys:Rhe,size:qze},Xze=v(t=>t.append("circle").attr("class","start-state").attr("r",pe().state.sizeUnit).attr("cx",pe().state.padding+pe().state.sizeUnit).attr("cy",pe().state.padding+pe().state.sizeUnit),"drawStartState"),jze=v(t=>t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",pe().state.textHeight).attr("class","divider").attr("x2",pe().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Kze=v((t,e)=>{let r=t.append("text").attr("x",2*pe().state.padding).attr("y",pe().state.textHeight+2*pe().state.padding).attr("font-size",pe().state.fontSize).attr("class","state-title").text(e.id),n=r.node().getBBox();return t.insert("rect",":first-child").attr("x",pe().state.padding).attr("y",pe().state.padding).attr("width",n.width+2*pe().state.padding).attr("height",n.height+2*pe().state.padding).attr("rx",pe().state.radius),r},"drawSimpleState"),Zze=v((t,e)=>{let r=v(function(d,p,g){let m=d.append("tspan").attr("x",2*pe().state.padding).text(p);g||m.attr("dy",pe().state.textHeight)},"addTspan"),i=t.append("text").attr("x",2*pe().state.padding).attr("y",pe().state.textHeight+1.3*pe().state.padding).attr("font-size",pe().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),a=i.height,s=t.append("text").attr("x",pe().state.padding).attr("y",a+pe().state.padding*.4+pe().state.dividerMargin+pe().state.textHeight).attr("class","state-description"),o=!0,l=!0;e.descriptions.forEach(function(d){o||(r(s,d,l),l=!1),o=!1});let u=t.append("line").attr("x1",pe().state.padding).attr("y1",pe().state.padding+a+pe().state.dividerMargin/2).attr("y2",pe().state.padding+a+pe().state.dividerMargin/2).attr("class","descr-divider"),h=s.node().getBBox(),f=Math.max(h.width,i.width);return u.attr("x2",f+3*pe().state.padding),t.insert("rect",":first-child").attr("x",pe().state.padding).attr("y",pe().state.padding).attr("width",f+2*pe().state.padding).attr("height",h.height+a+2*pe().state.padding).attr("rx",pe().state.radius),t},"drawDescrState"),Qze=v((t,e,r)=>{let n=pe().state.padding,i=2*pe().state.padding,a=t.node().getBBox(),s=a.width,o=a.x,l=t.append("text").attr("x",0).attr("y",pe().state.titleShift).attr("font-size",pe().state.fontSize).attr("class","state-title").text(e.id),h=l.node().getBBox().width+i,f=Math.max(h,s);f===s&&(f=f+i);let d,p=t.node().getBBox();e.doc,d=o-n,h>s&&(d=(s-f)/2+n),Math.abs(o-p.x)s&&(d=o-(h-s)/2);let g=1-pe().state.textHeight;return t.insert("rect",":first-child").attr("x",d).attr("y",g).attr("class",r?"alt-composit":"composit").attr("width",f).attr("height",p.height+pe().state.textHeight+pe().state.titleShift+1).attr("rx","0"),l.attr("x",d+n),h<=s&&l.attr("x",o+(f-i)/2-h/2+n),t.insert("rect",":first-child").attr("x",d).attr("y",pe().state.titleShift-pe().state.textHeight-pe().state.padding).attr("width",f).attr("height",pe().state.textHeight*3).attr("rx",pe().state.radius),t.insert("rect",":first-child").attr("x",d).attr("y",pe().state.titleShift-pe().state.textHeight-pe().state.padding).attr("width",f).attr("height",p.height+3+2*pe().state.textHeight).attr("rx",pe().state.radius),t},"addTitleAndBox"),Jze=v(t=>(t.append("circle").attr("class","end-state-outer").attr("r",pe().state.sizeUnit+pe().state.miniPadding).attr("cx",pe().state.padding+pe().state.sizeUnit+pe().state.miniPadding).attr("cy",pe().state.padding+pe().state.sizeUnit+pe().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",pe().state.sizeUnit).attr("cx",pe().state.padding+pe().state.sizeUnit+2).attr("cy",pe().state.padding+pe().state.sizeUnit+2)),"drawEndState"),e$e=v((t,e)=>{let r=pe().state.forkWidth,n=pe().state.forkHeight;if(e.parentId){let i=r;r=n,n=i}return t.append("rect").style("stroke","black").style("fill","black").attr("width",r).attr("height",n).attr("x",pe().state.padding).attr("y",pe().state.padding)},"drawForkJoinState"),t$e=v((t,e,r,n)=>{let i=0,a=n.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=t.replace(/\r\n/g,"
    ");s=s.replace(/\n/g,"
    ");let o=s.split(Xe.lineBreakRegex),l=1.25*pe().state.noteMargin;for(let u of o){let h=u.trim();if(h.length>0){let f=a.append("tspan");if(f.text(h),l===0){let d=f.node().getBBox();l+=d.height}i+=l,f.attr("x",e+pe().state.noteMargin),f.attr("y",r+i+1.25*pe().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:i}},"_drawLongText"),r$e=v((t,e)=>{e.attr("class","state-note");let r=e.append("rect").attr("x",0).attr("y",pe().state.padding),n=e.append("g"),{textWidth:i,textHeight:a}=t$e(t,0,0,n);return r.attr("height",a+2*pe().state.noteMargin),r.attr("width",i+pe().state.noteMargin*2),r},"drawNote"),_he=v(function(t,e){let r=e.id,n={id:r,label:e.id,width:0,height:0},i=t.append("g").attr("id",r).attr("class","stateGroup");e.type==="start"&&Xze(i),e.type==="end"&&Jze(i),(e.type==="fork"||e.type==="join")&&e$e(i,e),e.type==="note"&&r$e(e.note.text,i),e.type==="divider"&&jze(i),e.type==="default"&&e.descriptions.length===0&&Kze(i,e),e.type==="default"&&e.descriptions.length>0&&Zze(i,e);let a=i.node().getBBox();return n.width=a.width+2*pe().state.padding,n.height=a.height+2*pe().state.padding,Yze.set(r,n),n},"drawState"),Lhe=0,n$e=v(function(t,e,r){let n=v(function(l){switch(l){case Dl.relationType.AGGREGATION:return"aggregation";case Dl.relationType.EXTENSION:return"extension";case Dl.relationType.COMPOSITION:return"composition";case Dl.relationType.DEPENDENCY:return"dependency"}},"getRelationType");e.points=e.points.filter(l=>!Number.isNaN(l.y));let i=e.points,a=ms().x(function(l){return l.x}).y(function(l){return l.y}).curve(gl),s=t.append("path").attr("d",a(i)).attr("id","edge"+Lhe).attr("class","transition"),o="";if(pe().state.arrowMarkerAbsolute&&(o=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,o=o.replace(/\(/g,"\\("),o=o.replace(/\)/g,"\\)")),s.attr("marker-end","url("+o+"#"+n(Dl.relationType.DEPENDENCY)+"End)"),r.title!==void 0){let l=t.append("g").attr("class","stateLabel"),{x:u,y:h}=Ut.calcLabelPosition(e.points),f=Xe.getRows(r.title),d=0,p=[],g=0,m=0;for(let b=0;b<=f.length;b++){let w=l.append("text").attr("text-anchor","middle").text(f[b]).attr("x",u).attr("y",h+d),_=w.node().getBBox();g=Math.max(g,_.width),m=Math.min(m,_.x),re.info(_.x,u,h+d),d===0&&(d=w.node().getBBox().height,re.info("Title height",d,h)),p.push(w)}let y=d*f.length;if(f.length>1){let b=(f.length-1)*d*.5;p.forEach((w,_)=>w.attr("y",h+_*d-b)),y=d*f.length}let x=l.node().getBBox();l.insert("rect",":first-child").attr("class","box").attr("x",u-g/2-pe().state.padding/2).attr("y",h-y/2-pe().state.padding/2-3.5).attr("width",g+pe().state.padding).attr("height",y+pe().state.padding),re.info(x)}Lhe++},"drawEdge"),UM={},i$e=v(function(){},"setConf"),a$e=v(function(t){t.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),s$e=v(function(t,e,r,n){lo=pe().state;let i=pe().securityLevel,a;i==="sandbox"&&(a=Ve("#i"+e));let s=i==="sandbox"?Ve(a.nodes()[0].contentDocument.body):Ve("body"),o=i==="sandbox"?a.nodes()[0].contentDocument:document;re.debug("Rendering diagram "+t);let l=s.select(`[id='${e}']`);a$e(l);let u=n.db.getRootDoc();Nhe(u,l,void 0,!1,s,o,n);let h=lo.padding,f=l.node().getBBox(),d=f.width+h*2,p=f.height+h*2,g=d*1.75;Hr(l,p,g,lo.useMaxWidth),l.attr("viewBox",`${f.x-lo.padding} ${f.y-lo.padding} `+d+" "+p)},"draw"),o$e=v(t=>t?t.length*lo.fontSizeFactor:1,"getLabelWidth"),Nhe=v((t,e,r,n,i,a,s)=>{let o=new Sr({compound:!0,multigraph:!0}),l,u=!0;for(l=0;l{let k=_.parentElement,E=0,L=0;k&&(k.parentElement&&(E=k.parentElement.getBBox().width),L=parseInt(k.getAttribute("data-x-shift"),10),Number.isNaN(L)&&(L=0)),_.setAttribute("x1",0-L+8),_.setAttribute("x2",E-L-8)})):re.debug("No Node "+b+": "+JSON.stringify(o.node(b)))});let y=m.getBBox();o.edges().forEach(function(b){b!==void 0&&o.edge(b)!==void 0&&(re.debug("Edge "+b.v+" -> "+b.w+": "+JSON.stringify(o.edge(b))),n$e(e,o.edge(b),o.edge(b).relation))}),y=m.getBBox();let x={id:r||"root",label:r||"root",width:0,height:0};return x.width=y.width+2*lo.padding,x.height=y.height+2*lo.padding,re.debug("Doc rendered",x,o),x},"renderDoc"),l$e={setConf:i$e,draw:s$e},c$e={parser:u6,db:Dl,renderer:l$e,styles:h6,init:v(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Dl.clear()},"init")}});var Dhe={};vr(Dhe,{diagram:()=>u$e});var u$e,Ohe=F(()=>{GM();Kh();Nu();_u();yl();sl();pc();bo();Ya();kn();or();u$e={parser:u6,db:Dl,renderer:dhe,styles:h6,init:v(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute,Dl.clear()},"init")}});var Hhe={};vr(Hhe,{diagram:()=>N$e});function Whe(t){let e=pe().journey,r=60;Object.keys(Ku).forEach(n=>{let i=Ku[n].color,a={cx:20,cy:r,r:7,fill:i,stroke:"#000",pos:Ku[n].position};hx.drawCircle(t,a);let s={x:40,y:r+7,fill:"#666",text:n,textMargin:e.boxTextMargin|5};hx.drawText(t,s),r+=20})}var HM,h$e,Mm,qM,cx,ux,f$e,d$e,p$e,g$e,m$e,v$e,y$e,Phe,x$e,Bhe,b$e,w$e,YM,k$e,Ghe,Uhe,T$e,E$e,Fhe,S$e,C$e,Vhe,A$e,hx,_$e,Ku,f6,T0,L$e,jo,WM,zhe,R$e,$he,N$e,qhe=F(()=>{Rw();or();lr();lr();HM=function(){var t=v(function(f,d,p,g){for(p=p||{},g=f.length;g--;p[f[g]]=d);return p},"o"),e=[6,8,10,11,12,14,16,17,18],r=[1,9],n=[1,10],i=[1,11],a=[1,12],s=[1,13],o=[1,14],l={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:v(function(d,p,g,m,y,x,b){var w=x.length-1;switch(y){case 1:return x[w-1];case 2:this.$=[];break;case 3:x[w-1].push(x[w]),this.$=x[w-1];break;case 4:case 5:this.$=x[w];break;case 6:case 7:this.$=[];break;case 8:m.setDiagramTitle(x[w].substr(6)),this.$=x[w].substr(6);break;case 9:this.$=x[w].trim(),m.setAccTitle(this.$);break;case 10:case 11:this.$=x[w].trim(),m.setAccDescription(this.$);break;case 12:m.addSection(x[w].substr(8)),this.$=x[w].substr(8);break;case 13:m.addTask(x[w-1],x[w]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:n,14:i,16:a,17:s,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:r,12:n,14:i,16:a,17:s,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:v(function(d,p){if(p.recoverable)this.trace(d);else{var g=new Error(d);throw g.hash=p,g}},"parseError"),parse:v(function(d){var p=this,g=[0],m=[],y=[null],x=[],b=this.table,w="",_=0,k=0,E=0,L=2,S=1,C=x.slice.call(arguments,1),M=Object.create(this.lexer),R={yy:{}};for(var T in this.yy)Object.prototype.hasOwnProperty.call(this.yy,T)&&(R.yy[T]=this.yy[T]);M.setInput(d,R.yy),R.yy.lexer=M,R.yy.parser=this,typeof M.yylloc>"u"&&(M.yylloc={});var I=M.yylloc;x.push(I);var A=M.options&&M.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function D(W){g.length=g.length-2*W,y.length=y.length-W,x.length=x.length-W}v(D,"popStack");function N(){var W;return W=m.pop()||M.lex()||S,typeof W!="number"&&(W instanceof Array&&(m=W,W=m.pop()),W=p.symbols_[W]||W),W}v(N,"lex");for(var O,B,P,$,z,H,J={},X,oe,K,ee;;){if(P=g[g.length-1],this.defaultActions[P]?$=this.defaultActions[P]:((O===null||typeof O>"u")&&(O=N()),$=b[P]&&b[P][O]),typeof $>"u"||!$.length||!$[0]){var Q="";ee=[];for(X in b[P])this.terminals_[X]&&X>L&&ee.push("'"+this.terminals_[X]+"'");M.showPosition?Q="Parse error on line "+(_+1)+`: `+M.showPosition()+` Expecting `+ee.join(", ")+", got '"+(this.terminals_[O]||O)+"'":Q="Parse error on line "+(_+1)+": Unexpected "+(O==S?"end of input":"'"+(this.terminals_[O]||O)+"'"),this.parseError(Q,{text:M.match,token:this.terminals_[O]||O,line:M.yylineno,loc:I,expected:ee})}if($[0]instanceof Array&&$.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+O);switch($[0]){case 1:g.push(O),y.push(M.yytext),x.push(M.yylloc),g.push($[1]),O=null,B?(O=B,B=null):(k=M.yyleng,w=M.yytext,_=M.yylineno,I=M.yylloc,E>0&&E--);break;case 2:if(oe=this.productions_[$[1]][1],J.$=y[y.length-oe],J._$={first_line:x[x.length-(oe||1)].first_line,last_line:x[x.length-1].last_line,first_column:x[x.length-(oe||1)].first_column,last_column:x[x.length-1].last_column},A&&(J._$.range=[x[x.length-(oe||1)].range[0],x[x.length-1].range[1]]),H=this.performAction.apply(J,[w,k,_,R.yy,$[1],y,x].concat(C)),typeof H<"u")return H;oe&&(g=g.slice(0,-1*oe*2),y=y.slice(0,-1*oe),x=x.slice(0,-1*oe)),g.push(this.productions_[$[1]][0]),y.push(J.$),x.push(J._$),K=b[g[g.length-2]][g[g.length-1]],g.push(K);break;case 3:return!0}}return!0},"parse")},u=function(){var f={EOF:1,parseError:v(function(p,g){if(this.yy.parser)this.yy.parser.parseError(p,g);else throw new Error(p)},"parseError"),setInput:v(function(d,p){return this.yy=p||this.yy||{},this._input=d,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var d=this._input[0];this.yytext+=d,this.yyleng++,this.offset++,this.match+=d,this.matched+=d;var p=d.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),d},"input"),unput:v(function(d){var p=d.length,g=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var y=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===m.length?this.yylloc.first_column:0)+m[m.length-g.length].length-g[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(d){this.unput(this.match.slice(d))},"less"),pastInput:v(function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var d=this.match;return d.length<20&&(d+=this._input.substr(0,20-d.length)),(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var d=this.pastInput(),p=new Array(d.length+1).join("-");return d+this.upcomingInput()+` `+p+"^"},"showPosition"),test_match:v(function(d,p){var g,m,y;if(this.options.backtrack_lexer&&(y={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(y.yylloc.range=this.yylloc.range.slice(0))),m=d[0].match(/(?:\r\n?|\n).*/g),m&&(this.yylineno+=m.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:m?m[m.length-1].length-m[m.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(d[0].length),this.matched+=d[0],g=this.performAction.call(this,this.yy,this,p,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var x in y)this[x]=y[x];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var d,p,g,m;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),x=0;xp[0].length)){if(p=g,m=x,this.options.backtrack_lexer){if(d=this.test_match(g,y[x]),d!==!1)return d;if(this._backtrack){p=!1;continue}else return!1}else if(!this.options.flex)break}return p?(d=this.test_match(p,y[m]),d!==!1?d:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var p=this.next();return p||this.lex()},"lex"),begin:v(function(p){this.conditionStack.push(p)},"begin"),popState:v(function(){var p=this.conditionStack.length-1;return p>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(p){return p=this.conditionStack.length-1-Math.abs(p||0),p>=0?this.conditionStack[p]:"INITIAL"},"topState"),pushState:v(function(p){this.begin(p)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(p,g,m,y){var x=y;switch(m){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return f}();l.lexer=u;function h(){this.yy={}}return v(h,"Parser"),h.prototype=l,l.Parser=h,new h}();HM.parser=HM;h$e=HM,Mm="",qM=[],cx=[],ux=[],f$e=v(function(){qM.length=0,cx.length=0,Mm="",ux.length=0,xr()},"clear"),d$e=v(function(t){Mm=t,qM.push(t)},"addSection"),p$e=v(function(){return qM},"getSections"),g$e=v(function(){let t=Phe(),e=100,r=0;for(;!t&&r{r.people&&t.push(...r.people)}),[...new Set(t)].sort()},"updateActors"),v$e=v(function(t,e){let r=e.substr(1).split(":"),n=0,i=[];r.length===1?(n=Number(r[0]),i=[]):(n=Number(r[0]),i=r[1].split(","));let a=i.map(o=>o.trim()),s={section:Mm,type:Mm,people:a,task:t,score:n};ux.push(s)},"addTask"),y$e=v(function(t){let e={section:Mm,type:Mm,description:t,task:t,classes:[]};cx.push(e)},"addTaskOrg"),Phe=v(function(){let t=v(function(r){return ux[r].processed},"compileTask"),e=!0;for(let[r,n]of ux.entries())t(r),e=e&&n.processed;return e},"compileTasks"),x$e=v(function(){return m$e()},"getActors"),Bhe={getConfig:v(()=>pe().journey,"getConfig"),clear:f$e,setDiagramTitle:tn,getDiagramTitle:qr,setAccTitle:Tr,getAccTitle:_r,setAccDescription:Lr,getAccDescription:Rr,addSection:d$e,getSections:p$e,getTasks:g$e,addTask:v$e,addTaskOrg:y$e,getActors:x$e},b$e=v(t=>`.label { font-family: 'trebuchet ms', verdana, arial, sans-serif; font-family: var(--mermaid-font-family); color: ${t.textColor}; } .mouth { stroke: #666; } line { stroke: ${t.textColor} } .legend { fill: ${t.textColor}; } .label text { fill: #333; } .label { color: ${t.textColor} } .face { ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"}; stroke: #999; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: 1px; } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${t.arrowheadColor}; } .edgePath .path { stroke: ${t.lineColor}; stroke-width: 1.5px; } .flowchart-link { stroke: ${t.lineColor}; fill: none; } .edgeLabel { background-color: ${t.edgeLabelBackground}; rect { opacity: 0.5; } text-align: center; } .cluster rect { } .cluster text { fill: ${t.titleColor}; } div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: 'trebuchet ms', verdana, arial, sans-serif; font-family: var(--mermaid-font-family); font-size: 12px; background: ${t.tertiaryColor}; border: 1px solid ${t.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .task-type-0, .section-type-0 { ${t.fillType0?`fill: ${t.fillType0}`:""}; } .task-type-1, .section-type-1 { ${t.fillType0?`fill: ${t.fillType1}`:""}; } .task-type-2, .section-type-2 { ${t.fillType0?`fill: ${t.fillType2}`:""}; } .task-type-3, .section-type-3 { ${t.fillType0?`fill: ${t.fillType3}`:""}; } .task-type-4, .section-type-4 { ${t.fillType0?`fill: ${t.fillType4}`:""}; } .task-type-5, .section-type-5 { ${t.fillType0?`fill: ${t.fillType5}`:""}; } .task-type-6, .section-type-6 { ${t.fillType0?`fill: ${t.fillType6}`:""}; } .task-type-7, .section-type-7 { ${t.fillType0?`fill: ${t.fillType7}`:""}; } .actor-0 { ${t.actor0?`fill: ${t.actor0}`:""}; } .actor-1 { ${t.actor1?`fill: ${t.actor1}`:""}; } .actor-2 { ${t.actor2?`fill: ${t.actor2}`:""}; } .actor-3 { ${t.actor3?`fill: ${t.actor3}`:""}; } .actor-4 { ${t.actor4?`fill: ${t.actor4}`:""}; } .actor-5 { ${t.actor5?`fill: ${t.actor5}`:""}; } `,"getStyles"),w$e=b$e,YM=v(function(t,e){return Dd(t,e)},"drawRect"),k$e=v(function(t,e){let n=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=t.append("g");i.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=lc().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}v(a,"smile");function s(l){let u=lc().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}v(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return v(o,"ambivalent"),e.score>3?a(i):e.score<3?s(i):o(i),n},"drawFace"),Ghe=v(function(t,e){let r=t.append("circle");return r.attr("cx",e.cx),r.attr("cy",e.cy),r.attr("class","actor-"+e.pos),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("r",e.r),r.class!==void 0&&r.attr("class",r.class),e.title!==void 0&&r.append("title").text(e.title),r},"drawCircle"),Uhe=v(function(t,e){return ene(t,e)},"drawText"),T$e=v(function(t,e){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}v(r,"genPoints");let n=t.append("polygon");n.attr("points",r(e.x,e.y,50,20,7)),n.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,Uhe(t,e)},"drawLabel"),E$e=v(function(t,e,r){let n=t.append("g"),i=Tc();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=r.width*e.taskCount+r.diagramMarginX*(e.taskCount-1),i.height=r.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,YM(n,i),Vhe(r)(e.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},r,e.colour)},"drawSection"),Fhe=-1,S$e=v(function(t,e,r){let n=e.x+r.width/2,i=t.append("g");Fhe++;let a=300+5*30;i.append("line").attr("id","task"+Fhe).attr("x1",n).attr("y1",e.y).attr("x2",n).attr("y2",a).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),k$e(i,{cx:n,cy:300+(5-e.score)*30,score:e.score});let s=Tc();s.x=e.x,s.y=e.y,s.fill=e.fill,s.width=r.width,s.height=r.height,s.class="task task-type-"+e.num,s.rx=3,s.ry=3,YM(i,s);let o=e.x+14;e.people.forEach(l=>{let u=e.actors[l].color,h={cx:o,cy:e.y,r:7,fill:u,stroke:"#000",title:l,pos:e.actors[l].position};Ghe(i,h),o+=10}),Vhe(r)(e.task,i,s.x,s.y,s.width,s.height,{class:"task"},r,e.colour)},"drawTask"),C$e=v(function(t,e){_w(t,e)},"drawBackgroundRect"),Vhe=function(){function t(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}v(t,"byText");function e(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:g}=f,m=i.split(//gi);for(let y=0;y{Ku[x]={color:i.actorColours[d%i.actorColours.length],position:d},d++}),Whe(l),jo.insert(0,0,T0,Object.keys(Ku).length*50),R$e(l,u,0);let p=jo.getBounds();h&&l.append("text").text(h).attr("x",T0).attr("font-size","4ex").attr("font-weight","bold").attr("y",25);let g=p.stopy-p.starty+2*i.diagramMarginY,m=T0+p.stopx+2*i.diagramMarginX;Hr(l,g,m,i.useMaxWidth),l.append("line").attr("x1",T0).attr("y1",i.height*4).attr("x2",m-T0-4).attr("y2",i.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)");let y=h?70:0;l.attr("viewBox",`${p.startx} -25 ${m} ${g+y}`),l.attr("preserveAspectRatio","xMinYMin meet"),l.attr("height",g+y+25)},"draw"),jo={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:v(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:v(function(t,e,r,n){t[e]===void 0?t[e]=r:t[e]=n(r,t[e])},"updateVal"),updateBounds:v(function(t,e,r,n){let i=pe().journey,a=this,s=0;function o(l){return v(function(h){s++;let f=a.sequenceItems.length-s+1;a.updateVal(h,"starty",e-f*i.boxMargin,Math.min),a.updateVal(h,"stopy",n+f*i.boxMargin,Math.max),a.updateVal(jo.data,"startx",t-f*i.boxMargin,Math.min),a.updateVal(jo.data,"stopx",r+f*i.boxMargin,Math.max),l!=="activation"&&(a.updateVal(h,"startx",t-f*i.boxMargin,Math.min),a.updateVal(h,"stopx",r+f*i.boxMargin,Math.max),a.updateVal(jo.data,"starty",e-f*i.boxMargin,Math.min),a.updateVal(jo.data,"stopy",n+f*i.boxMargin,Math.max))},"updateItemBounds")}v(o,"updateFn"),this.sequenceItems.forEach(o())},"updateBounds"),insert:v(function(t,e,r,n){let i=Math.min(t,r),a=Math.max(t,r),s=Math.min(e,n),o=Math.max(e,n);this.updateVal(jo.data,"startx",i,Math.min),this.updateVal(jo.data,"starty",s,Math.min),this.updateVal(jo.data,"stopx",a,Math.max),this.updateVal(jo.data,"stopy",o,Math.max),this.updateBounds(i,s,a,o)},"insert"),bumpVerticalPos:v(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:v(function(){return this.verticalPos},"getVerticalPos"),getBounds:v(function(){return this.data},"getBounds")},WM=f6.sectionFills,zhe=f6.sectionColours,R$e=v(function(t,e,r){let n=pe().journey,i="",a=n.height*2+n.diagramMarginY,s=r+a,o=0,l="#CCC",u="black",h=0;for(let[f,d]of e.entries()){if(i!==d.section){l=WM[o%WM.length],h=o%WM.length,u=zhe[o%zhe.length];let g=0,m=d.section;for(let x=f;x(Ku[m]&&(g[m]=Ku[m]),g),{});d.x=f*n.taskMargin+f*n.width+T0,d.y=s,d.width=n.diagramMarginX,d.height=n.diagramMarginY,d.colour=u,d.fill=l,d.num=h,d.actors=p,hx.drawTask(t,d,n),jo.insert(d.x,d.y,d.x+d.width+n.taskMargin,300+5*30)}},"drawTasks"),$he={setConf:_$e,draw:L$e},N$e={parser:h$e,db:Bhe,renderer:$he,styles:w$e,init:v(t=>{$he.setConf(t.journey),Bhe.clear()},"init")}});var lfe={};vr(lfe,{diagram:()=>Q$e});function ZM(t,e){t.each(function(){var r=Ve(this),n=r.text().split(/(\s+|
    )/).reverse(),i,a=[],s=1.1,o=r.attr("y"),l=parseFloat(r.attr("dy")),u=r.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",l+"em");for(let h=0;he||i==="
    ")&&(a.pop(),u.text(a.join(" ").trim()),i==="
    "?a=[""]:a=[i],u=r.append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em").text(i))})}var XM,I$e,Khe,Dm,Zhe,jM,d6,Om,Qhe,Jhe,efe,tfe,rfe,nfe,ife,afe,Yhe,M$e,D$e,p6,O$e,P$e,sfe,B$e,F$e,Xhe,z$e,$$e,G$e,KM,ofe,U$e,V$e,W$e,H$e,E0,q$e,jhe,Y$e,X$e,j$e,K$e,Z$e,Q$e,cfe=F(()=>{or();lr();lr();go();XM=function(){var t=v(function(d,p,g,m){for(g=g||{},m=d.length;m--;g[d[m]]=p);return g},"o"),e=[6,8,10,11,12,14,16,17,20,21],r=[1,9],n=[1,10],i=[1,11],a=[1,12],s=[1,13],o=[1,16],l=[1,17],u={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:v(function(p,g,m,y,x,b,w){var _=b.length-1;switch(x){case 1:return b[_-1];case 2:this.$=[];break;case 3:b[_-1].push(b[_]),this.$=b[_-1];break;case 4:case 5:this.$=b[_];break;case 6:case 7:this.$=[];break;case 8:y.getCommonDb().setDiagramTitle(b[_].substr(6)),this.$=b[_].substr(6);break;case 9:this.$=b[_].trim(),y.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=b[_].trim(),y.getCommonDb().setAccDescription(this.$);break;case 12:y.addSection(b[_].substr(8)),this.$=b[_].substr(8);break;case 15:y.addTask(b[_],0,""),this.$=b[_];break;case 16:y.addEvent(b[_].substr(2)),this.$=b[_];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:n,14:i,16:a,17:s,18:14,19:15,20:o,21:l},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:18,11:r,12:n,14:i,16:a,17:s,18:14,19:15,20:o,21:l},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,19]},{15:[1,20]},t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),t(e,[2,4]),t(e,[2,9]),t(e,[2,10])],defaultActions:{},parseError:v(function(p,g){if(g.recoverable)this.trace(p);else{var m=new Error(p);throw m.hash=g,m}},"parseError"),parse:v(function(p){var g=this,m=[0],y=[],x=[null],b=[],w=this.table,_="",k=0,E=0,L=0,S=2,C=1,M=b.slice.call(arguments,1),R=Object.create(this.lexer),T={yy:{}};for(var I in this.yy)Object.prototype.hasOwnProperty.call(this.yy,I)&&(T.yy[I]=this.yy[I]);R.setInput(p,T.yy),T.yy.lexer=R,T.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var A=R.yylloc;b.push(A);var D=R.options&&R.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(Y){m.length=m.length-2*Y,x.length=x.length-Y,b.length=b.length-Y}v(N,"popStack");function O(){var Y;return Y=y.pop()||R.lex()||C,typeof Y!="number"&&(Y instanceof Array&&(y=Y,Y=y.pop()),Y=g.symbols_[Y]||Y),Y}v(O,"lex");for(var B,P,$,z,H,J,X={},oe,K,ee,Q;;){if($=m[m.length-1],this.defaultActions[$]?z=this.defaultActions[$]:((B===null||typeof B>"u")&&(B=O()),z=w[$]&&w[$][B]),typeof z>"u"||!z.length||!z[0]){var W="";Q=[];for(oe in w[$])this.terminals_[oe]&&oe>S&&Q.push("'"+this.terminals_[oe]+"'");R.showPosition?W="Parse error on line "+(k+1)+`: `+R.showPosition()+` Expecting `+Q.join(", ")+", got '"+(this.terminals_[B]||B)+"'":W="Parse error on line "+(k+1)+": Unexpected "+(B==C?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(W,{text:R.match,token:this.terminals_[B]||B,line:R.yylineno,loc:A,expected:Q})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+B);switch(z[0]){case 1:m.push(B),x.push(R.yytext),b.push(R.yylloc),m.push(z[1]),B=null,P?(B=P,P=null):(E=R.yyleng,_=R.yytext,k=R.yylineno,A=R.yylloc,L>0&&L--);break;case 2:if(K=this.productions_[z[1]][1],X.$=x[x.length-K],X._$={first_line:b[b.length-(K||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(K||1)].first_column,last_column:b[b.length-1].last_column},D&&(X._$.range=[b[b.length-(K||1)].range[0],b[b.length-1].range[1]]),J=this.performAction.apply(X,[_,E,k,T.yy,z[1],x,b].concat(M)),typeof J<"u")return J;K&&(m=m.slice(0,-1*K*2),x=x.slice(0,-1*K),b=b.slice(0,-1*K)),m.push(this.productions_[z[1]][0]),x.push(X.$),b.push(X._$),ee=w[m[m.length-2]][m[m.length-1]],m.push(ee);break;case 3:return!0}}return!0},"parse")},h=function(){var d={EOF:1,parseError:v(function(g,m){if(this.yy.parser)this.yy.parser.parseError(g,m);else throw new Error(g)},"parseError"),setInput:v(function(p,g){return this.yy=g||this.yy||{},this._input=p,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var p=this._input[0];this.yytext+=p,this.yyleng++,this.offset++,this.match+=p,this.matched+=p;var g=p.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),p},"input"),unput:v(function(p){var g=p.length,m=p.split(/(?:\r\n?|\n)/g);this._input=p+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),m.length-1&&(this.yylineno-=m.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:m?(m.length===y.length?this.yylloc.first_column:0)+y[y.length-m.length].length-m[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(p){this.unput(this.match.slice(p))},"less"),pastInput:v(function(){var p=this.matched.substr(0,this.matched.length-this.match.length);return(p.length>20?"...":"")+p.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var p=this.match;return p.length<20&&(p+=this._input.substr(0,20-p.length)),(p.substr(0,20)+(p.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var p=this.pastInput(),g=new Array(p.length+1).join("-");return p+this.upcomingInput()+` `+g+"^"},"showPosition"),test_match:v(function(p,g){var m,y,x;if(this.options.backtrack_lexer&&(x={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(x.yylloc.range=this.yylloc.range.slice(0))),y=p[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+p[0].length},this.yytext+=p[0],this.match+=p[0],this.matches=p,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(p[0].length),this.matched+=p[0],m=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),m)return m;if(this._backtrack){for(var b in x)this[b]=x[b];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var p,g,m,y;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),b=0;bg[0].length)){if(g=m,y=b,this.options.backtrack_lexer){if(p=this.test_match(m,x[b]),p!==!1)return p;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(p=this.test_match(g,x[y]),p!==!1?p:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var g=this.next();return g||this.lex()},"lex"),begin:v(function(g){this.conditionStack.push(g)},"begin"),popState:v(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:v(function(g){this.begin(g)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(g,m,y,x){var b=x;switch(y){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s[^:\n]+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return d}();u.lexer=h;function f(){this.yy={}}return v(f,"Parser"),f.prototype=u,u.Parser=f,new f}();XM.parser=XM;I$e=XM,Khe={};MS(Khe,{addEvent:()=>ife,addSection:()=>efe,addTask:()=>nfe,addTaskOrg:()=>afe,clear:()=>Jhe,default:()=>M$e,getCommonDb:()=>Qhe,getSections:()=>tfe,getTasks:()=>rfe});Dm="",Zhe=0,jM=[],d6=[],Om=[],Qhe=v(()=>Ub,"getCommonDb"),Jhe=v(function(){jM.length=0,d6.length=0,Dm="",Om.length=0,xr()},"clear"),efe=v(function(t){Dm=t,jM.push(t)},"addSection"),tfe=v(function(){return jM},"getSections"),rfe=v(function(){let t=Yhe(),e=100,r=0;for(;!t&&rr.id===Zhe-1).events.push(t)},"addEvent"),afe=v(function(t){let e={section:Dm,type:Dm,description:t,task:t,classes:[]};d6.push(e)},"addTaskOrg"),Yhe=v(function(){let t=v(function(r){return Om[r].processed},"compileTask"),e=!0;for(let[r,n]of Om.entries())t(r),e=e&&n.processed;return e},"compileTasks"),M$e={clear:Jhe,getCommonDb:Qhe,addSection:efe,getSections:tfe,getTasks:rfe,addTask:nfe,addTaskOrg:afe,addEvent:ife},D$e=12,p6=v(function(t,e){let r=t.append("rect");return r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),r.attr("rx",e.rx),r.attr("ry",e.ry),e.class!==void 0&&r.attr("class",e.class),r},"drawRect"),O$e=v(function(t,e){let n=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=t.append("g");i.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(l){let u=lc().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}v(a,"smile");function s(l){let u=lc().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);l.append("path").attr("class","mouth").attr("d",u).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}v(s,"sad");function o(l){l.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return v(o,"ambivalent"),e.score>3?a(i):e.score<3?s(i):o(i),n},"drawFace"),P$e=v(function(t,e){let r=t.append("circle");return r.attr("cx",e.cx),r.attr("cy",e.cy),r.attr("class","actor-"+e.pos),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("r",e.r),r.class!==void 0&&r.attr("class",r.class),e.title!==void 0&&r.append("title").text(e.title),r},"drawCircle"),sfe=v(function(t,e){let r=e.text.replace(//gi," "),n=t.append("text");n.attr("x",e.x),n.attr("y",e.y),n.attr("class","legend"),n.style("text-anchor",e.anchor),e.class!==void 0&&n.attr("class",e.class);let i=n.append("tspan");return i.attr("x",e.x+e.textMargin*2),i.text(r),n},"drawText"),B$e=v(function(t,e){function r(i,a,s,o,l){return i+","+a+" "+(i+s)+","+a+" "+(i+s)+","+(a+o-l)+" "+(i+s-l*1.2)+","+(a+o)+" "+i+","+(a+o)}v(r,"genPoints");let n=t.append("polygon");n.attr("points",r(e.x,e.y,50,20,7)),n.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,sfe(t,e)},"drawLabel"),F$e=v(function(t,e,r){let n=t.append("g"),i=KM();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=r.width,i.height=r.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,p6(n,i),ofe(r)(e.text,n,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},r,e.colour)},"drawSection"),Xhe=-1,z$e=v(function(t,e,r){let n=e.x+r.width/2,i=t.append("g");Xhe++;let a=300+5*30;i.append("line").attr("id","task"+Xhe).attr("x1",n).attr("y1",e.y).attr("x2",n).attr("y2",a).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),O$e(i,{cx:n,cy:300+(5-e.score)*30,score:e.score});let s=KM();s.x=e.x,s.y=e.y,s.fill=e.fill,s.width=r.width,s.height=r.height,s.class="task task-type-"+e.num,s.rx=3,s.ry=3,p6(i,s),ofe(r)(e.task,i,s.x,s.y,s.width,s.height,{class:"task"},r,e.colour)},"drawTask"),$$e=v(function(t,e){p6(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},"drawBackgroundRect"),G$e=v(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),KM=v(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),ofe=function(){function t(i,a,s,o,l,u,h,f){let d=a.append("text").attr("x",s+l/2).attr("y",o+u/2+5).style("font-color",f).style("text-anchor","middle").text(i);n(d,h)}v(t,"byText");function e(i,a,s,o,l,u,h,f,d){let{taskFontSize:p,taskFontFamily:g}=f,m=i.split(//gi);for(let y=0;y0?d.forEach(C=>{let M=h.filter(A=>A.section===C),R={number:w,descr:C,section:w,width:200*Math.max(M.length,1)-50,padding:20,maxHeight:p};re.debug("sectionNode",R);let T=u.append("g"),I=E0.drawNode(T,R,w,i);re.debug("sectionNode output",I),T.attr("transform",`translate(${x}, ${y})`),b+=p+50,M.length>0&&jhe(u,M,w,x,b,g,i,k,E,p,!1),x+=200*Math.max(M.length,1),b=y,w++}):(_=!1,jhe(u,h,w,x,b,g,i,k,E,p,!0));let L=u.node().getBBox();re.debug("bounds",L),f&&u.append("text").text(f).attr("x",L.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),m=_?p+g+150:g+100,u.append("g").attr("class","lineWrapper").append("line").attr("x1",a).attr("y1",m).attr("x2",L.width+3*a).attr("y2",m).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),il(void 0,u,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),jhe=v(function(t,e,r,n,i,a,s,o,l,u,h){for(let f of e){let d={descr:f.task,section:r,number:r,width:150,padding:20,maxHeight:a};re.debug("taskNode",d);let p=t.append("g").attr("class","taskWrapper"),m=E0.drawNode(p,d,r,s).height;if(re.debug("taskHeight after draw",m),p.attr("transform",`translate(${n}, ${i})`),a=Math.max(a,m),f.events){let y=t.append("g").attr("class","lineWrapper"),x=a;i+=100,x=x+Y$e(t,f.events,r,n,i,s),i-=100,y.append("line").attr("x1",n+190/2).attr("y1",i+a).attr("x2",n+190/2).attr("y2",i+a+(h?a:u)+l+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}n=n+200,h&&!s.timeline?.disableMulticolor&&r++}i=i-10},"drawTasks"),Y$e=v(function(t,e,r,n,i,a){let s=0,o=i;i=i+100;for(let l of e){let u={descr:l,section:r,number:r,width:150,padding:20,maxHeight:50};re.debug("eventNode",u);let h=t.append("g").attr("class","eventWrapper"),d=E0.drawNode(h,u,r,a).height;s=s+d,h.attr("transform",`translate(${n}, ${i})`),i=i+10+d}return i=o,s},"drawEvents"),X$e={setConf:v(()=>{},"setConf"),draw:q$e},j$e=v(t=>{let e="";for(let r=0;r` .edge { stroke-width: 3; } ${j$e(t)} .section-root rect, .section-root path, .section-root circle { fill: ${t.git0}; } .section-root text { fill: ${t.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .eventWrapper { filter: brightness(120%); } `,"getStyles"),Z$e=K$e,Q$e={db:Khe,renderer:X$e,parser:I$e,styles:Z$e}});function Oi(t){"@babel/helpers - typeof";return Oi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oi(t)}function AD(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ufe(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,o;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return a=l.done,l},e:function(l){s=!0,o=l},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(s)throw o}}}}function SGe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function CGe(t,e){return e={exports:{}},t(e,e.exports),e.exports}function MGe(t){for(var e=t.length;e--&&IGe.test(t.charAt(e)););return e}function PGe(t){return t&&t.slice(0,DGe(t)+1).replace(OGe,"")}function GGe(t){var e=zGe.call(t,fx),r=t[fx];try{t[fx]=void 0;var n=!0}catch{}var i=$Ge.call(t);return n&&(e?t[fx]=r:delete t[fx]),i}function HGe(t){return WGe.call(t)}function jGe(t){return t==null?t===void 0?XGe:YGe:pfe&&pfe in Object(t)?UGe(t):qGe(t)}function KGe(t){return t!=null&&typeof t=="object"}function JGe(t){return typeof t=="symbol"||ZGe(t)&&Pde(t)==QGe}function iUe(t){if(typeof t=="number")return t;if(Bx(t))return gfe;if(I0(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=I0(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=BGe(t);var r=tUe.test(t);return r||rUe.test(t)?nUe(t.slice(2),r?2:8):eUe.test(t)?gfe:+t}function lUe(t,e,r){var n,i,a,s,o,l,u=0,h=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(aUe);e=mfe(e)||0,I0(r)&&(h=!!r.leading,f="maxWait"in r,a=f?sUe(mfe(r.maxWait)||0,e):a,d="trailing"in r?!!r.trailing:d);function p(E){var L=n,S=i;return n=i=void 0,u=E,s=t.apply(S,L),s}function g(E){return u=E,o=setTimeout(x,e),h?p(E):s}function m(E){var L=E-l,S=E-u,C=e-L;return f?oUe(C,a-S):C}function y(E){var L=E-l,S=E-u;return l===void 0||L>=e||L<0||f&&S>=a}function x(){var E=QM();if(y(E))return b(E);o=setTimeout(x,m(E))}function b(E){return o=void 0,d&&n?p(E):(n=i=void 0,s)}function w(){o!==void 0&&clearTimeout(o),u=0,n=l=i=o=void 0}function _(){return o===void 0?s:b(QM())}function k(){var E=QM(),L=y(E);if(n=arguments,i=this,l=E,L){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(x,e),p(l)}return o===void 0&&(o=setTimeout(x,e)),s}return k.cancel=w,k.flush=_,k}function Q6(t,e,r,n,i,a){var s;return jn(t)?s=t:s=Km[t]||Km.euclidean,e===0&&jn(t)?s(i,a):s(e,r,n,i,a)}function eWe(t,e){if(J6(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Bx(t)?!0:JVe.test(t)||!QVe.test(t)||e!=null&&t in Object(e)}function sWe(t){if(!I0(t))return!1;var e=Pde(t);return e==nWe||e==iWe||e==rWe||e==aWe}function cWe(t){return!!Pfe&&Pfe in t}function dWe(t){if(t!=null){try{return fWe.call(t)}catch{}try{return t+""}catch{}}return""}function kWe(t){if(!I0(t)||uWe(t))return!1;var e=oWe(t)?wWe:mWe;return e.test(pWe(t))}function EWe(t,e){return t?.[e]}function CWe(t,e){var r=SWe(t,e);return TWe(r)?r:void 0}function _We(){this.__data__=Rx?Rx(null):{},this.size=0}function RWe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function OWe(t){var e=this.__data__;if(Rx){var r=e[t];return r===IWe?void 0:r}return DWe.call(e,t)?e[t]:void 0}function zWe(t){var e=this.__data__;return Rx?e[t]!==void 0:FWe.call(e,t)}function UWe(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Rx&&e===void 0?GWe:e,this}function e1(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1}function rHe(t,e){var r=this.__data__,n=eE(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function t1(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t0;){var h=i.shift();e(h),a.add(h.id()),o&&n(i,a,h)}return t}function g0e(t,e,r){if(r.isParent())for(var n=r._private.children,i=0;i0&&arguments[0]!==void 0?arguments[0]:$qe,e=arguments.length>1?arguments[1]:void 0,r=0;r0?T=A:R=A;while(Math.abs(I)>s&&++D=a?b(M,D):N===0?D:_(M,R,R+u)}var E=!1;function L(){E=!0,(t!==e||r!==n)&&w()}var S=function(R){return E||L(),t===e&&r===n?R:R===0?0:R===1?1:y(k(R),e,n)};S.getControlPoints=function(){return[{x:t,y:e},{x:r,y:n}]};var C="generateBezier("+[t,e,r,n]+")";return S.toString=function(){return C},S}function tde(t,e,r,n,i){if(n===1||e===r)return r;var a=i(e,r,n);return t==null||((t.roundValue||t.color)&&(a=Math.round(a)),t.min!==void 0&&(a=Math.max(a,t.min)),t.max!==void 0&&(a=Math.min(a,t.max))),a}function rde(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Fm(t,e,r,n,i){var a=i!=null?i.type:null;r<0?r=0:r>1&&(r=1);var s=rde(t,i),o=rde(e,i);if(dt(s)&&dt(o))return tde(a,s,o,r,n);if(vn(s)&&vn(o)){for(var l=[],u=0;u0?(p==="spring"&&g.push(s.duration),s.easingImpl=N6[p].apply(null,g)):s.easingImpl=N6[p]}var m=s.easingImpl,y;if(s.duration===0?y=1:y=(r-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var x=s.startPosition,b=s.position;if(b&&i&&!t.locked()){var w={};mx(x.x,b.x)&&(w.x=Fm(x.x,b.x,y,m)),mx(x.y,b.y)&&(w.y=Fm(x.y,b.y,y,m)),t.position(w)}var _=s.startPan,k=s.pan,E=a.pan,L=k!=null&&n;L&&(mx(_.x,k.x)&&(E.x=Fm(_.x,k.x,y,m)),mx(_.y,k.y)&&(E.y=Fm(_.y,k.y,y,m)),t.emit("pan"));var S=s.startZoom,C=s.zoom,M=C!=null&&n;M&&(mx(S,C)&&(a.zoom=_x(a.minZoom,Fm(S,C,y,m),a.maxZoom)),t.emit("zoom")),(L||M)&&t.emit("viewport");var R=s.style;if(R&&R.length>0&&i){for(var T=0;T=0;L--){var S=E[L];S()}E.splice(0,E.length)},b=p.length-1;b>=0;b--){var w=p[b],_=w._private;if(_.stopped){p.splice(b,1),_.hooked=!1,_.playing=!1,_.started=!1,x(_.frames);continue}!_.playing&&!_.applying||(_.playing&&_.applying&&(_.applying=!1),_.started||eYe(h,w,t),Jqe(h,w,t,f),_.applying&&(_.applying=!1),x(_.frames),_.step!=null&&_.step(t),w.completed()&&(p.splice(b,1),_.hooked=!1,_.playing=!1,_.started=!1,x(_.completes)),m=!0)}return!f&&p.length===0&&g.length===0&&n.push(h),m}for(var a=!1,s=0;s0?e.notify("draw",r):e.notify("draw")),r.unmerge(n),e.emit("step")}function I0e(t){this.options=Kt({},lYe,cYe,t)}function M0e(t){this.options=Kt({},uYe,t)}function D0e(t){this.options=Kt({},hYe,t)}function lE(t){this.options=Kt({},fYe,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),n=r.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),o=e.some(function(u){return u.data("id")===a}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(n)}function P0e(t){this.options=Kt({},LYe,t)}function qD(t){this.options=Kt({},RYe,t)}function B0e(t){this.options=Kt({},NYe,t)}function F0e(t){this.options=Kt({},IYe,t)}function z0e(t){this.options=t,this.notifications=0}function U0e(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function XD(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return n===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(OYe(t,e,r,n,i),{cx:xD,cy:bD,radius:L0,startX:$0e,startY:G0e,stopX:wD,stopY:kD,startAngle:Gc.ang+Math.PI/2*R0,endAngle:Ko.ang-Math.PI/2*R0,counterClockwise:D6})}function V0e(t){var e=[];if(t!=null){for(var r=0;r5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+a,r),t.lineTo(e+n-a,r),t.quadraticCurveTo(e+n,r,e+n,r+a),t.lineTo(e+n,r+i-a),t.quadraticCurveTo(e+n,r+i,e+n-a,r+i),t.lineTo(e+a,r+i),t.quadraticCurveTo(e,r+i,e,r+i-a),t.lineTo(e,r+a),t.quadraticCurveTo(e,r,e+a,r),t.closePath(),s?t.stroke():t.fill()}function TXe(t,e){for(var r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n),a=0;a{Mi=typeof window>"u"?null:window,ffe=Mi?Mi.navigator:null;Mi&&Mi.document;rGe=Oi(""),_de=Oi({}),nGe=Oi(function(){}),iGe=typeof HTMLElement>"u"?"undefined":Oi(HTMLElement),Ox=function(e){return e&&e.instanceString&&jn(e.instanceString)?e.instanceString():null},Wt=function(e){return e!=null&&Oi(e)==rGe},jn=function(e){return e!=null&&Oi(e)===nGe},vn=function(e){return!co(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Dr=function(e){return e!=null&&Oi(e)===_de&&!vn(e)&&e.constructor===Object},aGe=function(e){return e!=null&&Oi(e)===_de},dt=function(e){return e!=null&&Oi(e)===Oi(1)&&!isNaN(e)},sGe=function(e){return dt(e)&&Math.floor(e)===e},P6=function(e){if(iGe!=="undefined")return e!=null&&e instanceof HTMLElement},co=function(e){return Px(e)||Lde(e)},Px=function(e){return Ox(e)==="collection"&&e._private.single},Lde=function(e){return Ox(e)==="collection"&&!e._private.single},LD=function(e){return Ox(e)==="core"},Rde=function(e){return Ox(e)==="stylesheet"},oGe=function(e){return Ox(e)==="event"},bf=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},lGe=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},cGe=function(e){return Dr(e)&&dt(e.x1)&&dt(e.x2)&&dt(e.y1)&&dt(e.y2)},uGe=function(e){return aGe(e)&&jn(e.then)},hGe=function(){return ffe&&ffe.userAgent.match(/msie|trident|edge/i)},Ex=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;sr?1:0},yGe=function(e,r){return-1*Ide(e,r)},Kt=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(y-=1),y<1/6?g+(m-g)*6*y:y<1/2?m:y<2/3?g+(m-g)*(2/3-y)*6:g}var f=new RegExp("^"+pGe+"$").exec(e);if(f){if(n=parseInt(f[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,i=parseFloat(f[2]),i<0||i>100||(i=i/100,a=parseFloat(f[3]),a<0||a>100)||(a=a/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=l=u=Math.round(a*255);else{var d=a<.5?a*(1+i):a+i-a*i,p=2*a-d;o=Math.round(255*h(p,d,n+1/3)),l=Math.round(255*h(p,d,n)),u=Math.round(255*h(p,d,n-1/3))}r=[o,l,u,s]}return r},wGe=function(e){var r,n=new RegExp("^"+fGe+"$").exec(e);if(n){r=[];for(var i=[],a=1;a<=3;a++){var s=n[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(o&&!l)return;var u=n[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},kGe=function(e){return EGe[e.toLowerCase()]},TGe=function(e){return(vn(e)?e:null)||kGe(e)||xGe(e)||wGe(e)||bGe(e)},EGe={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Mde=function(e){for(var r=e.map,n=e.keys,i=n.length,a=0;a1&&arguments[1]!==void 0?arguments[1]:Gm,n=r,i;i=e.next(),!i.done;)n=n*Fde+i.value|0;return n},Sx=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gm;return r*Fde+e|0},Cx=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yx;return(r<<5)+r+e|0},uUe=function(e,r){return e*2097152+r},pf=function(e){return e[0]*2097152+e[1]},g6=function(e,r){return[Sx(e[0],r[0]),Cx(e[1],r[1])]},hUe=function(e,r){var n={value:0,done:!1},i=0,a=e.length,s={next:function(){return i=0&&!(e[i]===r&&(e.splice(i,1),n));i--);},MD=function(e){e.splice(0,e.length)},yUe=function(e,r){for(var n=0;n"u"?"undefined":Oi(Set))!==bUe?Set:wUe,K6=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!LD(e)){ni("An element must have a core reference and parameters set");return}var i=r.group;if(i==null&&(r.data&&r.data.source!=null&&r.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){ni("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?i==="edges":!!r.pannable,active:!1,classes:new Qm,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();a.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];vn(r.classes)?u=r.classes:Wt(r.classes)&&(u=r.classes.split(/\s+/));for(var h=0,f=u.length;hb?1:0},h=function(x,b,w,_,k){var E;if(w==null&&(w=0),k==null&&(k=n),w<0)throw new Error("lo must be non-negative");for(_==null&&(_=x.length);w<_;)E=i((w+_)/2),k(b,x[E])<0?_=E:w=E+1;return[].splice.apply(x,[w,w-w].concat(b)),b},o=function(x,b,w){return w==null&&(w=n),x.push(b),m(x,0,x.length-1,w)},s=function(x,b){var w,_;return b==null&&(b=n),w=x.pop(),x.length?(_=x[0],x[0]=w,y(x,0,b)):_=w,_},u=function(x,b,w){var _;return w==null&&(w=n),_=x[0],x[0]=b,y(x,0,w),_},l=function(x,b,w){var _;return w==null&&(w=n),x.length&&w(x[0],b)<0&&(_=[x[0],b],b=_[0],x[0]=_[1],y(x,0,w)),b},a=function(x,b){var w,_,k,E,L,S;for(b==null&&(b=n),E=function(){S=[];for(var C=0,M=i(x.length/2);0<=M?CM;0<=M?C++:C--)S.push(C);return S}.apply(this).reverse(),L=[],_=0,k=E.length;_R;0<=R?++S:--S)T.push(s(x,w));return T},m=function(x,b,w,_){var k,E,L;for(_==null&&(_=n),k=x[w];w>b;){if(L=w-1>>1,E=x[L],_(k,E)<0){x[w]=E,w=L;continue}break}return x[w]=k},y=function(x,b,w){var _,k,E,L,S;for(w==null&&(w=n),k=x.length,S=b,E=x[b],_=2*b+1;_0;){var E=b.pop(),L=y(E),S=E.id();if(d[S]=L,L!==1/0)for(var C=E.neighborhood().intersect(g),M=0;M0)for(B.unshift(O);f[$];){var z=f[$];B.unshift(z.edge),B.unshift(z.node),P=z.node,$=P.id()}return o.spawn(B)}}}},SUe={kruskal:function(e){e=e||function(w){return 1};for(var r=this.byGroup(),n=r.nodes,i=r.edges,a=n.length,s=new Array(a),o=n,l=function(_){for(var k=0;k0;){if(k(),L++,_===h){for(var S=[],C=a,M=h,R=x[M];S.unshift(C),R!=null&&S.unshift(R),C=y[M],C!=null;)M=C.id(),R=x[M];return{found:!0,distance:f[_],path:this.spawn(S),steps:L}}p[_]=!0;for(var T=w._private.edges,I=0;IR&&(g[M]=R,b[M]=C,w[M]=k),!a){var T=C*h+S;!a&&g[T]>R&&(g[T]=R,b[T]=S,w[T]=k)}}}for(var I=0;I1&&arguments[1]!==void 0?arguments[1]:s,Ee=w(we),Oe=[],De=Ee;;){if(De==null)return r.spawn();var We=b(De),Re=We.edge,Pe=We.pred;if(Oe.unshift(De[0]),De.same(Ie)&&Oe.length>0)break;Re!=null&&Oe.unshift(Re),De=Pe}return l.spawn(Oe)},E=0;E=0;h--){var f=u[h],d=f[1],p=f[2];(r[d]===o&&r[p]===l||r[d]===l&&r[p]===o)&&u.splice(h,1)}for(var g=0;gi;){var a=Math.floor(Math.random()*r.length);r=MUe(a,e,r),n--}return r},DUe={kargerStein:function(){var e=this,r=this.byGroup(),n=r.nodes,i=r.edges;i.unmergeBy(function(B){return B.isLoop()});var a=n.length,s=i.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),l=Math.floor(a/IUe);if(a<2){ni("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],h=0;h1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=-1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=0,a=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?e=e.slice(r,n):(n0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}a&&e.sort(function(d,p){return d-p});var h=e.length,f=Math.floor(h/2);return h%2!==0?e[f+1+o]:(e[f-1+o]+e[f+o])/2},$Ue=function(e){return Math.PI*e/180},m6=function(e,r){return Math.atan2(r,e)-Math.PI/2},DD=Math.log2||function(t){return Math.log(t)/Math.log(2)},qde=function(e){return e>0?1:e<0?-1:0},D0=function(e,r){return Math.sqrt(A0(e,r))},A0=function(e,r){var n=r.x-e.x,i=r.y-e.y;return n*n+i*i},GUe=function(e){for(var r=e.length,n=0,i=0;i=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},VUe=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},WUe=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},HUe=function(e,r,n){return{x1:e.x1+r,x2:e.x2+r,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},Yde=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},qUe=function(e,r,n){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},A6=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},_6=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,i,a,s;if(r.length===1)n=i=a=s=r[0];else if(r.length===2)n=a=r[0],s=i=r[1];else if(r.length===4){var o=Ol(r,4);n=o[0],i=o[1],a=o[2],s=o[3]}return e.x1-=s,e.x2+=i,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},bfe=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},OD=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},jm=function(e,r,n){return e.x1<=r&&r<=e.x2&&e.y1<=n&&n<=e.y2},YUe=function(e,r){return jm(e,r.x,r.y)},Xde=function(e,r){return jm(e,r.x1,r.y1)&&jm(e,r.x2,r.y2)},jde=function(e,r,n,i,a,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?O0(a,s):l,h=a/2,f=s/2;u=Math.min(u,h,f);var d=u!==h,p=u!==f,g;if(d){var m=n-h+u-o,y=i-f-o,x=n+h-u+o,b=y;if(g=vf(e,r,n,i,m,y,x,b,!1),g.length>0)return g}if(p){var w=n+h+o,_=i-f+u-o,k=w,E=i+f-u+o;if(g=vf(e,r,n,i,w,_,k,E,!1),g.length>0)return g}if(d){var L=n-h+u-o,S=i+f+o,C=n+h-u+o,M=S;if(g=vf(e,r,n,i,L,S,C,M,!1),g.length>0)return g}if(p){var R=n-h-o,T=i-f+u-o,I=R,A=i+f-u+o;if(g=vf(e,r,n,i,R,T,I,A,!1),g.length>0)return g}var D;{var N=n-h+u,O=i-f+u;if(D=xx(e,r,n,i,N,O,u+o),D.length>0&&D[0]<=N&&D[1]<=O)return[D[0],D[1]]}{var B=n+h-u,P=i-f+u;if(D=xx(e,r,n,i,B,P,u+o),D.length>0&&D[0]>=B&&D[1]<=P)return[D[0],D[1]]}{var $=n+h-u,z=i+f-u;if(D=xx(e,r,n,i,$,z,u+o),D.length>0&&D[0]>=$&&D[1]>=z)return[D[0],D[1]]}{var H=n-h+u,J=i+f-u;if(D=xx(e,r,n,i,H,J,u+o),D.length>0&&D[0]<=H&&D[1]>=J)return[D[0],D[1]]}return[]},XUe=function(e,r,n,i,a,s,o){var l=o,u=Math.min(n,a),h=Math.max(n,a),f=Math.min(i,s),d=Math.max(i,s);return u-l<=e&&e<=h+l&&f-l<=r&&r<=d+l},jUe=function(e,r,n,i,a,s,o,l,u){var h={x1:Math.min(n,o,a)-u,x2:Math.max(n,o,a)+u,y1:Math.min(i,l,s)-u,y2:Math.max(i,l,s)+u};return!(eh.x2||rh.y2)},KUe=function(e,r,n,i){n-=i;var a=r*r-4*e*n;if(a<0)return[];var s=Math.sqrt(a),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},ZUe=function(e,r,n,i,a){var s=1e-5;e===0&&(e=s),r/=e,n/=e,i/=e;var o,l,u,h,f,d,p,g;if(l=(3*n-r*r)/9,u=-(27*i)+r*(9*n-2*(r*r)),u/=54,o=l*l*l+u*u,a[1]=0,p=r/3,o>0){f=u+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=u-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-p+f+d,p+=(f+d)/2,a[4]=a[2]=-p,p=Math.sqrt(3)*(-d+f)/2,a[3]=p,a[5]=-p;return}if(a[5]=a[3]=0,o===0){g=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),a[0]=-p+2*g,a[4]=a[2]=-(g+p);return}l=-l,h=l*l*l,h=Math.acos(u/Math.sqrt(h)),g=2*Math.sqrt(l),a[0]=-p+g*Math.cos(h/3),a[2]=-p+g*Math.cos((h+2*Math.PI)/3),a[4]=-p+g*Math.cos((h+4*Math.PI)/3)},QUe=function(e,r,n,i,a,s,o,l){var u=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+i*i-4*i*s+2*i*l+4*s*s-4*s*l+l*l,h=1*9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*i*s-3*i*i-3*i*l-6*s*s+3*s*l,f=1*3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*i*i-6*i*s+i*l-i*r+2*s*s+2*s*r-l*r,d=1*n*a-n*n+n*e-a*e+i*s-i*i+i*r-s*r,p=[];ZUe(u,h,f,d,p);for(var g=1e-7,m=[],y=0;y<6;y+=2)Math.abs(p[y+1])=0&&p[y]<=1&&m.push(p[y]);m.push(1),m.push(0);for(var x=-1,b,w,_,k=0;k=0?_u?(e-a)*(e-a)+(r-s)*(r-s):h-d},Bs=function(e,r,n){for(var i,a,s,o,l,u=0,h=0;h=e&&e>=s||i<=e&&e<=s)l=(e-i)/(s-i)*(o-a)+a,l>r&&u++;else continue;return u%2!==0},Ju=function(e,r,n,i,a,s,o,l,u){var h=new Array(n.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var d=Math.cos(-f),p=Math.sin(-f),g=0;g0){var y=$6(h,-u);m=z6(y)}else m=h;return Bs(e,r,m)},eVe=function(e,r,n,i,a,s,o,l){for(var u=new Array(n.length*2),h=0;h=0&&y<=1&&b.push(y),x>=0&&x<=1&&b.push(x),b.length===0)return[];var w=b[0]*l[0]+e,_=b[0]*l[1]+r;if(b.length>1){if(b[0]==b[1])return[w,_];var k=b[1]*l[0]+e,E=b[1]*l[1]+r;return[w,_,k,E]}else return[w,_]},tD=function(e,r,n){return r<=e&&e<=n||n<=e&&e<=r?e:e<=r&&r<=n||n<=r&&r<=e?r:n},vf=function(e,r,n,i,a,s,o,l,u){var h=e-a,f=n-e,d=o-a,p=r-s,g=i-r,m=l-s,y=d*p-m*h,x=f*p-g*h,b=m*f-d*g;if(b!==0){var w=y/b,_=x/b,k=.001,E=0-k,L=1+k;return E<=w&&w<=L&&E<=_&&_<=L?[e+w*f,r+w*g]:u?[e+w*f,r+w*g]:[]}else return y===0||x===0?tD(e,n,o)===o?[o,l]:tD(e,n,a)===a?[a,s]:tD(a,o,n)===n?[n,i]:[]:[]},Lx=function(e,r,n,i,a,s,o,l){var u=[],h,f=new Array(n.length),d=!0;s==null&&(d=!1);var p;if(d){for(var g=0;g0){var m=$6(f,-l);p=z6(m)}else p=f}else p=n;for(var y,x,b,w,_=0;_2){for(var g=[h[0],h[1]],m=Math.pow(g[0]-e,2)+Math.pow(g[1]-r,2),y=1;yh&&(h=_)},get:function(w){return u[w]}},d=0;d0?N=D.edgesTo(A)[0]:N=A.edgesTo(D)[0];var O=i(N);A=A.id(),S[A]>S[T]+O&&(S[A]=S[T]+O,C.nodes.indexOf(A)<0?C.push(A):C.updateItem(A),L[A]=0,E[A]=[]),S[A]==S[T]+O&&(L[A]=L[A]+L[T],E[A].push(T))}else for(var B=0;B0;){for(var H=k.pop(),J=0;J0&&o.push(n[l]);o.length!==0&&a.push(i.collection(o))}return a},mVe=function(e,r){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:xVe,o=i,l,u,h=0;h=2?dx(e,r,n,0,Sfe,bVe):dx(e,r,n,0,Efe)},squaredEuclidean:function(e,r,n){return dx(e,r,n,0,Sfe)},manhattan:function(e,r,n){return dx(e,r,n,0,Efe)},max:function(e,r,n){return dx(e,r,n,-1/0,wVe)}};Km["squared-euclidean"]=Km.squaredEuclidean;Km.squaredeuclidean=Km.squaredEuclidean;kVe=ba({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),BD=function(e){return kVe(e)},G6=function(e,r,n,i,a){var s=a!=="kMedoids",o=s?function(f){return n[f]}:function(f){return i[f](n)},l=function(d){return i[d](r)},u=n,h=r;return Q6(e,i.length,o,l,u,h)},rD=function(e,r,n){for(var i=n.length,a=new Array(i),s=new Array(i),o=new Array(r),l=null,u=0;un)return!1}return!0},SVe=function(e,r,n){for(var i=0;io&&(o=r[u][h],l=h);a[l].push(e[u])}for(var f=0;f=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var g=r[s],m=r[i[s]],y;a.mode==="dendrogram"?y={left:g,right:m,key:g.key}:y={value:g.value.concat(m.value),key:g.key},e[g.index]=y,e.splice(m.index,1),r[g.key]=y;for(var x=0;xn[m.key][b.key]&&(l=n[m.key][b.key])):a.linkage==="max"?(l=n[g.key][b.key],n[g.key][b.key]0&&i.push(a);return i},Nfe=function(e,r,n){for(var i=[],a=0;ao&&(s=u,o=r[a*e+u])}s>0&&i.push(s)}for(var h=0;hu&&(l=h,u=f)}n[a]=s[l]}return i=Nfe(e,r,n),i},Ife=function(e){for(var r=this.cy(),n=this.nodes(),i=zVe(e),a={},s=0;s=R?(T=R,R=A,I=D):A>T&&(T=A);for(var N=0;N0?1:0;L[C%i.minIterations*o+H]=J,z+=J}if(z>0&&(C>=i.minIterations-1||C==i.maxIterations-1)){for(var X=0,oe=0;oe1||E>1)&&(o=!0),f[w]=[],b.outgoers().forEach(function(S){S.isEdge()&&f[w].push(S.id())})}else d[w]=[void 0,b.target().id()]}):s.forEach(function(b){var w=b.id();if(b.isNode()){var _=b.degree(!0);_%2&&(l?u?o=!0:u=w:l=w),f[w]=[],b.connectedEdges().forEach(function(k){return f[w].push(k.id())})}else d[w]=[b.source().id(),b.target().id()]});var p={found:!1,trail:void 0};if(o)return p;if(u&&l)if(a){if(h&&u!=h)return p;h=u}else{if(h&&u!=h&&l!=h)return p;h||(h=u)}else h||(h=s[0].id());var g=function(w){for(var _=w,k=[w],E,L,S;f[_].length;)E=f[_].shift(),L=d[E][0],S=d[E][1],_!=S?(f[S]=f[S].filter(function(C){return C!=E}),_=S):!a&&_!=L&&(f[L]=f[L].filter(function(C){return C!=E}),_=L),k.unshift(E),k.unshift(_);return k},m=[],y=[];for(y=g(h);y.length!=1;)f[y[0]].length==0?(m.unshift(s.getElementById(y.shift())),m.unshift(s.getElementById(y.shift()))):y=g(y.shift()).concat(y);m.unshift(s.getElementById(y.shift()));for(var x in f)if(f[x].length)return p;return p.found=!0,p.trail=this.spawn(m,!0),p}},x6=function(){var e=this,r={},n=0,i=0,a=[],s=[],o={},l=function(d,p){for(var g=s.length-1,m=[],y=e.spawn();s[g].x!=d||s[g].y!=p;)m.push(s.pop().edge),g--;m.push(s.pop().edge),m.forEach(function(x){var b=x.connectedNodes().intersection(e);y.merge(x),b.forEach(function(w){var _=w.id(),k=w.connectedEdges().intersection(e);y.merge(w),r[_].cutVertex?y.merge(k.filter(function(E){return E.isLoop()})):y.merge(k)})}),a.push(y)},u=function f(d,p,g){d===g&&(i+=1),r[p]={id:n,low:n++,cutVertex:!1};var m=e.getElementById(p).connectedEdges().intersection(e);if(m.size()===0)a.push(e.spawn(e.getElementById(p)));else{var y,x,b,w;m.forEach(function(_){y=_.source().id(),x=_.target().id(),b=y===p?x:y,b!==g&&(w=_.id(),o[w]||(o[w]=!0,s.push({x:p,y:b,edge:_})),b in r?r[p].low=Math.min(r[p].low,r[b].id):(f(d,b,p),r[p].low=Math.min(r[p].low,r[b].low),r[p].id<=r[b].low&&(r[p].cutVertex=!0,l(p,b))))})}};e.forEach(function(f){if(f.isNode()){var d=f.id();d in r||(i=0,u(d,d),r[d].cutVertex=i>1)}});var h=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(h),components:a}},YVe={hopcroftTarjanBiconnected:x6,htbc:x6,htb:x6,hopcroftTarjanBiconnectedComponents:x6},b6=function(){var e=this,r={},n=0,i=[],a=[],s=e.spawn(e),o=function l(u){a.push(u),r[u]={index:n,low:n++,explored:!1};var h=e.getElementById(u).connectedEdges().intersection(e);if(h.forEach(function(m){var y=m.target().id();y!==u&&(y in r||l(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var f=e.spawn();;){var d=a.pop();if(f.merge(e.getElementById(d)),r[d].low=r[u].index,r[d].explored=!0,d===u)break}var p=f.edgesWith(f),g=f.merge(p);i.push(g),s=s.difference(g)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:i}},XVe={tarjanStronglyConnected:b6,tsc:b6,tscc:b6,tarjanStronglyConnectedComponents:b6},r0e={};[Ax,EUe,SUe,AUe,LUe,NUe,DUe,aVe,Hm,qm,dD,yVe,NVe,BVe,WVe,qVe,YVe,XVe].forEach(function(t){Kt(r0e,t)});n0e=0,i0e=1,a0e=2,eh=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=n0e,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};eh.prototype={fulfill:function(e){return Mfe(this,i0e,"fulfillValue",e)},reject:function(e){return Mfe(this,a0e,"rejectReason",e)},then:function(e,r){var n=this,i=new eh;return n.onFulfilled.push(Ofe(e,i,"fulfill")),n.onRejected.push(Ofe(r,i,"reject")),s0e(n),i.proxy}};Mfe=function(e,r,n,i){return e.state===n0e&&(e.state=r,e[n]=i,s0e(e)),e},s0e=function(e){e.state===i0e?Dfe(e,"onFulfilled",e.fulfillValue):e.state===a0e&&Dfe(e,"onRejected",e.rejectReason)},Dfe=function(e,r,n){if(e[r].length!==0){var i=e[r];e[r]=[];var a=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,n=r.length!==void 0,i=n?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s0&&this.spawn(i).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){vn(e)||(e=e.match(/\S+/g)||[]);for(var n=this,i=r===void 0,a=[],s=0,o=n.length;s0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var n=this;if(r==null)r=250;else if(r===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},r),n}};L6.className=L6.classNames=L6.classes;Mr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Di,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Mr.variable="(?:[\\w-.]|(?:\\\\"+Mr.metaChar+"))+";Mr.className="(?:[\\w-]|(?:\\\\"+Mr.metaChar+"))+";Mr.value=Mr.string+"|"+Mr.number;Mr.id=Mr.variable;(function(){var t,e,r;for(t=Mr.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(Mr.comparatorOp+="|\\!"+e)})();ln=function(){return{checks:[]}},At={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},gD=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return yGe(t.selector,e.selector)}),oqe=function(){for(var t={},e,r=0;r0&&h.edgeCount>0)return Jr("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(h.edgeCount>1)return Jr("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;h.edgeCount===1&&Jr("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},dqe=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(h){return h??""},r=function(h){return Wt(h)?'"'+h+'"':e(h)},n=function(h){return" "+h+" "},i=function(h,f){var d=h.type,p=h.value;switch(d){case At.GROUP:{var g=e(p);return g.substring(0,g.length-1)}case At.DATA_COMPARE:{var m=h.field,y=h.operator;return"["+m+n(e(y))+r(p)+"]"}case At.DATA_BOOL:{var x=h.operator,b=h.field;return"["+e(x)+b+"]"}case At.DATA_EXIST:{var w=h.field;return"["+w+"]"}case At.META_COMPARE:{var _=h.operator,k=h.field;return"[["+k+n(e(_))+r(p)+"]]"}case At.STATE:return p;case At.ID:return"#"+p;case At.CLASS:return"."+p;case At.PARENT:case At.CHILD:return a(h.parent,f)+n(">")+a(h.child,f);case At.ANCESTOR:case At.DESCENDANT:return a(h.ancestor,f)+" "+a(h.descendant,f);case At.COMPOUND_SPLIT:{var E=a(h.left,f),L=a(h.subject,f),S=a(h.right,f);return E+(E.length>0?" ":"")+L+S}case At.TRUE:return""}},a=function(h,f){return h.checks.reduce(function(d,p,g){return d+(f===h&&g===0?"$":"")+i(p,f)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),h=!0),(a||o||h)&&(l=!a&&!s?"":""+e,u=""+n),h&&(e=l=l.toLowerCase(),n=u=u.toLowerCase()),r){case"*=":i=l.indexOf(u)>=0;break;case"$=":i=l.indexOf(u,l.length-u.length)>=0;break;case"^=":i=l.indexOf(u)===0;break;case"=":i=e===n;break;case">":d=!0,i=e>n;break;case">=":d=!0,i=e>=n;break;case"<":d=!0,i=e1&&arguments[1]!==void 0?arguments[1]:!0;return UD(this,t,e,g0e)};Zm.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return UD(this,t,e,m0e)};Zm.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return UD(this,t,e,wqe)};Zm.ancestors=Zm.parents;Nx=v0e={data:Qr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Qr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Qr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Qr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Qr.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Qr.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Nx.attr=Nx.data;Nx.removeAttr=Nx.removeData;kqe=v0e,rE={};Kt(rE,{degree:iD(function(t,e){return e.source().same(e.target())?2:1}),indegree:iD(function(t,e){return e.target().same(t)?1:0}),outdegree:iD(function(t,e){return e.source().same(t)?1:0})});Kt(rE,{minDegree:Bm("degree",function(t,e){return te}),minIndegree:Bm("indegree",function(t,e){return te}),minOutdegree:Bm("outdegree",function(t,e){return te})});Kt(rE,{totalDegree:function(e){for(var r=0,n=this.nodes(),i=0;i0,d=f;f&&(h=h[0]);var p=d?h.position():{x:0,y:0};r!==void 0?u.position(e,r+p[e]):a!==void 0&&u.position({x:a.x+p.x,y:a.y+p.y})}else{var g=n.position(),m=o?n.parent():null,y=m&&m.length>0,x=y;y&&(m=m[0]);var b=x?m.position():{x:0,y:0};return a={x:g.x-b.x,y:g.y-b.y},e===void 0?a:a[e]}else if(!s)return;return this}};Fl.modelPosition=Fl.point=Fl.position;Fl.modelPositions=Fl.points=Fl.positions;Fl.renderedPoint=Fl.renderedPosition;Fl.relativePoint=Fl.relativePosition;Tqe=y0e;Ym=Sf={};Sf.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),n=r.zoom(),i=r.pan(),a=e.x1*n+i.x,s=e.x2*n+i.x,o=e.y1*n+i.y,l=e.y2*n+i.y;return{x1:a,x2:s,y1:o,y2:l,w:s-a,h:l-o}};Sf.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var n=r._private;n.compoundBoundsClean=!1,n.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};Sf.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",h={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),d=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function p(C,M,R){var T=0,I=0,A=M+R;return C>0&&A>0&&(T=M/A*C,I=R/A*C),{biasDiff:T,biasComplementDiff:I}}function g(C,M,R,T){if(R.units==="%")switch(T){case"width":return C>0?R.pfValue*C:0;case"height":return M>0?R.pfValue*M:0;case"average":return C>0&&M>0?R.pfValue*(C+M)/2:0;case"min":return C>0&&M>0?C>M?R.pfValue*M:R.pfValue*C:0;case"max":return C>0&&M>0?C>M?R.pfValue*C:R.pfValue*M:0;default:return 0}else return R.units==="px"?R.pfValue:0}var m=h.width.left.value;h.width.left.units==="px"&&h.width.val>0&&(m=m*100/h.width.val);var y=h.width.right.value;h.width.right.units==="px"&&h.width.val>0&&(y=y*100/h.width.val);var x=h.height.top.value;h.height.top.units==="px"&&h.height.val>0&&(x=x*100/h.height.val);var b=h.height.bottom.value;h.height.bottom.units==="px"&&h.height.val>0&&(b=b*100/h.height.val);var w=p(h.width.val-f.w,m,y),_=w.biasDiff,k=w.biasComplementDiff,E=p(h.height.val-f.h,x,b),L=E.biasDiff,S=E.biasComplementDiff;o.autoPadding=g(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,h.width.val),d.x=(-_+f.x1+f.x2+k)/2,o.autoHeight=Math.max(f.h,h.height.val),d.y=(-L+f.y1+f.y2+S)/2}for(var n=0;ne.x2?i:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},_0=function(e,r){return r==null?e:Pl(e,r.x1,r.y1,r.x2,r.y2)},px=function(e,r,n){return Bl(e,r,n)},w6=function(e,r,n){if(!r.cy().headless()){var i=r._private,a=i.rstyle,s=a.arrowWidth/2,o=r.pstyle(n+"-arrow-shape").value,l,u;if(o!=="none"){n==="source"?(l=a.srcX,u=a.srcY):n==="target"?(l=a.tgtX,u=a.tgtY):(l=a.midX,u=a.midY);var h=i.arrowBounds=i.arrowBounds||{},f=h[n]=h[n]||{};f.x1=l-s,f.y1=u-s,f.x2=l+s,f.y2=u+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,A6(f,1),Pl(e,f.x1,f.y1,f.x2,f.y2)}}},aD=function(e,r,n){if(!r.cy().headless()){var i;n?i=n+"-":i="";var a=r._private,s=a.rstyle,o=r.pstyle(i+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),h=px(s,"labelWidth",n),f=px(s,"labelHeight",n),d=px(s,"labelX",n),p=px(s,"labelY",n),g=r.pstyle(i+"text-margin-x").pfValue,m=r.pstyle(i+"text-margin-y").pfValue,y=r.isEdge(),x=r.pstyle(i+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,_=w/2,k=r.pstyle("text-background-padding").pfValue,E=2,L=f,S=h,C=S/2,M=L/2,R,T,I,A;if(y)R=d-C,T=d+C,I=p-M,A=p+M;else{switch(l.value){case"left":R=d-S,T=d;break;case"center":R=d-C,T=d+C;break;case"right":R=d,T=d+S;break}switch(u.value){case"top":I=p-L,A=p;break;case"center":I=p-M,A=p+M;break;case"bottom":I=p,A=p+L;break}}var D=g-Math.max(b,_)-k-E,N=g+Math.max(b,_)+k+E,O=m-Math.max(b,_)-k-E,B=m+Math.max(b,_)+k+E;R+=D,T+=N,I+=O,A+=B;var P=n||"main",$=a.labelBounds,z=$[P]=$[P]||{};z.x1=R,z.y1=I,z.x2=T,z.y2=A,z.w=T-R,z.h=A-I,z.leftPad=D,z.rightPad=N,z.topPad=O,z.botPad=B;var H=y&&x.strValue==="autorotate",J=x.pfValue!=null&&x.pfValue!==0;if(H||J){var X=H?px(a.rstyle,"labelAngle",n):x.pfValue,oe=Math.cos(X),K=Math.sin(X),ee=(R+T)/2,Q=(I+A)/2;if(!y){switch(l.value){case"left":ee=T;break;case"right":ee=R;break}switch(u.value){case"top":Q=A;break;case"bottom":Q=I;break}}var W=function(ae,we){return ae=ae-ee,we=we-Q,{x:ae*oe-we*K+ee,y:ae*K+we*oe+Q}},Y=W(R,I),Z=W(R,A),se=W(T,I),ce=W(T,A);R=Math.min(Y.x,Z.x,se.x,ce.x),T=Math.max(Y.x,Z.x,se.x,ce.x),I=Math.min(Y.y,Z.y,se.y,ce.y),A=Math.max(Y.y,Z.y,se.y,ce.y)}var ue=P+"Rot",te=$[ue]=$[ue]||{};te.x1=R,te.y1=I,te.x2=T,te.y2=A,te.w=T-R,te.h=A-I,Pl(e,R,I,T,A),Pl(a.labelBounds.all,R,I,T,A)}return e}},Eqe=function(e,r){if(!r.cy().headless()){var n=r.pstyle("outline-opacity").value,i=r.pstyle("outline-width").value;if(n>0&&i>0){var a=r.pstyle("outline-offset").value,s=r.pstyle("shape").value,o=i+a,l=(e.w+o*2)/e.w,u=(e.h+o*2)/e.h,h=0,f=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+o*2.4)/e.w,f=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+o*2.4)/e.w:s==="star"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.6)/e.h,f=-o/3.8):s==="triangle"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.4)/e.h,f=-o/1.4):s==="vee"&&(l=(e.w+o*4.4)/e.w,u=(e.h+o*3.8)/e.h,f=-o*.5);var d=e.h*u-e.h,p=e.w*l-e.w;if(_6(e,[Math.ceil(d/2),Math.ceil(p/2)]),h!=0||f!==0){var g=HUe(e,h,f);Yde(e,g)}}}},Sqe=function(e,r){var n=e._private.cy,i=n.styleEnabled(),a=n.headless(),s=Fs(),o=e._private,l=e.isNode(),u=e.isEdge(),h,f,d,p,g,m,y=o.rstyle,x=l&&i?e.pstyle("bounds-expansion").pfValue:[0],b=function(Ne){return Ne.pstyle("display").value!=="none"},w=!i||b(e)&&(!u||b(e.source())&&b(e.target()));if(w){var _=0,k=0;i&&r.includeOverlays&&(_=e.pstyle("overlay-opacity").value,_!==0&&(k=e.pstyle("overlay-padding").value));var E=0,L=0;i&&r.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(L=e.pstyle("underlay-padding").value));var S=Math.max(k,L),C=0,M=0;if(i&&(C=e.pstyle("width").pfValue,M=C/2),l&&r.includeNodes){var R=e.position();g=R.x,m=R.y;var T=e.outerWidth(),I=T/2,A=e.outerHeight(),D=A/2;h=g-I,f=g+I,d=m-D,p=m+D,Pl(s,h,d,f,p),i&&r.includeOutlines&&Eqe(s,e)}else if(u&&r.includeEdges)if(i&&!a){var N=e.pstyle("curve-style").strValue;if(h=Math.min(y.srcX,y.midX,y.tgtX),f=Math.max(y.srcX,y.midX,y.tgtX),d=Math.min(y.srcY,y.midY,y.tgtY),p=Math.max(y.srcY,y.midY,y.tgtY),h-=M,f+=M,d-=M,p+=M,Pl(s,h,d,f,p),N==="haystack"){var O=y.haystackPts;if(O&&O.length===2){if(h=O[0].x,d=O[0].y,f=O[1].x,p=O[1].y,h>f){var B=h;h=f,f=B}if(d>p){var P=d;d=p,p=P}Pl(s,h-M,d-M,f+M,p+M)}}else if(N==="bezier"||N==="unbundled-bezier"||N.endsWith("segments")||N.endsWith("taxi")){var $;switch(N){case"bezier":case"unbundled-bezier":$=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":$=y.linePts;break}if($!=null)for(var z=0;z<$.length;z++){var H=$[z];h=H.x-M,f=H.x+M,d=H.y-M,p=H.y+M,Pl(s,h,d,f,p)}}}else{var J=e.source(),X=J.position(),oe=e.target(),K=oe.position();if(h=X.x,f=K.x,d=X.y,p=K.y,h>f){var ee=h;h=f,f=ee}if(d>p){var Q=d;d=p,p=Q}h-=M,f+=M,d-=M,p+=M,Pl(s,h,d,f,p)}if(i&&r.includeEdges&&u&&(w6(s,e,"mid-source"),w6(s,e,"mid-target"),w6(s,e,"source"),w6(s,e,"target")),i){var W=e.pstyle("ghost").value==="yes";if(W){var Y=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue;Pl(s,s.x1+Y,s.y1+Z,s.x2+Y,s.y2+Z)}}var se=o.bodyBounds=o.bodyBounds||{};bfe(se,s),_6(se,x),A6(se,1),i&&(h=s.x1,f=s.x2,d=s.y1,p=s.y2,Pl(s,h-S,d-S,f+S,p+S));var ce=o.overlayBounds=o.overlayBounds||{};bfe(ce,s),_6(ce,x),A6(ce,1);var ue=o.labelBounds=o.labelBounds||{};ue.all!=null?WUe(ue.all):ue.all=Fs(),i&&r.includeLabels&&(r.includeMainLabels&&aD(s,e,null),u&&(r.includeSourceLabels&&aD(s,e,"source"),r.includeTargetLabels&&aD(s,e,"target")))}return s.x1=Zo(s.x1),s.y1=Zo(s.y1),s.x2=Zo(s.x2),s.y2=Zo(s.y2),s.w=Zo(s.x2-s.x1),s.h=Zo(s.y2-s.y1),s.w>0&&s.h>0&&w&&(_6(s,x),A6(s,1)),s},b0e=function(e){var r=0,n=function(s){return(s?1:0)<=0;o--)s(o);return this};Ef.removeAllListeners=function(){return this.removeListener("*")};Ef.emit=Ef.trigger=function(t,e,r){var n=this.listeners,i=n.length;return this.emitting++,vn(e)||(e=[e]),Gqe(this,function(a,s){r!=null&&(n=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],i=n.length);for(var o=function(h){var f=n[h];if(f.type===s.type&&(!f.namespace||f.namespace===s.namespace||f.namespace===zqe)&&a.eventMatches(a.context,f,s)){var d=[s];e!=null&&yUe(d,e),a.beforeEmit(a.context,f,s),f.conf&&f.conf.one&&(a.listeners=a.listeners.filter(function(m){return m!==f}));var p=a.callbackContext(a.context,f,s),g=f.callback.apply(p,d);a.afterEmit(a.context,f,s),g===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,a.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,n=e._private.data.id,i=r.map,a=i.get(n);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Wt(e)){var n=e;e=r.mutableElements().filter(n)}for(var i=0;i=0;r--){var n=this[r];e(n)&&this.unmergeAt(r)}return this},map:function(e,r){for(var n=[],i=this,a=0;an&&(n=l,i=o)}return{value:n,ele:i}},min:function(e,r){for(var n=1/0,i,a=this,s=0;s=0&&a"u"?"undefined":Oi(Symbol))!=e&&Oi(Symbol.iterator)!=e;r&&(U6[Symbol.iterator]=function(){var n=this,i={value:void 0,done:!1},a=0,s=this.length;return Sde({next:function(){return a1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],i=n.cy();if(i.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(r?i.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var n=r.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=this[0];if(n)return r.style().getRenderedStyle(n,e)},style:function(e,r){var n=this.cy();if(!n.styleEnabled())return this;var i=!1,a=n.style();if(Dr(e)){var s=e;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(Wt(e))if(r===void 0){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}else a.applyBypass(this,e,r,i),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?a.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var n=!1,i=r.style(),a=this;if(e===void 0)for(var s=0;s0&&e.push(h[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Ma.neighbourhood=Ma.neighborhood;Ma.closedNeighbourhood=Ma.closedNeighborhood;Ma.openNeighbourhood=Ma.openNeighborhood;Kt(Ma,{source:Qo(function(e){var r=this[0],n;return r&&(n=r._private.source||r.cy().collection()),n&&e?n.filter(e):n},"source"),target:Qo(function(e){var r=this[0],n;return r&&(n=r._private.target||r.cy().collection()),n&&e?n.filter(e):n},"target"),sources:Qfe({attr:"source"}),targets:Qfe({attr:"target"})});Kt(Ma,{edgesWith:Qo(Jfe(),"edgesWith"),edgesTo:Qo(Jfe({thisIsSrc:!0}),"edgesTo")});Kt(Ma,{connectedEdges:Qo(function(t){for(var e=[],r=this,n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Ma.componentsOf=Ma.components;xa=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){ni("A collection must have a reference to the core");return}var a=new Vc,s=!1;if(!r)r=[];else if(r.length>0&&Dr(r[0])&&!Px(r[0])){s=!0;for(var o=[],l=new Qm,u=0,h=r.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=r.cy(),i=n._private,a=[],s=[],o,l=0,u=r.length;l0){for(var P=o.length===r.length?r:new xa(n,o),$=0;$0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,n=[],i={},a=r._private.cy;function s(A){for(var D=A._private.edges,N=0;N0&&(t?R.emitAndNotify("remove"):e&&R.emit("remove"));for(var T=0;Th&&Math.abs(g.v)>h;);return d?function(m){return l[m*(l.length-1)|0]}:u}}(),_n=function(e,r,n,i){var a=Zqe(e,r,n,i);return function(s,o,l){return s+(o-s)*a(l)}},N6={linear:function(e,r,n){return e+(r-e)*n},ease:_n(.25,.1,.25,1),"ease-in":_n(.42,0,1,1),"ease-out":_n(0,0,.58,1),"ease-in-out":_n(.42,0,.58,1),"ease-in-sine":_n(.47,0,.745,.715),"ease-out-sine":_n(.39,.575,.565,1),"ease-in-out-sine":_n(.445,.05,.55,.95),"ease-in-quad":_n(.55,.085,.68,.53),"ease-out-quad":_n(.25,.46,.45,.94),"ease-in-out-quad":_n(.455,.03,.515,.955),"ease-in-cubic":_n(.55,.055,.675,.19),"ease-out-cubic":_n(.215,.61,.355,1),"ease-in-out-cubic":_n(.645,.045,.355,1),"ease-in-quart":_n(.895,.03,.685,.22),"ease-out-quart":_n(.165,.84,.44,1),"ease-in-out-quart":_n(.77,0,.175,1),"ease-in-quint":_n(.755,.05,.855,.06),"ease-out-quint":_n(.23,1,.32,1),"ease-in-out-quint":_n(.86,0,.07,1),"ease-in-expo":_n(.95,.05,.795,.035),"ease-out-expo":_n(.19,1,.22,1),"ease-in-out-expo":_n(1,0,0,1),"ease-in-circ":_n(.6,.04,.98,.335),"ease-out-circ":_n(.075,.82,.165,1),"ease-in-out-circ":_n(.785,.135,.15,.86),spring:function(e,r,n){if(n===0)return N6.linear;var i=Qqe(e,r,n);return function(a,s,o){return a+(s-a)*i(o)}},"cubic-bezier":_n};tYe={animate:Qr.animate(),animation:Qr.animation(),animated:Qr.animated(),clearQueue:Qr.clearQueue(),delay:Qr.delay(),delayAnimation:Qr.delayAnimation(),stop:Qr.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&B6(function(a){nde(a,e),r()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(a,s){nde(s,e)},n.beforeRenderPriorities.animations):r()}},rYe={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,n){var i=r.qualifier;return i!=null?e!==n.target&&Px(n.target)&&i.matches(n.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,n){return r.qualifier!=null?n.target:e}},E6=function(e){return Wt(e)?new kf(e):e},N0e={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new nE(rYe,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,n){return this.emitter().on(e,E6(r),n),this},removeListener:function(e,r,n){return this.emitter().removeListener(e,E6(r),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,n){return this.emitter().one(e,E6(r),n),this},once:function(e,r,n){return this.emitter().one(e,E6(r),n),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Qr.eventAliasesOn(N0e);vD={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};vD.jpeg=vD.jpg;I6={layout:function(e){var r=this;if(e==null){ni("Layout options must be specified to make a layout");return}if(e.name==null){ni("A `name` must be specified to make a layout");return}var n=e.name,i=r.extension("layout",n);if(i==null){ni("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;Wt(e.eles)?a=r.$(e.eles):a=e.eles!=null?e.eles:r.$();var s=new i(Kt({},e,{cy:r,eles:a}));return s}};I6.createLayout=I6.makeLayout=I6.layout;nYe={notify:function(e,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();r!=null&&i.merge(r);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var i=e.batchNotifications[n];i.empty()?r.notify(n):r.notify(n,i)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var n=Object.keys(e),i=0;i0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var i=n._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};yD.invalidateDimensions=yD.resize;M6={collection:function(e,r){return Wt(e)?this.$(e):co(e)?e.collection():vn(e)?(r||(r={}),new xa(this,e,r.unique,r.removed)):new xa(this)},nodes:function(e){var r=this.$(function(n){return n.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(n){return n.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};M6.elements=M6.filter=M6.$;Oa={},kx="t",aYe="f";Oa.apply=function(t){for(var e=this,r=e._private,n=r.cy,i=n.collection(),a=0;a0;if(d||f&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var m=0;m1&&(_=1),o.color){var E=n.valueMin[0],L=n.valueMax[0],S=n.valueMin[1],C=n.valueMax[1],M=n.valueMin[2],R=n.valueMax[2],T=n.valueMin[3]==null?1:n.valueMin[3],I=n.valueMax[3]==null?1:n.valueMax[3],A=[Math.round(E+(L-E)*_),Math.round(S+(C-S)*_),Math.round(M+(R-M)*_),Math.round(T+(I-T)*_)];a={bypass:n.bypass,name:n.name,value:A,strValue:"rgb("+A[0]+", "+A[1]+", "+A[2]+")"}}else if(o.number){var D=n.valueMin+(n.valueMax-n.valueMin)*_;a=this.parse(n.name,D,n.bypass,d)}else return!1;if(!a)return m(),!1;a.mapping=n,n=a;break}case s.data:{for(var N=n.field.split("."),O=f.data,B=0;B0&&a>0){for(var o={},l=!1,u=0;u0?t.delayAnimation(s).play().promise().then(w):w()}).then(function(){return t.animation({style:o,duration:a,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(t,i),t.emitAndNotify("style"),n.transitioning=!1)};Oa.checkTrigger=function(t,e,r,n,i,a){var s=this.properties[e],o=i(s);o!=null&&o(r,n)&&a(s)};Oa.checkZOrderTrigger=function(t,e,r,n){var i=this;this.checkTrigger(t,e,r,n,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",t)})};Oa.checkBoundsTrigger=function(t,e,r,n){this.checkTrigger(t,e,r,n,function(i){return i.triggersBounds},function(i){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||n==="bezier")&&t.parallelEdges().forEach(function(a){a.isBundledBezier()&&a.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||n==="none")&&t.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};Oa.checkTriggers=function(t,e,r,n){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,n),this.checkBoundsTrigger(t,e,r,n)};$x={};$x.applyBypass=function(t,e,r,n){var i=this,a=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;oi.length?n=n.substr(i.length):n=""}function l(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var u=n.match(/^\s*$/);if(u)break;var h=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!h){Jr("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}i=h[0];var f=h[1];if(f!=="core"){var d=new kf(f);if(d.invalid){Jr("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var p=h[2],g=!1;a=p;for(var m=[];;){var y=a.match(/^\s*$/);if(y)break;var x=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!x){Jr("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),g=!0;break}s=x[0];var b=x[1],w=x[2],_=e.properties[b];if(!_){Jr("Skipping property: Invalid property name in: "+s),l();continue}var k=r.parse(b,w);if(!k){Jr("Skipping property: Invalid property definition in: "+s),l();continue}m.push({name:b,val:w}),l()}if(g){o();break}r.selector(f);for(var E=0;E=7&&e[0]==="d"&&(h=new RegExp(o.data.regex).exec(e))){if(r)return!1;var d=o.data;return{name:t,value:h,strValue:""+e,mapped:d,field:h[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var p=o.mapData;if(!(u.color||u.number))return!1;var g=this.parse(t,f[4]);if(!g||g.mapped)return!1;var m=this.parse(t,f[5]);if(!m||m.mapped)return!1;if(g.pfValue===m.pfValue||g.strValue===m.strValue)return Jr("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+g.strValue+"`"),this.parse(t,g.strValue);if(u.color){var y=g.value,x=m.value,b=y[0]===x[0]&&y[1]===x[1]&&y[2]===x[2]&&(y[3]===x[3]||(y[3]==null||y[3]===1)&&(x[3]==null||x[3]===1));if(b)return!1}return{name:t,value:f,strValue:""+e,mapped:p,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:g.value,valueMax:m.value,bypass:r}}}if(u.multiple&&n!=="multiple"){var w;if(l?w=e.split(/\s+/):vn(e)?w=e:w=[e],u.evenMultiple&&w.length%2!==0)return null;for(var _=[],k=[],E=[],L="",S=!1,C=0;C0?" ":"")+M.strValue}return u.validate&&!u.validate(_,k)?null:u.singleEnum&&S?_.length===1&&Wt(_[0])?{name:t,value:_[0],strValue:_[0],bypass:r}:null:{name:t,value:_,pfValue:E,strValue:L,bypass:r,units:k}}var R=function(){for(var W=0;Wu.max||u.strictMax&&e===u.max))return null;var N={name:t,value:e,strValue:""+e+(T||""),units:T,bypass:r};return u.unitless||T!=="px"&&T!=="em"?N.pfValue=e:N.pfValue=T==="px"||!T?e:this.getEmSizeInPixels()*e,(T==="ms"||T==="s")&&(N.pfValue=T==="ms"?e:1e3*e),(T==="deg"||T==="rad")&&(N.pfValue=T==="rad"?e:$Ue(e)),T==="%"&&(N.pfValue=e/100),N}else if(u.propList){var O=[],B=""+e;if(B!=="none"){for(var P=B.split(/\s*,\s*|\s+/),$=0;$0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((s-2*r)/n.w,(o-2*r)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=n.minZoom&&(n.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,n=r.pan,i=r.zoom,a,s,o=!1;if(r.zoomingEnabled||(o=!0),dt(e)?s=e:Dr(e)&&(s=e.level,e.position!=null?a=Z6(e.position,i,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,a.push("zoom"))}if(i&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;dt(u.x)&&(r.pan.x=u.x,o=!1),dt(u.y)&&(r.pan.y=u.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Wt(e)){var n=e;e=this.mutableElements().filter(n)}else co(e)||(e=this.mutableElements());if(e.length!==0){var i=e.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(a-r*(i.x1+i.x2))/2,y:(s-r*(i.y1+i.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,n=this;return e.sizeCache=e.sizeCache||(r?function(){var i=n.window().getComputedStyle(r),a=function(o){return parseFloat(i.getPropertyValue(o))};return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,n=this.renderedExtent(),i={x1:(n.x1-e.x)/r,x2:(n.x2-e.x)/r,y1:(n.y1-e.y)/r,y2:(n.y2-e.y)/r};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};B0.centre=B0.center;B0.autolockNodes=B0.autolock;B0.autoungrabifyNodes=B0.autoungrabify;Mx={data:Qr.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Qr.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Qr.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Qr.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Mx.attr=Mx.data;Mx.removeAttr=Mx.removeData;Dx=function(e){var r=this;e=Kt({},e);var n=e.container;n&&!P6(n)&&P6(n[0])&&(n=n[0]);var i=n?n._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];n&&(n._cyreg=i),i.cy=r;var s=Mi!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=Kt({name:s?"grid":"null"},o.layout),o.renderer=Kt({name:s?"canvas":"null"},o.renderer);var l=function(g,m,y){return m!==void 0?m:y!==void 0?y:g},u=this._private={container:n,ready:!1,options:o,elements:new xa(this),listeners:[],aniEles:new xa(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:dt(o.zoom)?o.zoom:1,pan:{x:Dr(o.pan)&&dt(o.pan.x)?o.pan.x:0,y:Dr(o.pan)&&dt(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var h=function(g,m){var y=g.some(uGe);if(y)return Jm.all(g).then(m);m(g)};u.styleEnabled&&r.setStyle([]);var f=Kt({},o,o.renderer);r.initRenderer(f);var d=function(g,m,y){r.notifications(!1);var x=r.mutableElements();x.length>0&&x.remove(),g!=null&&(Dr(g)||vn(g))&&r.add(g),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",m),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var b=Kt({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};h([o.style,o.elements],function(p){var g=p[0],m=p[1];u.styleEnabled&&r.style().append(g),d(m,function(){r.startAnimationLoop(),u.ready=!0,jn(o.ready)&&r.on("ready",o.ready);for(var y=0;y0,l=Fs(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(co(e.roots))u=e.roots;else if(vn(e.roots)){for(var h=[],f=0;f0;){var D=A(),N=M(D,T);if(N)D.outgoers().filter(function(ue){return ue.isNode()&&n.has(ue)}).forEach(I);else if(N===null){Jr("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var O=0;if(e.avoidOverlap)for(var B=0;B0&&x[0].length<=3?De/2:0),Pe=2*Math.PI/x[ae].length*we;return ae===0&&x[0].length===1&&(Re=1),{x:Z.x+Re*Math.cos(Pe),y:Z.y+Re*Math.sin(Pe)}}else{var We={x:Z.x+(we+1-(Ie+1)/2)*Ee,y:(ae+1)*Oe};return We}};return n.nodes().layoutPositions(this,e,ce),this};uYe={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};M0e.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=n.nodes().not(":parent");e.sort&&(a=a.sort(e.sort));for(var s=Fs(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/a.length:e.sweep,u=l/Math.max(1,a.length-1),h,f=0,d=0;d1&&e.avoidOverlap){f*=1.75;var x=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),w=Math.sqrt(f*f/(x*x+b*b));h=Math.max(w,h)}var _=function(E,L){var S=e.startAngle+L*u*(i?1:-1),C=h*Math.cos(S),M=h*Math.sin(S),R={x:o.x+C,y:o.y+M};return R};return n.nodes().layoutPositions(this,e,_),this};hYe={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};D0e.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,n=t.cy,i=e.eles,a=i.nodes().not(":parent"),s=Fs(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,h=0;h0){var k=Math.abs(b[0].value-_.value);k>=y&&(b=[],x.push(b))}b.push(_)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var L=x.length>0&&x[0].length>1,S=Math.min(s.w,s.h)/2-E,C=S/(x.length+L?1:0);E=Math.min(E,C)}for(var M=0,R=0;R1&&e.avoidOverlap){var D=Math.cos(A)-Math.cos(0),N=Math.sin(A)-Math.sin(0),O=Math.sqrt(E*E/(D*D+N*N));M=Math.max(O,M)}T.r=M,M+=E}if(e.equidistant){for(var B=0,P=0,$=0;$=t.numIter||(xYe(n,t),n.temperature=n.temperature*t.coolingFactor,n.temperature=t.animationThreshold&&a(),B6(f)}};h()}else{for(;u;)u=s(l),l++;sde(n,t),o()}return this};lE.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};lE.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};dYe=function(e,r,n){for(var i=n.eles.edges(),a=n.eles.nodes(),s=Fs(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=n.eles.components(),u={},h=0;h0){o.graphSet.push(S);for(var h=0;hi.count?0:i.graph},gYe=function t(e,r,n,i){var a=i.graphSet[n];if(-10)var f=i.nodeOverlap*h,d=Math.sqrt(o*o+l*l),p=f*o/d,g=f*l/d;else var m=W6(e,o,l),y=W6(r,-1*o,-1*l),x=y.x-m.x,b=y.y-m.y,w=x*x+b*b,d=Math.sqrt(w),f=(e.nodeRepulsion+r.nodeRepulsion)/w,p=f*x/d,g=f*b/d;e.isLocked||(e.offsetX-=p,e.offsetY-=g),r.isLocked||(r.offsetX+=p,r.offsetY+=g)}},kYe=function(e,r,n,i){if(n>0)var a=e.maxX-r.minX;else var a=r.maxX-e.minX;if(i>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},W6=function(e,r,n){var i=e.positionX,a=e.positionY,s=e.height||1,o=e.width||1,l=n/r,u=s/o,h={};return r===0&&0n?(h.x=i,h.y=a+s/2,h):0r&&-1*u<=l&&l<=u?(h.x=i-o/2,h.y=a-o*n/2/r,h):0=u)?(h.x=i+s*r/2/n,h.y=a+s/2,h):(0>n&&(l<=-1*u||l>=u)&&(h.x=i-s*r/2/n,h.y=a-s/2),h)},TYe=function(e,r){for(var n=0;nn){var y=r.gravity*p/m,x=r.gravity*g/m;d.offsetX+=y,d.offsetY+=x}}}}},SYe=function(e,r){var n=[],i=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;i<=a;){var s=n[i++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0n)var a={x:n*e/i,y:n*r/i};else var a={x:e,y:r};return a},_Ye=function t(e,r){var n=e.parentId;if(n!=null){var i=r.layoutNodes[r.idToIndex[n]],a=!1;if((i.maxX==null||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,a=!0),(i.minX==null||e.minX-i.padLefti.maxY)&&(i.maxY=e.maxY+i.padBottom,a=!0),(i.minY==null||e.minY-i.padTopx&&(g+=y+r.componentSpacing,p=0,m=0,y=0)}}},LYe={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};P0e.prototype.run=function(){var t=this.options,e=t,r=t.cy,n=e.eles,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));var a=Fs(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)n.nodes().layoutPositions(this,e,function(J){return{x:a.x1,y:a.y1}});else{var s=i.size(),o=Math.sqrt(s*a.h/a.w),l=Math.round(o),u=Math.round(a.w/a.h*o),h=function(X){if(X==null)return Math.min(l,u);var oe=Math.min(l,u);oe==l?l=X:u=X},f=function(X){if(X==null)return Math.max(l,u);var oe=Math.max(l,u);oe==l?l=X:u=X},d=e.rows,p=e.cols!=null?e.cols:e.columns;if(d!=null&&p!=null)l=d,u=p;else if(d!=null&&p==null)l=d,u=Math.ceil(s/l);else if(d==null&&p!=null)u=p,l=Math.ceil(s/u);else if(u*l>s){var g=h(),m=f();(g-1)*m>=s?h(g-1):(m-1)*g>=s&&f(m-1)}else for(;u*l=s?f(x+1):h(y+1)}var b=a.w/u,w=a.h/l;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var _=0;_=u&&(D=0,A++)},O={},B=0;B(D=JUe(t,e,N[O],N[O+1],N[O+2],N[O+3])))return y(L,D),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var N=C.allpts,O=0;O+5(D=QUe(t,e,N[O],N[O+1],N[O+2],N[O+3],N[O+4],N[O+5])))return y(L,D),!0}for(var B=B||S.source,P=P||S.target,$=i.getArrowWidth(M,R),z=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],O=0;O0&&(x(B),x(P))}function w(L,S,C){return Bl(L,S,C)}function _(L,S){var C=L._private,M=d,R;S?R=S+"-":R="",L.boundingBox();var T=C.labelBounds[S||"main"],I=L.pstyle(R+"label").value,A=L.pstyle("text-events").strValue==="yes";if(!(!A||!I)){var D=w(C.rscratch,"labelX",S),N=w(C.rscratch,"labelY",S),O=w(C.rscratch,"labelAngle",S),B=L.pstyle(R+"text-margin-x").pfValue,P=L.pstyle(R+"text-margin-y").pfValue,$=T.x1-M-B,z=T.x2+M-B,H=T.y1-M-P,J=T.y2+M-P;if(O){var X=Math.cos(O),oe=Math.sin(O),K=function(ce,ue){return ce=ce-D,ue=ue-N,{x:ce*X-ue*oe+D,y:ce*oe+ue*X+N}},ee=K($,H),Q=K($,J),W=K(z,H),Y=K(z,J),Z=[ee.x+B,ee.y+P,W.x+B,W.y+P,Y.x+B,Y.y+P,Q.x+B,Q.y+P];if(Bs(t,e,Z))return y(L),!0}else if(jm(T,t,e))return y(L),!0}}for(var k=s.length-1;k>=0;k--){var E=s[k];E.isNode()?x(E)||_(E):b(E)||_(E)||_(E,"source")||_(E,"target")}return o};z0.getAllInBox=function(t,e,r,n){var i=this.getCachedZSortedEles().interactive,a=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,n),u=Math.max(e,n);t=s,r=o,e=l,n=u;for(var h=Fs({x1:t,y1:e,x2:r,y2:n}),f=0;f0?-(Math.PI-e.ang):Math.PI+e.ang},OYe=function(e,r,n,i,a){if(e!==hde?fde(r,e,Gc):DYe(Ko,Gc),fde(r,n,Ko),cde=Gc.nx*Ko.ny-Gc.ny*Ko.nx,ude=Gc.nx*Ko.nx-Gc.ny*-Ko.ny,Zu=Math.asin(Math.max(-1,Math.min(1,cde))),Math.abs(Zu)<1e-6){xD=r.x,bD=r.y,L0=$m=0;return}R0=1,D6=!1,ude<0?Zu<0?Zu=Math.PI+Zu:(Zu=Math.PI-Zu,R0=-1,D6=!0):Zu>0&&(R0=-1,D6=!0),r.radius!==void 0?$m=r.radius:$m=i,S0=Zu/2,S6=Math.min(Gc.len/2,Ko.len/2),a?($c=Math.abs(Math.cos(S0)*$m/Math.sin(S0)),$c>S6?($c=S6,L0=Math.abs($c*Math.sin(S0)/Math.cos(S0))):L0=$m):($c=Math.min(S6,$m),L0=Math.abs($c*Math.sin(S0)/Math.cos(S0))),wD=r.x+Ko.nx*$c,kD=r.y+Ko.ny*$c,xD=wD-Ko.ny*L0*R0,bD=kD+Ko.nx*L0*R0,$0e=r.x+Gc.nx*$c,G0e=r.y+Gc.ny*$c,hde=r};Pa={};Pa.findMidptPtsEtc=function(t,e){var r=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,a,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(k,E,L,S){var C=S-E,M=L-k,R=Math.sqrt(M*M+C*C);return{x:-C/R,y:M/R}},h=t.pstyle("edge-distances").value;switch(h){case"node-position":a=r;break;case"intersection":a=n;break;case"endpoints":{if(l){var f=this.manualEndptToPx(t.source()[0],s),d=Ol(f,2),p=d[0],g=d[1],m=this.manualEndptToPx(t.target()[0],o),y=Ol(m,2),x=y[0],b=y[1],w={x1:p,y1:g,x2:x,y2:b};i=u(p,g,x,b),a=w}else Jr("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),a=n;break}}return{midptPts:a,vectorNormInverse:i}};Pa.findHaystackPoints=function(t){for(var e=0;e0?Math.max(j-ye,0):Math.min(j+ye,0)},I=T(M,S),A=T(R,C),D=!1;b===u?x=Math.abs(I)>Math.abs(A)?i:n:b===l||b===o?(x=n,D=!0):(b===a||b===s)&&(x=i,D=!0);var N=x===n,O=N?A:I,B=N?R:M,P=qde(B),$=!1;!(D&&(_||E))&&(b===o&&B<0||b===l&&B>0||b===a&&B>0||b===s&&B<0)&&(P*=-1,O=P*Math.abs(O),$=!0);var z;if(_){var H=k<0?1+k:k;z=H*O}else{var J=k<0?O:0;z=J+k*P}var X=function(j){return Math.abs(j)=Math.abs(O)},oe=X(z),K=X(Math.abs(O)-Math.abs(z)),ee=oe||K;if(ee&&!$)if(N){var Q=Math.abs(B)<=d/2,W=Math.abs(M)<=p/2;if(Q){var Y=(h.x1+h.x2)/2,Z=h.y1,se=h.y2;r.segpts=[Y,Z,Y,se]}else if(W){var ce=(h.y1+h.y2)/2,ue=h.x1,te=h.x2;r.segpts=[ue,ce,te,ce]}else r.segpts=[h.x1,h.y2]}else{var Ne=Math.abs(B)<=f/2,ae=Math.abs(R)<=g/2;if(Ne){var we=(h.y1+h.y2)/2,Ie=h.x1,Ee=h.x2;r.segpts=[Ie,we,Ee,we]}else if(ae){var Oe=(h.x1+h.x2)/2,De=h.y1,We=h.y2;r.segpts=[Oe,De,Oe,We]}else r.segpts=[h.x2,h.y1]}else if(N){var Re=h.y1+z+(y?d/2*P:0),Pe=h.x1,xe=h.x2;r.segpts=[Pe,Re,xe,Re]}else{var q=h.x1+z+(y?f/2*P:0),de=h.y1,ie=h.y2;r.segpts=[q,de,q,ie]}if(r.isRound){var he=t.pstyle("taxi-radius").value,U=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(he),r.isArcRadius=new Array(r.segpts.length/2).fill(U)}};Pa.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var n=e.srcPos,i=e.tgtPos,a=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,h=e.tgtShape,f=e.srcCornerRadius,d=e.tgtCornerRadius,p=e.srcRs,g=e.tgtRs,m=!dt(r.startX)||!dt(r.startY),y=!dt(r.arrowStartX)||!dt(r.arrowStartY),x=!dt(r.endX)||!dt(r.endY),b=!dt(r.arrowEndX)||!dt(r.arrowEndY),w=3,_=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,k=w*_,E=D0({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),L=EA.poolIndex()){var D=I;I=A,A=D}var N=C.srcPos=I.position(),O=C.tgtPos=A.position(),B=C.srcW=I.outerWidth(),P=C.srcH=I.outerHeight(),$=C.tgtW=A.outerWidth(),z=C.tgtH=A.outerHeight(),H=C.srcShape=r.nodeShapes[e.getNodeShape(I)],J=C.tgtShape=r.nodeShapes[e.getNodeShape(A)],X=C.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,oe=C.tgtCornerRadius=A.pstyle("corner-radius").value==="auto"?"auto":A.pstyle("corner-radius").pfValue,K=C.tgtRs=A._private.rscratch,ee=C.srcRs=I._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Q=0;Q0){var se=a,ce=A0(se,Um(r)),ue=A0(se,Um(Z)),te=ce;if(ue2){var Ne=A0(se,{x:Z[2],y:Z[3]});Ne0){var ie=s,he=A0(ie,Um(r)),U=A0(ie,Um(de)),ke=he;if(U2){var j=A0(ie,{x:de[2],y:de[3]});j=g||L){y={cp:_,segment:E};break}}if(y)break}var S=y.cp,C=y.segment,M=(g-x)/C.length,R=C.t1-C.t0,T=p?C.t0+R*M:C.t1-R*M;T=_x(0,T,1),e=Wm(S.p0,S.p1,S.p2,T),d=BYe(S.p0,S.p1,S.p2,T);break}case"straight":case"segments":case"haystack":{for(var I=0,A,D,N,O,B=n.allpts.length,P=0;P+3=g));P+=2);var $=g-D,z=$/A;z=_x(0,z,1),e=UUe(N,O,z),d=H0e(N,O);break}}s("labelX",f,e.x),s("labelY",f,e.y),s("labelAutoAngle",f,d)}};u("source"),u("target"),this.applyLabelDimensions(t)}};Hc.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Hc.applyPrefixedLabelDimensions=function(t,e){var r=t._private,n=this.getLabelText(t,e),i=this.calculateLabelDimensions(t,n),a=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=Bl(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=i.height/l,h=u*a,f=i.width,d=i.height+(l-1)*(a-1)*u;mf(r.rstyle,"labelWidth",e,f),mf(r.rscratch,"labelWidth",e,f),mf(r.rstyle,"labelHeight",e,d),mf(r.rscratch,"labelHeight",e,d),mf(r.rscratch,"labelLineHeight",e,h)};Hc.getLabelText=function(t,e){var r=t._private,n=e?e+"-":"",i=t.pstyle(n+"label").strValue,a=t.pstyle("text-transform").value,s=function(J,X){return X?(mf(r.rscratch,J,e,X),X):Bl(r.rscratch,J,e)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",h=i.split(` `),f=t.pstyle("text-max-width").pfValue,d=t.pstyle("text-overflow-wrap").value,p=d==="anywhere",g=[],m=/[\s\u200b]+|$/g,y=0;yf){var k=x.matchAll(m),E="",L=0,S=Ade(k),C;try{for(S.s();!(C=S.n()).done;){var M=C.value,R=M[0],T=x.substring(L,M.index);L=M.index+R.length;var I=E.length===0?T:E+T+R,A=this.calculateLabelDimensions(t,I),D=A.width;D<=f?E+=T+R:(E&&g.push(E),E=T+R)}}catch(H){S.e(H)}finally{S.f()}E.match(/^[\s\u200b]+$/)||g.push(E)}else g.push(x)}s("labelWrapCachedLines",g),i=s("labelWrapCachedText",g.join(` `)),s("labelWrapKey",l)}else if(o==="ellipsis"){var N=t.pstyle("text-max-width").pfValue,O="",B="\u2026",P=!1;if(this.calculateLabelDimensions(t,i).widthN)break;O+=i[$],$===i.length-1&&(P=!0)}return P||(O+=B),O}return i};Hc.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Hc.calculateLabelDimensions=function(t,e){var r=this,n=r.cy.window(),i=n.document,a=M0(e,t._private.labelDimsKey),s=r.labelDimCache||(r.labelDimCache=[]),o=s[a];if(o!=null)return o;var l=0,u=t.pstyle("font-style").strValue,h=t.pstyle("font-size").pfValue,f=t.pstyle("font-family").strValue,d=t.pstyle("font-weight").strValue,p=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!p){p=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=p.getContext("2d");var m=p.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}g.font="".concat(u," ").concat(d," ").concat(h,"px ").concat(f);for(var y=0,x=0,b=e.split(` `),w=0;w1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l=t.desktopTapThreshold2}var Ke=a(q);lt&&(t.hoverData.tapholdCancelled=!0);var it=function(){var Qt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Qt.length===0?(Qt.push(Ce[0]),Qt.push(Ce[1])):(Qt[0]+=Ce[0],Qt[1]+=Ce[1])};ie=!0,i(Fe,["mousemove","vmousemove","tapdrag"],q,{x:j[0],y:j[1]});var mt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||he.emit({originalEvent:q,type:"boxstart",position:{x:j[0],y:j[1]}}),Ge[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(lt){var Ht={originalEvent:q,type:"cxtdrag",position:{x:j[0],y:j[1]}};$e?$e.emit(Ht):he.emit(Ht),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Fe!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:q,type:"cxtdragout",position:{x:j[0],y:j[1]}}),t.hoverData.cxtOver=Fe,Fe&&Fe.emit({originalEvent:q,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}}else if(t.hoverData.dragging){if(ie=!0,he.panningEnabled()&&he.userPanningEnabled()){var ot;if(t.hoverData.justStartedPan){var et=t.hoverData.mdownPos;ot={x:(j[0]-et[0])*U,y:(j[1]-et[1])*U},t.hoverData.justStartedPan=!1}else ot={x:Ce[0]*U,y:Ce[1]*U};he.panBy(ot),he.emit("dragpan"),t.hoverData.dragged=!0}j=t.projectIntoViewport(q.clientX,q.clientY)}else if(Ge[4]==1&&($e==null||$e.pannable())){if(lt){if(!t.hoverData.dragging&&he.boxSelectionEnabled()&&(Ke||!he.panningEnabled()||!he.userPanningEnabled()))mt();else if(!t.hoverData.selecting&&he.panningEnabled()&&he.userPanningEnabled()){var ht=s($e,t.hoverData.downs);ht&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ge[4]=0,t.data.bgActivePosistion=Um(ye),t.redrawHint("select",!0),t.redraw())}$e&&$e.pannable()&&$e.active()&&$e.unactivate()}}else{if($e&&$e.pannable()&&$e.active()&&$e.unactivate(),(!$e||!$e.grabbed())&&Fe!=ge&&(ge&&i(ge,["mouseout","tapdragout"],q,{x:j[0],y:j[1]}),Fe&&i(Fe,["mouseover","tapdragover"],q,{x:j[0],y:j[1]}),t.hoverData.last=Fe),$e)if(lt){if(he.boxSelectionEnabled()&&Ke)$e&&$e.grabbed()&&(x(qe),$e.emit("freeon"),qe.emit("free"),t.dragData.didDrag&&($e.emit("dragfreeon"),qe.emit("dragfree"))),mt();else if($e&&$e.grabbed()&&t.nodeIsDraggable($e)){var bt=!t.dragData.didDrag;bt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||m(qe,{inDragLayer:!0});var tt={x:0,y:0};if(dt(Ce[0])&&dt(Ce[1])&&(tt.x+=Ce[0],tt.y+=Ce[1],bt)){var _t=t.hoverData.dragDelta;_t&&dt(_t[0])&&dt(_t[1])&&(tt.x+=_t[0],tt.y+=_t[1])}t.hoverData.draggingEles=!0,qe.silentShift(tt).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else it();ie=!0}if(Ge[2]=j[0],Ge[3]=j[1],ie)return q.stopPropagation&&q.stopPropagation(),q.preventDefault&&q.preventDefault(),!1}},!1);var T,I,A;t.registerBinding(e,"mouseup",function(q){if(!(t.hoverData.which===1&&q.which!==1&&t.hoverData.capture)){var de=t.hoverData.capture;if(de){t.hoverData.capture=!1;var ie=t.cy,he=t.projectIntoViewport(q.clientX,q.clientY),U=t.selection,ke=t.findNearestElement(he[0],he[1],!0,!1),j=t.dragData.possibleDragElements,ye=t.hoverData.down,Ae=a(q);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ye&&ye.unactivate(),t.hoverData.which===3){var Ge={originalEvent:q,type:"cxttapend",position:{x:he[0],y:he[1]}};if(ye?ye.emit(Ge):ie.emit(Ge),!t.hoverData.cxtDragged){var Fe={originalEvent:q,type:"cxttap",position:{x:he[0],y:he[1]}};ye?ye.emit(Fe):ie.emit(Fe)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(i(ke,["mouseup","tapend","vmouseup"],q,{x:he[0],y:he[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(i(ye,["click","tap","vclick"],q,{x:he[0],y:he[1]}),I=!1,q.timeStamp-A<=ie.multiClickDebounceTime()?(T&&clearTimeout(T),I=!0,A=null,i(ye,["dblclick","dbltap","vdblclick"],q,{x:he[0],y:he[1]})):(T=setTimeout(function(){I||i(ye,["oneclick","onetap","voneclick"],q,{x:he[0],y:he[1]})},ie.multiClickDebounceTime()),A=q.timeStamp)),ye==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(q)&&(ie.$(r).unselect(["tapunselect"]),j.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=j=ie.collection()),ke==ye&&!t.dragData.didDrag&&!t.hoverData.selecting&&ke!=null&&ke._private.selectable&&(t.hoverData.dragging||(ie.selectionType()==="additive"||Ae?ke.selected()?ke.unselect(["tapunselect"]):ke.select(["tapselect"]):Ae||(ie.$(r).unmerge(ke).unselect(["tapunselect"]),ke.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ge=ie.collection(t.getAllInBox(U[0],U[1],U[2],U[3]));t.redrawHint("select",!0),ge.length>0&&t.redrawHint("eles",!0),ie.emit({type:"boxend",originalEvent:q,position:{x:he[0],y:he[1]}});var $e=function(lt){return lt.selectable()&&!lt.selected()};ie.selectionType()==="additive"||Ae||ie.$(r).unmerge(ge).unselect(),ge.emit("box").stdFilter($e).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!U[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Ce=ye&&ye.grabbed();x(j),Ce&&(ye.emit("freeon"),j.emit("free"),t.dragData.didDrag&&(ye.emit("dragfreeon"),j.emit("dragfree")))}}U[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var D=function(q){if(!t.scrollingPage){var de=t.cy,ie=de.zoom(),he=de.pan(),U=t.projectIntoViewport(q.clientX,q.clientY),ke=[U[0]*ie+he.x,U[1]*ie+he.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||C()){q.preventDefault();return}if(de.panningEnabled()&&de.userPanningEnabled()&&de.zoomingEnabled()&&de.userZoomingEnabled()){q.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var j;q.deltaY!=null?j=q.deltaY/-250:q.wheelDeltaY!=null?j=q.wheelDeltaY/1e3:j=q.wheelDelta/1e3,j=j*t.wheelSensitivity;var ye=q.deltaMode===1;ye&&(j*=33);var Ae=de.zoom()*Math.pow(10,j);q.type==="gesturechange"&&(Ae=t.gestureStartZoom*q.scale),de.zoom({level:Ae,renderedPosition:{x:ke[0],y:ke[1]}}),de.emit(q.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",D,!0),t.registerBinding(e,"scroll",function(q){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(q){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||q.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(xe){t.hasTouchStarted||D(xe)},!0),t.registerBinding(t.container,"mouseout",function(q){var de=t.projectIntoViewport(q.clientX,q.clientY);t.cy.emit({originalEvent:q,type:"mouseout",position:{x:de[0],y:de[1]}})},!1),t.registerBinding(t.container,"mouseover",function(q){var de=t.projectIntoViewport(q.clientX,q.clientY);t.cy.emit({originalEvent:q,type:"mouseover",position:{x:de[0],y:de[1]}})},!1);var N,O,B,P,$,z,H,J,X,oe,K,ee,Q,W=function(q,de,ie,he){return Math.sqrt((ie-q)*(ie-q)+(he-de)*(he-de))},Y=function(q,de,ie,he){return(ie-q)*(ie-q)+(he-de)*(he-de)},Z;t.registerBinding(t.container,"touchstart",Z=function(q){if(t.hasTouchStarted=!0,!!M(q)){w(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var de=t.cy,ie=t.touchData.now,he=t.touchData.earlier;if(q.touches[0]){var U=t.projectIntoViewport(q.touches[0].clientX,q.touches[0].clientY);ie[0]=U[0],ie[1]=U[1]}if(q.touches[1]){var U=t.projectIntoViewport(q.touches[1].clientX,q.touches[1].clientY);ie[2]=U[0],ie[3]=U[1]}if(q.touches[2]){var U=t.projectIntoViewport(q.touches[2].clientX,q.touches[2].clientY);ie[4]=U[0],ie[5]=U[1]}if(q.touches[1]){t.touchData.singleTouchMoved=!0,x(t.dragData.touchDragEles);var ke=t.findContainerClientCoords();X=ke[0],oe=ke[1],K=ke[2],ee=ke[3],N=q.touches[0].clientX-X,O=q.touches[0].clientY-oe,B=q.touches[1].clientX-X,P=q.touches[1].clientY-oe,Q=0<=N&&N<=K&&0<=B&&B<=K&&0<=O&&O<=ee&&0<=P&&P<=ee;var j=de.pan(),ye=de.zoom();$=W(N,O,B,P),z=Y(N,O,B,P),H=[(N+B)/2,(O+P)/2],J=[(H[0]-j.x)/ye,(H[1]-j.y)/ye];var Ae=200,Ge=Ae*Ae;if(z=1){for(var ft=t.touchData.startPosition=[null,null,null,null,null,null],Ze=0;Ze=t.touchTapThreshold2}if(de&&t.touchData.cxt){q.preventDefault();var ft=q.touches[0].clientX-X,Ze=q.touches[0].clientY-oe,st=q.touches[1].clientX-X,Ue=q.touches[1].clientY-oe,Ke=Y(ft,Ze,st,Ue),it=Ke/z,mt=150,Ht=mt*mt,ot=1.5,et=ot*ot;if(it>=et||Ke>=Ht){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ht={originalEvent:q,type:"cxttapend",position:{x:U[0],y:U[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(ht),t.touchData.start=null):he.emit(ht)}}if(de&&t.touchData.cxt){var ht={originalEvent:q,type:"cxtdrag",position:{x:U[0],y:U[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(ht):he.emit(ht),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var bt=t.findNearestElement(U[0],U[1],!0,!0);(!t.touchData.cxtOver||bt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:q,type:"cxtdragout",position:{x:U[0],y:U[1]}}),t.touchData.cxtOver=bt,bt&&bt.emit({originalEvent:q,type:"cxtdragover",position:{x:U[0],y:U[1]}}))}else if(de&&q.touches[2]&&he.boxSelectionEnabled())q.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||he.emit({originalEvent:q,type:"boxstart",position:{x:U[0],y:U[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,ie[4]=1,!ie||ie.length===0||ie[0]===void 0?(ie[0]=(U[0]+U[2]+U[4])/3,ie[1]=(U[1]+U[3]+U[5])/3,ie[2]=(U[0]+U[2]+U[4])/3+1,ie[3]=(U[1]+U[3]+U[5])/3+1):(ie[2]=(U[0]+U[2]+U[4])/3,ie[3]=(U[1]+U[3]+U[5])/3),t.redrawHint("select",!0),t.redraw();else if(de&&q.touches[1]&&!t.touchData.didSelect&&he.zoomingEnabled()&&he.panningEnabled()&&he.userZoomingEnabled()&&he.userPanningEnabled()){q.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var tt=t.dragData.touchDragEles;if(tt){t.redrawHint("drag",!0);for(var _t=0;_t0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var ce;t.registerBinding(e,"touchcancel",ce=function(q){var de=t.touchData.start;t.touchData.capture=!1,de&&de.unactivate()});var ue,te,Ne,ae;if(t.registerBinding(e,"touchend",ue=function(q){var de=t.touchData.start,ie=t.touchData.capture;if(ie)q.touches.length===0&&(t.touchData.capture=!1),q.preventDefault();else return;var he=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var U=t.cy,ke=U.zoom(),j=t.touchData.now,ye=t.touchData.earlier;if(q.touches[0]){var Ae=t.projectIntoViewport(q.touches[0].clientX,q.touches[0].clientY);j[0]=Ae[0],j[1]=Ae[1]}if(q.touches[1]){var Ae=t.projectIntoViewport(q.touches[1].clientX,q.touches[1].clientY);j[2]=Ae[0],j[3]=Ae[1]}if(q.touches[2]){var Ae=t.projectIntoViewport(q.touches[2].clientX,q.touches[2].clientY);j[4]=Ae[0],j[5]=Ae[1]}de&&de.unactivate();var Ge;if(t.touchData.cxt){if(Ge={originalEvent:q,type:"cxttapend",position:{x:j[0],y:j[1]}},de?de.emit(Ge):U.emit(Ge),!t.touchData.cxtDragged){var Fe={originalEvent:q,type:"cxttap",position:{x:j[0],y:j[1]}};de?de.emit(Fe):U.emit(Fe)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!q.touches[2]&&U.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ge=U.collection(t.getAllInBox(he[0],he[1],he[2],he[3]));he[0]=void 0,he[1]=void 0,he[2]=void 0,he[3]=void 0,he[4]=0,t.redrawHint("select",!0),U.emit({type:"boxend",originalEvent:q,position:{x:j[0],y:j[1]}});var $e=function(Ht){return Ht.selectable()&&!Ht.selected()};ge.emit("box").stdFilter($e).select().emit("boxselect"),ge.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(de?.unactivate(),q.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!q.touches[1]){if(!q.touches[0]){if(!q.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ce=t.dragData.touchDragEles;if(de!=null){var qe=de._private.grabbed;x(Ce),t.redrawHint("drag",!0),t.redrawHint("eles",!0),qe&&(de.emit("freeon"),Ce.emit("free"),t.dragData.didDrag&&(de.emit("dragfreeon"),Ce.emit("dragfree"))),i(de,["touchend","tapend","vmouseup","tapdragout"],q,{x:j[0],y:j[1]}),de.unactivate(),t.touchData.start=null}else{var lt=t.findNearestElement(j[0],j[1],!0,!0);i(lt,["touchend","tapend","vmouseup","tapdragout"],q,{x:j[0],y:j[1]})}var xt=t.touchData.startPosition[0]-j[0],ft=xt*xt,Ze=t.touchData.startPosition[1]-j[1],st=Ze*Ze,Ue=ft+st,Ke=Ue*ke*ke;t.touchData.singleTouchMoved||(de||U.$(":selected").unselect(["tapunselect"]),i(de,["tap","vclick"],q,{x:j[0],y:j[1]}),te=!1,q.timeStamp-ae<=U.multiClickDebounceTime()?(Ne&&clearTimeout(Ne),te=!0,ae=null,i(de,["dbltap","vdblclick"],q,{x:j[0],y:j[1]})):(Ne=setTimeout(function(){te||i(de,["onetap","voneclick"],q,{x:j[0],y:j[1]})},U.multiClickDebounceTime()),ae=q.timeStamp)),de!=null&&!t.dragData.didDrag&&de._private.selectable&&Ke"u"){var we=[],Ie=function(q){return{clientX:q.clientX,clientY:q.clientY,force:1,identifier:q.pointerId,pageX:q.pageX,pageY:q.pageY,radiusX:q.width/2,radiusY:q.height/2,screenX:q.screenX,screenY:q.screenY,target:q.target}},Ee=function(q){return{event:q,touch:Ie(q)}},Oe=function(q){we.push(Ee(q))},De=function(q){for(var de=0;de0)return H[0]}return null},g=Object.keys(d),m=0;m0?p:jde(a,s,e,r,n,i,o,l)},checkPoint:function(e,r,n,i,a,s,o,l){l=l==="auto"?O0(i,a):l;var u=2*l;if(Ju(e,r,this.points,s,o,i,a-u,[0,-1],n)||Ju(e,r,this.points,s,o,i-u,a,[0,-1],n))return!0;var h=i/2+2*n,f=a/2+2*n,d=[s-h,o-f,s-h,o,s+h,o,s+h,o-f];return!!(Bs(e,r,d)||N0(e,r,u,u,s+i/2-l,o+a/2-l,n)||N0(e,r,u,u,s-i/2+l,o+a/2-l,n))}}};th.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ss(3,0)),this.generateRoundPolygon("round-triangle",ss(3,0)),this.generatePolygon("rectangle",ss(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",ss(5,0)),this.generateRoundPolygon("round-pentagon",ss(5,0)),this.generatePolygon("hexagon",ss(6,0)),this.generateRoundPolygon("round-hexagon",ss(6,0)),this.generatePolygon("heptagon",ss(7,0)),this.generateRoundPolygon("round-heptagon",ss(7,0)),this.generatePolygon("octagon",ss(8,0)),this.generateRoundPolygon("round-octagon",ss(8,0));var n=new Array(20);{var i=hD(5,0),a=hD(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*_)break}else if(u){if(b>=e.deqCost*p||b>=e.deqAvgCost*d)break}else if(w>=e.deqNoDrawCost*lD)break;var k=e.deq(n,y,m);if(k.length>0)for(var E=0;E0&&(e.onDeqd(n,g),!u&&e.shouldRedraw(n,g,y,m)&&a())},o=e.priority||ID;i.beforeRender(s,o(n))}}}},zYe=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F6;AD(this,t),this.idsByKey=new Vc,this.keyForId=new Vc,this.cachesByLvl=new Vc,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return _D(t,[{key:"getIdsFor",value:function(r){r==null&&ni("Can not get id list for null key");var n=this.idsByKey,i=this.idsByKey.get(r);return i||(i=new Qm,n.set(r,i)),i}},{key:"addIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).add(n)}},{key:"deleteIdForKey",value:function(r,n){r!=null&&this.getIdsFor(r).delete(n)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);this.deleteIdForKey(i,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteIdForKey(i,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(r){var n=r.id(),i=this.keyForId.get(n),a=this.getKey(r);return i!==a}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var n=this.cachesByLvl,i=this.lvls,a=n.get(r);return a||(a=new Vc,n.set(r,a),i.push(r)),a}},{key:"getCache",value:function(r,n){return this.getCachesAt(n).get(r)}},{key:"get",value:function(r,n){var i=this.getKey(r),a=this.getCache(i,n);return a!=null&&this.updateKeyMappingFor(r),a}},{key:"getForCachedKey",value:function(r,n){var i=this.keyForId.get(r.id()),a=this.getCache(i,n);return a}},{key:"hasCache",value:function(r,n){return this.getCachesAt(n).has(r)}},{key:"has",value:function(r,n){var i=this.getKey(r);return this.hasCache(i,n)}},{key:"setCache",value:function(r,n,i){i.key=r,this.getCachesAt(n).set(r,i)}},{key:"set",value:function(r,n,i){var a=this.getKey(r);this.setCache(a,n,i),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,n){this.getCachesAt(n).delete(r)}},{key:"delete",value:function(r,n){var i=this.getKey(r);this.deleteCache(i,n)}},{key:"invalidateKey",value:function(r){var n=this;this.lvls.forEach(function(i){return n.deleteCache(r,i)})}},{key:"invalidate",value:function(r){var n=r.id(),i=this.keyForId.get(n);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}]),t}(),mde=25,C6=50,O6=-4,TD=3,$Ye=7.99,GYe=8,UYe=1024,VYe=1024,WYe=1024,HYe=.2,qYe=.8,YYe=10,XYe=.15,jYe=.1,KYe=.9,ZYe=.9,QYe=100,JYe=1,Vm={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},eXe=ba({getKey:null,doesEleInvalidateKey:F6,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Gde,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),wx=function(e,r){var n=this;n.renderer=e,n.onDequeues=[];var i=eXe(r);Kt(n,i),n.lookup=new zYe(i.getKey,i.doesEleInvalidateKey),n.setupDequeueing()},Pi=wx.prototype;Pi.reasons=Vm;Pi.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Pi.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},n=r[t]=r[t]||[];return n};Pi.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Fx(function(r,n){return n.reqs-r.reqs});return e};Pi.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Pi.getElement=function(t,e,r,n,i){var a=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!a.allowEdgeTxrCaching&&t.isEdge()||!a.allowParentTxrCaching&&t.isParent())return null;if(n==null&&(n=Math.ceil(DD(o*r))),n=$Ye||n>TD)return null;var u=Math.pow(2,n),h=e.h*u,f=e.w*u,d=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,d))return null;var p=l.get(t,n);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var g;if(h<=mde?g=mde:h<=C6?g=C6:g=Math.ceil(h/C6)*C6,h>WYe||f>VYe)return null;var m=a.getTextureQueue(g),y=m[m.length-2],x=function(){return a.recycleTexture(g,f)||a.addTexture(g,f)};y||(y=m[m.length-1]),y||(y=x()),y.width-y.usedWidthn;R--)C=a.getElement(t,e,r,R,Vm.downscale);M()}else return a.queueElement(t,E.level-1),E;else{var T;if(!w&&!_&&!k)for(var I=n-1;I>=O6;I--){var A=l.get(t,I);if(A){T=A;break}}if(b(T))return a.queueElement(t,n),T;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,t,e,d,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return p={x:y.usedWidth,texture:y,level:n,scale:u,width:f,height:h,scaledLabelShown:d},y.usedWidth+=Math.ceil(f+GYe),y.eleCaches.push(p),l.set(t,n,p),a.checkTextureFullness(y),p};Pi.invalidateElements=function(t){for(var e=0;e=HYe*t.width&&this.retireTexture(t)};Pi.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>qYe&&t.fullnessChecks>=YYe?wf(r,t):t.fullnessChecks++};Pi.retireTexture=function(t){var e=this,r=t.height,n=e.getTextureQueue(r),i=this.lookup;wf(n,t),t.retired=!0;for(var a=t.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,MD(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),wf(i,s),n.push(s),s}};Pi.queueElement=function(t,e){var r=this,n=r.getElementQueue(),i=r.getElementKeyToQueue(),a=this.getKey(t),s=i[a];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,n.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:a};n.push(o),i[a]=o}};Pi.dequeue=function(t){for(var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=[],a=e.lookup,s=0;s0;s++){var o=r.pop(),l=o.key,u=o.eles[0],h=a.hasCache(u,o.level);if(n[l]=null,h)continue;i.push(o);var f=e.getBoundingBox(u);e.getElement(u,f,t,o.level,Vm.dequeue)}return i};Pi.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),n=e.getElementKeyToQueue(),i=this.getKey(t),a=n[i];a!=null&&(a.eles.length===1?(a.reqs=ND,r.updateItem(a),r.pop(),n[i]=null):a.eles.unmerge(t))};Pi.onDequeue=function(t){this.onDequeues.push(t)};Pi.offDequeue=function(t){wf(this.onDequeues,t)};Pi.setupDequeueing=K0e.setupDequeueing({deqRedrawThreshold:QYe,deqCost:XYe,deqAvgCost:jYe,deqNoDrawCost:KYe,deqFastCost:ZYe,deq:function(e,r,n){return e.dequeue(r,n)},onDeqd:function(e,r){for(var n=0;n=rXe||r>q6)return null}n.validateLayersElesOrdering(r,t);var l=n.layersByLevel,u=Math.pow(2,r),h=l[r]=l[r]||[],f,d=n.levelIsComplete(r,t),p,g=function(){var M=function(D){if(n.validateLayersElesOrdering(D,t),n.levelIsComplete(D,t))return p=l[D],!0},R=function(D){if(!p)for(var N=r+D;Tx<=N&&N<=q6&&!M(N);N+=D);};R(1),R(-1);for(var T=h.length-1;T>=0;T--){var I=h[T];I.invalid&&wf(h,I)}};if(!d)g();else return h;var m=function(){if(!f){f=Fs();for(var M=0;Myde||I>yde)return null;var A=T*I;if(A>uXe)return null;var D=n.makeLayer(f,r);if(R!=null){var N=h.indexOf(R)+1;h.splice(N,0,D)}else(M.insert===void 0||M.insert)&&h.unshift(D);return D};if(n.skipping&&!o)return null;for(var x=null,b=t.length/tXe,w=!o,_=0;_=b||!Xde(x.bb,k.boundingBox()))&&(x=y({insert:!0,after:x}),!x))return null;p||w?n.queueLayer(x,k):n.drawEleInLayer(x,k,r,e),x.eles.push(k),L[r]=x}return p||(w?null:h)};wa.getEleLevelForLayerLevel=function(t,e){return t};wa.drawEleInLayer=function(t,e,r,n){var i=this,a=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=i.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(s,!1),a.drawCachedElement(s,e,null,null,r,hXe),a.setImgSmoothing(s,!0))};wa.levelIsComplete=function(t,e){var r=this,n=r.layersByLevel[t];if(!n||n.length===0)return!1;for(var i=0,a=0;a0||s.invalid)return!1;i+=s.eles.length}return i===e.length};wa.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var n=0;n0){e=!0;break}}return e};wa.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Qu(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(n,i,a){e.invalidateLayer(n)}))};wa.invalidateLayer=function(t){if(this.lastInvalidationTime=Qu(),!t.invalid){var e=t.level,r=t.eles,n=this.layersByLevel[e];wf(n,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var i=0;i3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(a&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=a?e.pstyle("opacity").value:1,h=a?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,p=e.pstyle("width").pfValue,g=e.pstyle("line-cap").value,m=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,x=u*h,b=u*h,w=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;f==="straight-triangle"?(s.eleStrokeStyle(t,e,D),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=p,t.lineCap=g,s.eleStrokeStyle(t,e,D),s.drawEdgePath(e,t,o.allpts,d),t.lineCap="butt")},_=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;if(t.lineWidth=p+m,t.lineCap=g,m>0)s.colorStrokeStyle(t,y[0],y[1],y[2],D);else{t.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(e,t,o.allpts):(s.drawEdgePath(e,t,o.allpts,d),t.lineCap="butt")},k=function(){i&&s.drawEdgeOverlay(t,e)},E=function(){i&&s.drawEdgeUnderlay(t,e)},L=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(t,e,D)},S=function(){s.drawElementText(t,e,null,n)};t.lineJoin="round";var C=e.pstyle("ghost").value==="yes";if(C){var M=e.pstyle("ghost-offset-x").pfValue,R=e.pstyle("ghost-offset-y").pfValue,T=e.pstyle("ghost-opacity").value,I=x*T;t.translate(M,R),w(I),L(I),t.translate(-M,-R)}else _();E(),w(),L(),k(),S(),r&&t.translate(l.x1,l.y1)}};J0e=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,n){if(n.visible()){var i=n.pstyle("".concat(e,"-opacity")).value;if(i!==0){var a=this,s=a.usePaths(),o=n._private.rscratch,l=n.pstyle("".concat(e,"-padding")).pfValue,u=2*l,h=n.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,h[0],h[1],h[2],i),a.drawEdgePath(n,r,o.allpts,"solid")}}}};rh.drawEdgeOverlay=J0e("overlay");rh.drawEdgeUnderlay=J0e("underlay");rh.drawEdgePath=function(t,e,r,n){var i=t._private.rscratch,a=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,h=t.pstyle("line-dash-offset").pfValue;if(l){var f=r.join("$"),d=i.pathCacheKey&&i.pathCacheKey===f;d?(s=e=i.pathCache,o=!0):(s=e=new Path2D,i.pathCacheKey=f,i.pathCache=s)}if(a.setLineDash)switch(n){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=h;break;case"solid":a.setLineDash([]);break}if(!o&&!i.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(n==null){if(a&&!s.eleTextBiggerThanMin(e))return}else if(n===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,h=e.pstyle("label"),f=e.pstyle("source-label"),d=e.pstyle("target-label");if(u||(!h||!h.value)&&(!f||!f.value)&&(!d||!d.value))return;t.textAlign="center",t.textBaseline="bottom"}var p=!r,g;r&&(g=r,t.translate(-g.x1,-g.y1)),i==null?(s.drawText(t,e,null,p,a),e.isEdge()&&(s.drawText(t,e,"source",p,a),s.drawText(t,e,"target",p,a))):s.drawText(t,e,i,p,a),r&&t.translate(g.x1,g.y1)};$0.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,n=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue+"px",a=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,h=e.pstyle("text-outline-color").value;t.font=n+" "+s+" "+i+" "+a,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,h[0],h[1],h[2],l)};$0.getTextAngle=function(t,e){var r,n=t._private,i=n.rscratch,a=e?e+"-":"",s=t.pstyle(a+"text-rotation"),o=Bl(i,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r};$0.drawText=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=e._private,s=a.rscratch,o=i?e.effectiveOpacity():1;if(!(i&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=Bl(s,"labelX",r),u=Bl(s,"labelY",r),h,f,d=this.getLabelText(e,r);if(d!=null&&d!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,i);var p=r?r+"-":"",g=Bl(s,"labelWidth",r),m=Bl(s,"labelHeight",r),y=e.pstyle(p+"text-margin-x").pfValue,x=e.pstyle(p+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,_=e.pstyle("text-valign").value;b&&(w="center",_="center"),l+=y,u+=x;var k;switch(n?k=this.getTextAngle(e,r):k=0,k!==0&&(h=l,f=u,t.translate(h,f),t.rotate(k),l=0,u=0),_){case"top":break;case"center":u+=m/2;break;case"bottom":u+=m;break}var E=e.pstyle("text-background-opacity").value,L=e.pstyle("text-border-opacity").value,S=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,M=e.pstyle("text-background-shape").strValue,R=M.indexOf("round")===0,T=2;if(E>0||S>0&&L>0){var I=l-C;switch(w){case"left":I-=g;break;case"center":I-=g/2;break}var A=u-m-C,D=g+2*C,N=m+2*C;if(E>0){var O=t.fillStyle,B=e.pstyle("text-background-color").value;t.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+E*o+")",R?uD(t,I,A,D,N,T):t.fillRect(I,A,D,N),t.fillStyle=O}if(S>0&&L>0){var P=t.strokeStyle,$=t.lineWidth,z=e.pstyle("text-border-color").value,H=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+L*o+")",t.lineWidth=S,t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=S/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(R?uD(t,I,A,D,N,T,"stroke"):t.strokeRect(I,A,D,N),H==="double"){var J=S/2;R?uD(t,I+J,A+J,D-J*2,N-J*2,T,"stroke"):t.strokeRect(I+J,A+J,D-J*2,N-J*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=$,t.strokeStyle=P}}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(t.lineWidth=X),e.pstyle("text-wrap").value==="wrap"){var oe=Bl(s,"labelWrapCachedLines",r),K=Bl(s,"labelLineHeight",r),ee=g/2,Q=this.getLabelJustification(e);switch(Q==="auto"||(w==="left"?Q==="left"?l+=-g:Q==="center"&&(l+=-ee):w==="center"?Q==="left"?l+=-ee:Q==="right"&&(l+=ee):w==="right"&&(Q==="center"?l+=ee:Q==="right"&&(l+=g))),_){case"top":u-=(oe.length-1)*K;break;case"center":case"bottom":u-=(oe.length-1)*K;break}for(var W=0;W0&&t.strokeText(oe[W],l,u),t.fillText(oe[W],l,u),u+=K}else X>0&&t.strokeText(d,l,u),t.fillText(d,l,u);k!==0&&(t.rotate(-k),t.translate(-h,-f))}}};o1={};o1.drawNode=function(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,h=u.rscratch,f=e.position();if(!(!dt(f.x)||!dt(f.y))&&!(a&&!e.visible())){var d=a?e.effectiveOpacity():1,p=s.usePaths(),g,m=!1,y=e.padding();o=e.width()+2*y,l=e.height()+2*y;var x;r&&(x=r,t.translate(-x.x1,-x.y1));for(var b=e.pstyle("background-image"),w=b.value,_=new Array(w.length),k=new Array(w.length),E=0,L=0;L0&&arguments[0]!==void 0?arguments[0]:I;s.eleFillStyle(t,e,he)},W=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;s.colorStrokeStyle(t,A[0],A[1],A[2],he)},Y=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oe;s.colorStrokeStyle(t,J[0],J[1],J[2],he)},Z=function(he,U,ke,j){var ye=s.nodePathCache=s.nodePathCache||[],Ae=$de(ke==="polygon"?ke+","+j.join(","):ke,""+U,""+he,""+ee),Ge=ye[Ae],Fe,ge=!1;return Ge!=null?(Fe=Ge,ge=!0,h.pathCache=Fe):(Fe=new Path2D,ye[Ae]=h.pathCache=Fe),{path:Fe,cacheHit:ge}},se=e.pstyle("shape").strValue,ce=e.pstyle("shape-polygon-points").pfValue;if(p){t.translate(f.x,f.y);var ue=Z(o,l,se,ce);g=ue.path,m=ue.cacheHit}var te=function(){if(!m){var he=f;p&&(he={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(g||t,he.x,he.y,o,l,ee,h)}p?t.fill(g):t.fill()},Ne=function(){for(var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ke=u.backgrounding,j=0,ye=0;ye0&&arguments[0]!==void 0?arguments[0]:!1,U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(e)&&(s.drawPie(t,e,U),he&&(p||s.nodeShapes[s.getNodeShape(e)].draw(t,f.x,f.y,o,l,ee,h)))},we=function(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,U=(R>0?R:-R)*he,ke=R>0?0:255;R!==0&&(s.colorFillStyle(t,ke,ke,ke,U),p?t.fill(g):t.fill())},Ie=function(){if(T>0){if(t.lineWidth=T,t.lineCap=O,t.lineJoin=N,t.setLineDash)switch(D){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(P),t.lineDashOffset=$;break;case"solid":case"double":t.setLineDash([]);break}if(B!=="center"){if(t.save(),t.lineWidth*=2,B==="inside")p?t.clip(g):t.clip();else{var he=new Path2D;he.rect(-o/2-T,-l/2-T,o+2*T,l+2*T),he.addPath(g),t.clip(he,"evenodd")}p?t.stroke(g):t.stroke(),t.restore()}else p?t.stroke(g):t.stroke();if(D==="double"){t.lineWidth=T/3;var U=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",p?t.stroke(g):t.stroke(),t.globalCompositeOperation=U}t.setLineDash&&t.setLineDash([])}},Ee=function(){if(H>0){if(t.lineWidth=H,t.lineCap="butt",t.setLineDash)switch(X){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var he=f;p&&(he={x:0,y:0});var U=s.getNodeShape(e),ke=T;B==="inside"&&(ke=0),B==="outside"&&(ke*=2);var j=(o+ke+(H+K))/o,ye=(l+ke+(H+K))/l,Ae=o*j,Ge=l*ye,Fe=s.nodeShapes[U].points,ge;if(p){var $e=Z(Ae,Ge,U,Fe);ge=$e.path}if(U==="ellipse")s.drawEllipsePath(ge||t,he.x,he.y,Ae,Ge);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(U)){var Ce=0,qe=0,lt=0;U==="round-diamond"?Ce=(ke+K+H)*1.4:U==="round-heptagon"?(Ce=(ke+K+H)*1.075,lt=-(ke/2+K+H)/35):U==="round-hexagon"?Ce=(ke+K+H)*1.12:U==="round-pentagon"?(Ce=(ke+K+H)*1.13,lt=-(ke/2+K+H)/15):U==="round-tag"?(Ce=(ke+K+H)*1.12,qe=(ke/2+H+K)*.07):U==="round-triangle"&&(Ce=(ke+K+H)*(Math.PI/2),lt=-(ke+K/2+H)/Math.PI),Ce!==0&&(j=(o+Ce)/o,Ae=o*j,["round-hexagon","round-tag"].includes(U)||(ye=(l+Ce)/l,Ge=l*ye)),ee=ee==="auto"?Zde(Ae,Ge):ee;for(var xt=Ae/2,ft=Ge/2,Ze=ee+(ke+H+K)/2,st=new Array(Fe.length/2),Ue=new Array(Fe.length/2),Ke=0;Ke0){if(i=i||n.position(),a==null||s==null){var p=n.padding();a=n.width()+2*p,s=n.height()+2*p}o.colorFillStyle(r,h[0],h[1],h[2],u),o.nodeShapes[f].draw(r,i.x,i.y,a+l*2,s+l*2,d),r.fill()}}}};o1.drawNodeOverlay=epe("overlay");o1.drawNodeUnderlay=epe("underlay");o1.hasPie=function(t){return t=t[0],t._private.hasPie};o1.drawPie=function(t,e,r,n){e=e[0],n=n||e.position();var i=e.cy().style(),a=e.pstyle("pie-size"),s=n.x,o=n.y,l=e.width(),u=e.height(),h=Math.min(l,u)/2,f=0,d=this.usePaths();d&&(s=0,o=0),a.units==="%"?h=h*a.pfValue:a.pfValue!==void 0&&(h=a.pfValue/2);for(var p=1;p<=i.pieBackgroundN;p++){var g=e.pstyle("pie-"+p+"-background-size").value,m=e.pstyle("pie-"+p+"-background-color").value,y=e.pstyle("pie-"+p+"-background-opacity").value*r,x=g/100;x+f>1&&(x=1-f);var b=1.5*Math.PI+2*Math.PI*f,w=2*Math.PI*x,_=b+w;g===0||f>=1||f+x>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,h,b,_),t.closePath(),this.colorFillStyle(t,m[0],m[1],m[2],y),t.fill(),f+=x)}};uo={},kXe=100;uo.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};uo.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,n,i=0;is.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!f&&(h[s.NODE]=!0,h[s.SELECT_BOX]=!0);var b=l.style(),w=l.zoom(),_=i!==void 0?i:w,k=l.pan(),E={x:k.x,y:k.y},L={zoom:w,pan:{x:k.x,y:k.y}},S=s.prevViewport,C=S===void 0||L.zoom!==S.zoom||L.pan.x!==S.pan.x||L.pan.y!==S.pan.y;!C&&!(m&&!g)&&(s.motionBlurPxRatio=1),a&&(E=a),_*=o,E.x*=o,E.y*=o;var M=s.getCachedZSortedEles();function R(ue,te,Ne,ae,we){var Ie=ue.globalCompositeOperation;ue.globalCompositeOperation="destination-out",s.colorFillStyle(ue,255,255,255,s.motionBlurTransparency),ue.fillRect(te,Ne,ae,we),ue.globalCompositeOperation=Ie}function T(ue,te){var Ne,ae,we,Ie;!s.clearingMotionBlur&&(ue===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||ue===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(Ne={x:k.x*p,y:k.y*p},ae=w*p,we=s.canvasWidth*p,Ie=s.canvasHeight*p):(Ne=E,ae=_,we=s.canvasWidth,Ie=s.canvasHeight),ue.setTransform(1,0,0,1,0,0),te==="motionBlur"?R(ue,0,0,we,Ie):!e&&(te===void 0||te)&&ue.clearRect(0,0,we,Ie),r||(ue.translate(Ne.x,Ne.y),ue.scale(ae,ae)),a&&ue.translate(a.x,a.y),i&&ue.scale(i,i)}if(f||(s.textureDrawLastFrame=!1),f){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var I=s.data.bufferContexts[s.TEXTURE_BUFFER];I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:I,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var L=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};L.mpan={x:(0-L.pan.x)/L.zoom,y:(0-L.pan.y)/L.zoom}}h[s.DRAG]=!1,h[s.NODE]=!1;var A=u.contexts[s.NODE],D=s.textureCache.texture,L=s.textureCache.viewport;A.setTransform(1,0,0,1,0,0),d?R(A,0,0,L.width,L.height):A.clearRect(0,0,L.width,L.height);var N=b.core("outside-texture-bg-color").value,O=b.core("outside-texture-bg-opacity").value;s.colorFillStyle(A,N[0],N[1],N[2],O),A.fillRect(0,0,L.width,L.height);var w=l.zoom();T(A,!1),A.clearRect(L.mpan.x,L.mpan.y,L.width/L.zoom/o,L.height/L.zoom/o),A.drawImage(D,L.mpan.x,L.mpan.y,L.width/L.zoom/o,L.height/L.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var B=l.extent(),P=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),$=s.hideEdgesOnViewport&&P,z=[];if(z[s.NODE]=!h[s.NODE]&&d&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,z[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),z[s.DRAG]=!h[s.DRAG]&&d&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,z[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),h[s.NODE]||r||n||z[s.NODE]){var H=d&&!z[s.NODE]&&p!==1,A=e||(H?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),J=d&&!H?"motionBlur":void 0;T(A,J),$?s.drawCachedNodes(A,M.nondrag,o,B):s.drawLayeredElements(A,M.nondrag,o,B),s.debug&&s.drawDebugPoints(A,M.nondrag),!r&&!d&&(h[s.NODE]=!1)}if(!n&&(h[s.DRAG]||r||z[s.DRAG])){var H=d&&!z[s.DRAG]&&p!==1,A=e||(H?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);T(A,d&&!H?"motionBlur":void 0),$?s.drawCachedNodes(A,M.drag,o,B):s.drawCachedElements(A,M.drag,o,B),s.debug&&s.drawDebugPoints(A,M.drag),!r&&!d&&(h[s.DRAG]=!1)}if(s.showFps||!n&&h[s.SELECT_BOX]&&!r){var A=e||u.contexts[s.SELECT_BOX];if(T(A),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var w=s.cy.zoom(),X=b.core("selection-box-border-width").value/w;A.lineWidth=X,A.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",A.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),X>0&&(A.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",A.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var w=s.cy.zoom(),oe=u.bgActivePosistion;A.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",A.beginPath(),A.arc(oe.x,oe.y,b.core("active-bg-size").pfValue/w,0,2*Math.PI),A.fill()}var K=s.lastRedrawTime;if(s.showFps&&K){K=Math.round(K);var ee=Math.round(1e3/K);A.setTransform(1,0,0,1,0,0),A.fillStyle="rgba(255, 0, 0, 0.75)",A.strokeStyle="rgba(255, 0, 0, 0.75)",A.lineWidth=1,A.fillText("1 frame = "+K+" ms = "+ee+" fps",0,20);var Q=60;A.strokeRect(0,30,250,20),A.fillRect(0,30,250*Math.min(ee/Q,1),20)}r||(h[s.SELECT_BOX]=!1)}if(d&&p!==1){var W=u.contexts[s.NODE],Y=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Z=u.contexts[s.DRAG],se=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],ce=function(te,Ne,ae){te.setTransform(1,0,0,1,0,0),ae||!x?te.clearRect(0,0,s.canvasWidth,s.canvasHeight):R(te,0,0,s.canvasWidth,s.canvasHeight);var we=p;te.drawImage(Ne,0,0,s.canvasWidth*we,s.canvasHeight*we,0,0,s.canvasWidth,s.canvasHeight)};(h[s.NODE]||z[s.NODE])&&(ce(W,Y,z[s.NODE]),h[s.NODE]=!1),(h[s.DRAG]||z[s.DRAG])&&(ce(Z,se,z[s.DRAG]),h[s.DRAG]=!1)}s.prevViewport=L,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),d&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!f,s.mbFrames=0,h[s.NODE]=!0,h[s.DRAG]=!0,s.redraw()},kXe)),e||l.emit("render")};Cf={};Cf.drawPolygonPath=function(t,e,r,n,i,a){var s=n/2,o=i/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*a[0],r+o*a[1]);for(var l=1;l0&&s>0){p.clearRect(0,0,a,s),p.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(t.full)p.translate(-n.x1*u,-n.y1*u),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(n.x1*u,n.y1*u);else{var m=e.pan(),y={x:m.x*u,y:m.y*u};u*=e.zoom(),p.translate(y.x,y.y),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(-y.x,-y.y)}t.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=t.bg,p.rect(0,0,a,s),p.fill())}return d};Vx.png=function(t){return rpe(t,this.bufferCanvasImage(t),"image/png")};Vx.jpg=function(t){return rpe(t,this.bufferCanvasImage(t),"image/jpeg")};npe={};npe.nodeShapeImpl=function(t,e,r,n,i,a,s,o){switch(t){case"ellipse":return this.drawEllipsePath(e,r,n,i,a);case"polygon":return this.drawPolygonPath(e,r,n,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,n,i,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,n,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,n,i,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,n,i,a,o);case"barrel":return this.drawBarrelPath(e,r,n,i,a)}};EXe=ipe,Gr=ipe.prototype;Gr.CANVAS_LAYERS=3;Gr.SELECT_BOX=0;Gr.DRAG=1;Gr.NODE=2;Gr.BUFFER_COUNT=3;Gr.TEXTURE_BUFFER=0;Gr.MOTIONBLUR_BUFFER_NODE=1;Gr.MOTIONBLUR_BUFFER_DRAG=2;Gr.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Gr.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Gr.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Gr.SELECT_BOX]=e;break}};SXe=typeof Path2D<"u";Gr.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Gr.usePaths=function(){return SXe&&this.pathsEnabled};Gr.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Gr.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Gr.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":Oi(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var n=this.cy.window(),i=n.document;r=i.createElement("canvas"),r.width=t,r.height=e}return r};[Q0e,qc,rh,KD,$0,o1,uo,Cf,Vx,npe].forEach(function(t){Kt(Gr,t)});CXe=[{name:"null",impl:z0e},{name:"base",impl:j0e},{name:"canvas",impl:EXe}],AXe=[{type:"layout",extensions:MYe},{type:"renderer",extensions:CXe}],ape={},spe={};CD=function(){if(arguments.length===2)return lpe.apply(null,arguments);if(arguments.length===3)return ope.apply(null,arguments);if(arguments.length===4)return LXe.apply(null,arguments);if(arguments.length===5)return _Xe.apply(null,arguments);ni("Invalid extension access syntax")};Dx.prototype.extension=CD;AXe.forEach(function(t){t.extensions.forEach(function(e){ope(t.type,e.name,e.impl)})});cpe=function t(){if(!(this instanceof t))return new t;this.length=0},F0=cpe.prototype;F0.instanceString=function(){return"stylesheet"};F0.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};F0.css=function(t,e){var r=this.length-1;if(Wt(t))this[r].properties.push({name:t,value:e});else if(Dr(t))for(var n=t,i=Object.keys(n),a=0;a{(function(e,r){typeof Wx=="object"&&typeof QD=="object"?QD.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Wx=="object"?Wx.layoutBase=r():e.layoutBase=r()})(Wx,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=26)}([function(t,e,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,r){"use strict";function n(i){this.vGraphObject=i}t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(4);function u(f,d,p,g){p==null&&g==null&&(g=d),n.call(this,g),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,g=this;return g.edges.forEach(function(m){if(m.target==f){if(m.source!=g)throw"Incorrect edge source!";d.push(m)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,g=this;return g.edges.forEach(function(m){if(!(m.source==g||m.target==g))throw"Incorrect edge source and/or target";(m.target==f||m.source==f)&&d.push(m)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var g=this.child.getNodes(),m=0;md&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var g=new l(d,p),m=f.inverseTransformPoint(g);this.setLocation(m.x,m.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=u},function(t,e,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(6),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(g,m,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,m!=null&&m instanceof s?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(g,m,y){if(m==null&&y==null){var x=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var b=g;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(m.owner==y.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=y.owner?null:(b.source=m,b.target=y,b.isInterGraph=!1,this.getEdges().push(b),m.edges.push(b),y!=m&&y.edges.push(b),b)}},d.prototype.remove=function(g){var m=g;if(g instanceof o){if(m==null)throw"Node is null!";if(!(m.owner!=null&&m.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=m.edges.slice(),x,b=y.length,w=0;w-1&&E>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(k,1),x.target!=x.source&&x.target.edges.splice(E,1);var _=x.source.owner.getEdges().indexOf(x);if(_==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(_,1)}},d.prototype.updateLeftTop=function(){for(var g=i.MAX_VALUE,m=i.MAX_VALUE,y,x,b,w=this.getNodes(),_=w.length,k=0;k<_;k++){var E=w[k];y=E.getTop(),x=E.getLeft(),g>y&&(g=y),m>x&&(m=x)}return g==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?b=w[0].getParent().paddingLeft:b=this.margin,this.left=m-b,this.top=g-b,new h(this.left,this.top))},d.prototype.updateBounds=function(g){for(var m=i.MAX_VALUE,y=-i.MAX_VALUE,x=i.MAX_VALUE,b=-i.MAX_VALUE,w,_,k,E,L,S=this.nodes,C=S.length,M=0;Mw&&(m=w),y<_&&(y=_),x>k&&(x=k),bw&&(m=w),y<_&&(y=_),x>k&&(x=k),b=this.nodes.length){var C=0;y.forEach(function(M){M.owner==g&&C++}),C==this.nodes.length&&(this.isConnected=!0)}},t.exports=d},function(t,e,r){"use strict";var n,i=r(1);function a(s){n=r(5),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=S,!1;if(uh)return o[0]=d,o[1]=u,o[2]=E,o[3]=f,!1;if(lh?(o[0]=m,o[1]=y,T=!0):(o[0]=g,o[1]=p,T=!0):A===N&&(l>h?(o[0]=d,o[1]=p,T=!0):(o[0]=x,o[1]=y,T=!0)),-D===N?h>l?(o[2]=L,o[3]=S,I=!0):(o[2]=E,o[3]=k,I=!0):D===N&&(h>l?(o[2]=_,o[3]=k,I=!0):(o[2]=C,o[3]=S,I=!0)),T&&I)return!1;if(l>h?u>f?(O=this.getCardinalDirection(A,N,4),B=this.getCardinalDirection(D,N,2)):(O=this.getCardinalDirection(-A,N,3),B=this.getCardinalDirection(-D,N,1)):u>f?(O=this.getCardinalDirection(-A,N,1),B=this.getCardinalDirection(-D,N,3)):(O=this.getCardinalDirection(A,N,2),B=this.getCardinalDirection(D,N,4)),!T)switch(O){case 1:$=p,P=l+-w/N,o[0]=P,o[1]=$;break;case 2:P=x,$=u+b*N,o[0]=P,o[1]=$;break;case 3:$=y,P=l+w/N,o[0]=P,o[1]=$;break;case 4:P=m,$=u+-b*N,o[0]=P,o[1]=$;break}if(!I)switch(B){case 1:H=k,z=h+-R/N,o[2]=z,o[3]=H;break;case 2:z=C,H=f+M*N,o[2]=z,o[3]=H;break;case 3:H=S,z=h+R/N,o[2]=z,o[3]=H;break;case 4:z=L,H=f+-M*N,o[2]=z,o[3]=H;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,g=o.y,m=l.x,y=l.y,x=void 0,b=void 0,w=void 0,_=void 0,k=void 0,E=void 0,L=void 0,S=void 0,C=void 0;return w=d-h,k=u-f,L=f*h-u*d,_=y-g,E=p-m,S=m*g-p*y,C=w*E-_*k,C===0?null:(x=(k*S-E*L)/C,b=(_*L-w*S)/C,new n(x,b))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},t.exports=n},function(t,e,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,t.exports=n},function(t,e,r){"use strict";var n=function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},t.exports=i},function(t,e,r){"use strict";function n(p){if(Array.isArray(p)){for(var g=0,m=Array(p.length);g0&&g;){for(w.push(k[0]);w.length>0&&g;){var E=w[0];w.splice(0,1),b.add(E);for(var L=E.getEdges(),x=0;x-1&&k.splice(R,1)}b=new Set,_=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var g=[],m=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),x=0;x0){for(var y=this.edgeToDummyNodes.get(m),x=0;x=0&&g.splice(S,1);var C=_.getNeighborsList();C.forEach(function(T){if(m.indexOf(T)<0){var I=y.get(T),A=I-1;A==1&&E.push(T),y.set(T,A)}})}m=m.concat(E),(g.length==1||g.length==2)&&(x=!0,b=g[0])}return b},d.prototype.setGraphManager=function(p){this.graphManager=p},t.exports=d},function(t,e,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},t.exports=n},function(t,e,r){"use strict";var n=r(4);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},t.exports=i},function(t,e,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,g,m,y,x=this.getAllNodes(),b;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),b=new Set,p=0;pw||b>w)&&(f.gravitationForceX=-this.gravityConstant*m,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(x>w||b>w)&&(f.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=x.length||w>=x[0].length)){for(var _=0;_u}}]),o}();t.exports=s},function(t,e,r){"use strict";var n=function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(e,r){typeof Hx=="object"&&typeof eO=="object"?eO.exports=r(JD()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof Hx=="object"?Hx.coseBase=r(JD()):e.coseBase=r(e.layoutBase)})(Hx,function(t){return function(e){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=7)}([function(e,r){e.exports=t},function(e,r,n){"use strict";var i=n(0).FDLayoutConstants;function a(){}for(var s in i)a[s]=i[s];a.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,a.DEFAULT_RADIAL_SEPARATION=i.DEFAULT_EDGE_LENGTH,a.DEFAULT_COMPONENT_SEPERATION=60,a.TILE=!0,a.TILING_PADDING_VERTICAL=10,a.TILING_PADDING_HORIZONTAL=10,a.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=a},function(e,r,n){"use strict";var i=n(0).FDLayoutEdge;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];e.exports=a},function(e,r,n){"use strict";var i=n(0).LGraph;function a(o,l,u){i.call(this,o,l,u)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];e.exports=a},function(e,r,n){"use strict";var i=n(0).LGraphManager;function a(o){i.call(this,o)}a.prototype=Object.create(i.prototype);for(var s in i)a[s]=i[s];e.exports=a},function(e,r,n){"use strict";var i=n(0).FDLayoutNode,a=n(0).IMath;function s(l,u,h,f){i.call(this,l,u,h,f)}s.prototype=Object.create(i.prototype);for(var o in i)s[o]=i[o];s.prototype.move=function(){var l=this.graphManager.getLayout();this.displacementX=l.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=l.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementX=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementX)),Math.abs(this.displacementY)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementY=l.coolingFactor*l.maxNodeDisplacement*a.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),l.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},s.prototype.propogateDisplacementToChildren=function(l,u){for(var h=this.getChild().getNodes(),f,d=0;d0)this.positionNodesRadially(k);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),L=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(L),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},w.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var k=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(C){return k.has(C)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var L=!this.isTreeGrowing&&!this.isGrowthFinished,S=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(L,S),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var k=this.graphManager.getAllNodes(),E={},L=0;L1){var T;for(T=0;TS&&(S=Math.floor(R.y)),M=Math.floor(R.x+u.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(f.WORLD_CENTER_X-R.x/2,f.WORLD_CENTER_Y-R.y/2))},w.radialLayout=function(k,E,L){var S=Math.max(this.maxDiagonalInTree(k),u.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(E,null,0,359,0,S);var C=x.calculateBounds(k),M=new b;M.setDeviceOrgX(C.getMinX()),M.setDeviceOrgY(C.getMinY()),M.setWorldOrgX(L.x),M.setWorldOrgY(L.y);for(var R=0;R1;){var J=H[0];H.splice(0,1);var X=O.indexOf(J);X>=0&&O.splice(X,1),$--,B--}E!=null?z=(O.indexOf(H[0])+1)%$:z=0;for(var oe=Math.abs(S-L)/B,K=z;P!=B;K=++K%$){var ee=O[K].getOtherEnd(k);if(ee!=E){var Q=(L+P*oe)%360,W=(Q+oe)%360;w.branchRadialLayout(ee,k,Q,W,C+M,M),P++}}},w.maxDiagonalInTree=function(k){for(var E=m.MIN_VALUE,L=0;LE&&(E=C)}return E},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var k=this,E={};this.memberGroups={},this.idToDummyNode={};for(var L=[],S=this.graphManager.getAllNodes(),C=0;C"u"&&(E[T]=[]),E[T]=E[T].concat(M)}Object.keys(E).forEach(function(I){if(E[I].length>1){var A="DummyCompound_"+I;k.memberGroups[A]=E[I];var D=E[I][0].getParent(),N=new o(k.graphManager);N.id=A,N.paddingLeft=D.paddingLeft||0,N.paddingRight=D.paddingRight||0,N.paddingBottom=D.paddingBottom||0,N.paddingTop=D.paddingTop||0,k.idToDummyNode[A]=N;var O=k.getGraphManager().add(k.newGraph(),N),B=D.getChild();B.add(N);for(var P=0;P=0;k--){var E=this.compoundOrder[k],L=E.id,S=E.paddingLeft,C=E.paddingTop;this.adjustLocations(this.tiledMemberPack[L],E.rect.x,E.rect.y,S,C)}},w.prototype.repopulateZeroDegreeMembers=function(){var k=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(L){var S=k.idToDummyNode[L],C=S.paddingLeft,M=S.paddingTop;k.adjustLocations(E[L],S.rect.x,S.rect.y,C,M)})},w.prototype.getToBeTiled=function(k){var E=k.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var L=k.getChild();if(L==null)return this.toBeTiled[E]=!1,!1;for(var S=L.getNodes(),C=0;C0)return this.toBeTiled[E]=!1,!1;if(M.getChild()==null){this.toBeTiled[M.id]=!1;continue}if(!this.getToBeTiled(M))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},w.prototype.getNodeDegree=function(k){for(var E=k.id,L=k.getEdges(),S=0,C=0;CI&&(I=D.rect.height)}L+=I+k.verticalPadding}},w.prototype.tileCompoundMembers=function(k,E){var L=this;this.tiledMemberPack=[],Object.keys(k).forEach(function(S){var C=E[S];L.tiledMemberPack[S]=L.tileNodes(k[S],C.paddingLeft+C.paddingRight),C.rect.width=L.tiledMemberPack[S].width,C.rect.height=L.tiledMemberPack[S].height})},w.prototype.tileNodes=function(k,E){var L=u.TILING_PADDING_VERTICAL,S=u.TILING_PADDING_HORIZONTAL,C={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:L,horizontalPadding:S};k.sort(function(T,I){return T.rect.width*T.rect.height>I.rect.width*I.rect.height?-1:T.rect.width*T.rect.height0&&(R+=k.horizontalPadding),k.rowWidth[L]=R,k.width0&&(T+=k.verticalPadding);var I=0;T>k.rowHeight[L]&&(I=k.rowHeight[L],k.rowHeight[L]=T,I=k.rowHeight[L]-I),k.height+=I,k.rows[L].push(E)},w.prototype.getShortestRowIndex=function(k){for(var E=-1,L=Number.MAX_VALUE,S=0;SL&&(E=S,L=k.rowWidth[S]);return E},w.prototype.canAddHorizontal=function(k,E,L){var S=this.getShortestRowIndex(k);if(S<0)return!0;var C=k.rowWidth[S];if(C+k.horizontalPadding+E<=k.width)return!0;var M=0;k.rowHeight[S]0&&(M=L+k.verticalPadding-k.rowHeight[S]);var R;k.width-C>=E+k.horizontalPadding?R=(k.height+M)/(C+E+k.horizontalPadding):R=(k.height+M)/k.width,M=L+k.verticalPadding;var T;return k.widthM&&E!=L){S.splice(-1,1),k.rows[L].push(C),k.rowWidth[E]=k.rowWidth[E]-M,k.rowWidth[L]=k.rowWidth[L]+M,k.width=k.rowWidth[instance.getLongestRowIndex(k)];for(var R=Number.MIN_VALUE,T=0;TR&&(R=S[T].height);E>0&&(R+=k.verticalPadding);var I=k.rowHeight[E]+k.rowHeight[L];k.rowHeight[E]=R,k.rowHeight[L]0)for(var B=C;B<=M;B++)O[0]+=this.grid[B][R-1].length+this.grid[B][R].length-1;if(M0)for(var B=R;B<=T;B++)O[3]+=this.grid[C-1][B].length+this.grid[C][B].length-1;for(var P=m.MAX_VALUE,$,z,H=0;H{(function(e,r){typeof qx=="object"&&typeof rO=="object"?rO.exports=r(tO()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof qx=="object"?qx.cytoscapeCoseBilkent=r(tO()):e.cytoscapeCoseBilkent=r(e.coseBase)})(qx,function(t){return function(e){var r={};function n(i){if(r[i])return r[i].exports;var a=r[i]={i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=r,n.i=function(i){return i},n.d=function(i,a,s){n.o(i,a)||Object.defineProperty(i,a,{configurable:!1,enumerable:!0,get:s})},n.n=function(i){var a=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(a,"a",a),a},n.o=function(i,a){return Object.prototype.hasOwnProperty.call(i,a)},n.p="",n(n.s=1)}([function(e,r){e.exports=t},function(e,r,n){"use strict";var i=n(0).layoutBase.LayoutConstants,a=n(0).layoutBase.FDLayoutConstants,s=n(0).CoSEConstants,o=n(0).CoSELayout,l=n(0).CoSENode,u=n(0).layoutBase.PointD,h=n(0).layoutBase.DimensionD,f={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(y,x){var b={};for(var w in y)b[w]=y[w];for(var w in x)b[w]=x[w];return b}function p(y){this.options=d(f,y),g(this.options)}var g=function(x){x.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=a.DEFAULT_REPULSION_STRENGTH=x.nodeRepulsion),x.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=a.DEFAULT_EDGE_LENGTH=x.idealEdgeLength),x.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=a.DEFAULT_SPRING_STRENGTH=x.edgeElasticity),x.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=x.nestingFactor),x.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=a.DEFAULT_GRAVITY_STRENGTH=x.gravity),x.numIter!=null&&(s.MAX_ITERATIONS=a.MAX_ITERATIONS=x.numIter),x.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=a.DEFAULT_GRAVITY_RANGE_FACTOR=x.gravityRange),x.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=x.gravityCompound),x.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=x.gravityRangeCompound),x.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=a.DEFAULT_COOLING_FACTOR_INCREMENTAL=x.initialEnergyOnIncremental),x.quality=="draft"?i.QUALITY=0:x.quality=="proof"?i.QUALITY=2:i.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=x.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=!x.randomize,s.ANIMATE=a.ANIMATE=i.ANIMATE=x.animate,s.TILE=x.tile,s.TILING_PADDING_VERTICAL=typeof x.tilingPaddingVertical=="function"?x.tilingPaddingVertical.call():x.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof x.tilingPaddingHorizontal=="function"?x.tilingPaddingHorizontal.call():x.tilingPaddingHorizontal};p.prototype.run=function(){var y,x,b=this.options,w=this.idToLNode={},_=this.layout=new o,k=this;k.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var E=_.newGraphManager();this.gm=E;var L=this.options.eles.nodes(),S=this.options.eles.edges();this.root=E.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(L),_);for(var C=0;C0){var T;T=b.getGraphManager().add(b.newGraph(),L),this.processChildrenList(T,E,b)}}},p.prototype.stop=function(){return this.stopped=!0,this};var m=function(x){x("layout","cose-bilkent",p)};typeof cytoscape<"u"&&m(cytoscape),e.exports=m}])})});var vpe={};vr(vpe,{diagram:()=>aje});function dpe(t,e,r,n,i){return t.insert("polygon",":first-child").attr("points",n.map(function(a){return a.x+","+a.y}).join(" ")).attr("transform","translate("+(i.width-e)/2+", "+r+")")}async function aO(t,e,r,n,i){await QXe(t,e,r,n,i),r.children&&await Promise.all(r.children.map((a,s)=>aO(t,e,a,n<0?s:n,i)))}function ppe(t,e){e.edges().map((r,n)=>{let i=r.data();if(r[0]._private.bodyBounds){let a=r[0]._private.rscratch;re.trace("Edge: ",n,i),t.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}})}function sO(t,e,r,n){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:n,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(i=>{sO(i,e,r,n+1),e.add({group:"edges",data:{id:`${t.id}_${i.id}`,source:t.id,target:i.id,depth:n,section:i.section}})})}function gpe(t,e){return new Promise(r=>{let n=Ve("body").append("div").attr("id","cy").attr("style","display:none"),i=Jo({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});n.remove(),sO(t,i,e,0),i.nodes().forEach(function(a){a.layoutDimensions=()=>{let s=a.data();return{w:s.width,h:s.height}}}),i.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),i.ready(a=>{re.info("Ready",a),r(i)})})}function mpe(t,e){e.nodes().map((r,n)=>{let i=r.data();i.x=r.position().x,i.y=r.position().y,JXe(t,i);let a=t.getElementById(i.nodeId);re.info("Id:",n,"Position: (",r.position().x,", ",r.position().y,")",i),a.attr("transform",`translate(${r.position().x-i.width/2}, ${r.position().y-i.height/2})`),a.attr("attr",`apa-${n})`)})}var fpe,nO,NXe,zl,hpe,iO,IXe,MXe,DXe,OXe,Bi,PXe,BXe,FXe,zXe,$Xe,GXe,UXe,VXe,WXe,HXe,qXe,YXe,XXe,jXe,KXe,ZXe,QXe,JXe,eje,tje,rje,nje,ije,aje,ype=F(()=>{Ya();kn();Iu();or();ZD();fpe=Gi(upe(),1);lr();go();nO=function(){var t=v(function(_,k,E,L){for(E=E||{},L=_.length;L--;E[_[L]]=k);return E},"o"),e=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],m=[1,34],y=[1,6,7,11,13,15,16,19,22],x={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:v(function(k,E,L,S,C,M,R){var T=M.length-1;switch(C){case 6:case 7:return S;case 8:S.getLogger().trace("Stop NL ");break;case 9:S.getLogger().trace("Stop EOF ");break;case 11:S.getLogger().trace("Stop NL2 ");break;case 12:S.getLogger().trace("Stop EOF2 ");break;case 15:S.getLogger().info("Node: ",M[T].id),S.addNode(M[T-1].length,M[T].id,M[T].descr,M[T].type);break;case 16:S.getLogger().trace("Icon: ",M[T]),S.decorateNode({icon:M[T]});break;case 17:case 21:S.decorateNode({class:M[T]});break;case 18:S.getLogger().trace("SPACELIST");break;case 19:S.getLogger().trace("Node: ",M[T].id),S.addNode(0,M[T].id,M[T].descr,M[T].type);break;case 20:S.decorateNode({icon:M[T]});break;case 25:S.getLogger().trace("node found ..",M[T-2]),this.$={id:M[T-1],descr:M[T-1],type:S.getType(M[T-2],M[T])};break;case 26:this.$={id:M[T],descr:M[T],type:S.nodeType.DEFAULT};break;case 27:S.getLogger().trace("node found ..",M[T-3]),this.$={id:M[T-3],descr:M[T-1],type:S.getType(M[T-2],M[T])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},{6:u,7:h,10:23,11:f},t(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),t(d,[2,18]),t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),t(d,[2,23]),t(d,[2,24]),t(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:h,10:32,11:f},{1:[2,7],6:r,12:21,13:n,14:14,15:i,16:a,17:17,18:18,19:s,22:o},t(p,[2,14],{7:g,11:m}),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(d,[2,15]),t(d,[2,16]),t(d,[2,17]),{20:[1,35]},{21:[1,36]},t(p,[2,13],{7:g,11:m}),t(y,[2,11]),t(y,[2,12]),{21:[1,37]},t(d,[2,25]),t(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:v(function(k,E){if(E.recoverable)this.trace(k);else{var L=new Error(k);throw L.hash=E,L}},"parseError"),parse:v(function(k){var E=this,L=[0],S=[],C=[null],M=[],R=this.table,T="",I=0,A=0,D=0,N=2,O=1,B=M.slice.call(arguments,1),P=Object.create(this.lexer),$={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&($.yy[z]=this.yy[z]);P.setInput(k,$.yy),$.yy.lexer=P,$.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var H=P.yylloc;M.push(H);var J=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(we){L.length=L.length-2*we,C.length=C.length-we,M.length=M.length-we}v(X,"popStack");function oe(){var we;return we=S.pop()||P.lex()||O,typeof we!="number"&&(we instanceof Array&&(S=we,we=S.pop()),we=E.symbols_[we]||we),we}v(oe,"lex");for(var K,ee,Q,W,Y,Z,se={},ce,ue,te,Ne;;){if(Q=L[L.length-1],this.defaultActions[Q]?W=this.defaultActions[Q]:((K===null||typeof K>"u")&&(K=oe()),W=R[Q]&&R[Q][K]),typeof W>"u"||!W.length||!W[0]){var ae="";Ne=[];for(ce in R[Q])this.terminals_[ce]&&ce>N&&Ne.push("'"+this.terminals_[ce]+"'");P.showPosition?ae="Parse error on line "+(I+1)+`: `+P.showPosition()+` Expecting `+Ne.join(", ")+", got '"+(this.terminals_[K]||K)+"'":ae="Parse error on line "+(I+1)+": Unexpected "+(K==O?"end of input":"'"+(this.terminals_[K]||K)+"'"),this.parseError(ae,{text:P.match,token:this.terminals_[K]||K,line:P.yylineno,loc:H,expected:Ne})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+K);switch(W[0]){case 1:L.push(K),C.push(P.yytext),M.push(P.yylloc),L.push(W[1]),K=null,ee?(K=ee,ee=null):(A=P.yyleng,T=P.yytext,I=P.yylineno,H=P.yylloc,D>0&&D--);break;case 2:if(ue=this.productions_[W[1]][1],se.$=C[C.length-ue],se._$={first_line:M[M.length-(ue||1)].first_line,last_line:M[M.length-1].last_line,first_column:M[M.length-(ue||1)].first_column,last_column:M[M.length-1].last_column},J&&(se._$.range=[M[M.length-(ue||1)].range[0],M[M.length-1].range[1]]),Z=this.performAction.apply(se,[T,A,I,$.yy,W[1],C,M].concat(B)),typeof Z<"u")return Z;ue&&(L=L.slice(0,-1*ue*2),C=C.slice(0,-1*ue),M=M.slice(0,-1*ue)),L.push(this.productions_[W[1]][0]),C.push(se.$),M.push(se._$),te=R[L[L.length-2]][L[L.length-1]],L.push(te);break;case 3:return!0}}return!0},"parse")},b=function(){var _={EOF:1,parseError:v(function(E,L){if(this.yy.parser)this.yy.parser.parseError(E,L);else throw new Error(E)},"parseError"),setInput:v(function(k,E){return this.yy=E||this.yy||{},this._input=k,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var k=this._input[0];this.yytext+=k,this.yyleng++,this.offset++,this.match+=k,this.matched+=k;var E=k.match(/(?:\r\n?|\n).*/g);return E?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),k},"input"),unput:v(function(k){var E=k.length,L=k.split(/(?:\r\n?|\n)/g);this._input=k+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-E),this.offset-=E;var S=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),L.length-1&&(this.yylineno-=L.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:L?(L.length===S.length?this.yylloc.first_column:0)+S[S.length-L.length].length-L[0].length:this.yylloc.first_column-E},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-E]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(k){this.unput(this.match.slice(k))},"less"),pastInput:v(function(){var k=this.matched.substr(0,this.matched.length-this.match.length);return(k.length>20?"...":"")+k.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var k=this.match;return k.length<20&&(k+=this._input.substr(0,20-k.length)),(k.substr(0,20)+(k.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var k=this.pastInput(),E=new Array(k.length+1).join("-");return k+this.upcomingInput()+` `+E+"^"},"showPosition"),test_match:v(function(k,E){var L,S,C;if(this.options.backtrack_lexer&&(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(C.yylloc.range=this.yylloc.range.slice(0))),S=k[0].match(/(?:\r\n?|\n).*/g),S&&(this.yylineno+=S.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:S?S[S.length-1].length-S[S.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+k[0].length},this.yytext+=k[0],this.match+=k[0],this.matches=k,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(k[0].length),this.matched+=k[0],L=this.performAction.call(this,this.yy,this,E,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),L)return L;if(this._backtrack){for(var M in C)this[M]=C[M];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var k,E,L,S;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),M=0;ME[0].length)){if(E=L,S=M,this.options.backtrack_lexer){if(k=this.test_match(L,C[M]),k!==!1)return k;if(this._backtrack){E=!1;continue}else return!1}else if(!this.options.flex)break}return E?(k=this.test_match(E,C[S]),k!==!1?k:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var E=this.next();return E||this.lex()},"lex"),begin:v(function(E){this.conditionStack.push(E)},"begin"),popState:v(function(){var E=this.conditionStack.length-1;return E>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(E){return E=this.conditionStack.length-1-Math.abs(E||0),E>=0?this.conditionStack[E]:"INITIAL"},"topState"),pushState:v(function(E){this.begin(E)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(E,L,S,C){var M=C;switch(S){case 0:return E.getLogger().trace("Found comment",L.yytext),6;break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;break;case 4:this.popState();break;case 5:E.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return E.getLogger().trace("SPACELINE"),6;break;case 7:return 7;case 8:return 15;case 9:E.getLogger().trace("end icon"),this.popState();break;case 10:return E.getLogger().trace("Exploding node"),this.begin("NODE"),19;break;case 11:return E.getLogger().trace("Cloud"),this.begin("NODE"),19;break;case 12:return E.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;break;case 13:return E.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;break;case 14:return this.begin("NODE"),19;break;case 15:return this.begin("NODE"),19;break;case 16:return this.begin("NODE"),19;break;case 17:return this.begin("NODE"),19;break;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:E.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return E.getLogger().trace("description:",L.yytext),"NODE_DESCR";break;case 26:this.popState();break;case 27:return this.popState(),E.getLogger().trace("node end ))"),"NODE_DEND";break;case 28:return this.popState(),E.getLogger().trace("node end )"),"NODE_DEND";break;case 29:return this.popState(),E.getLogger().trace("node end ...",L.yytext),"NODE_DEND";break;case 30:return this.popState(),E.getLogger().trace("node end (("),"NODE_DEND";break;case 31:return this.popState(),E.getLogger().trace("node end (-"),"NODE_DEND";break;case 32:return this.popState(),E.getLogger().trace("node end (-"),"NODE_DEND";break;case 33:return this.popState(),E.getLogger().trace("node end (("),"NODE_DEND";break;case 34:return this.popState(),E.getLogger().trace("node end (("),"NODE_DEND";break;case 35:return E.getLogger().trace("Long description:",L.yytext),20;break;case 36:return E.getLogger().trace("Long description:",L.yytext),20;break}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return _}();x.lexer=b;function w(){this.yy={}}return v(w,"Parser"),w.prototype=x,x.Parser=w,new w}();nO.parser=nO;NXe=nO,zl=[],hpe=0,iO={},IXe=v(()=>{zl=[],hpe=0,iO={}},"clear"),MXe=v(function(t){for(let e=zl.length-1;e>=0;e--)if(zl[e].levelzl.length>0?zl[0]:null,"getMindmap"),OXe=v((t,e,r,n)=>{re.info("addNode",t,e,r,n);let i=pe(),a=i.mindmap?.padding??sr.mindmap.padding;switch(n){case Bi.ROUNDED_RECT:case Bi.RECT:case Bi.HEXAGON:a*=2}let s={id:hpe++,nodeId:yr(e,i),level:t,descr:yr(r,i),type:n,children:[],width:i.mindmap?.maxNodeWidth??sr.mindmap.maxNodeWidth,padding:a},o=MXe(t);if(o)o.children.push(s),zl.push(s);else if(zl.length===0)zl.push(s);else throw new Error('There can be only one root. No parent could be found for ("'+s.descr+'")')},"addNode"),Bi={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},PXe=v((t,e)=>{switch(re.debug("In get type",t,e),t){case"[":return Bi.RECT;case"(":return e===")"?Bi.ROUNDED_RECT:Bi.CLOUD;case"((":return Bi.CIRCLE;case")":return Bi.CLOUD;case"))":return Bi.BANG;case"{{":return Bi.HEXAGON;default:return Bi.DEFAULT}},"getType"),BXe=v((t,e)=>{iO[t]=e},"setElementForId"),FXe=v(t=>{if(!t)return;let e=pe(),r=zl[zl.length-1];t.icon&&(r.icon=yr(t.icon,e)),t.class&&(r.class=yr(t.class,e))},"decorateNode"),zXe=v(t=>{switch(t){case Bi.DEFAULT:return"no-border";case Bi.RECT:return"rect";case Bi.ROUNDED_RECT:return"rounded-rect";case Bi.CIRCLE:return"circle";case Bi.CLOUD:return"cloud";case Bi.BANG:return"bang";case Bi.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),$Xe=v(()=>re,"getLogger"),GXe=v(t=>iO[t],"getElementById"),UXe={clear:IXe,addNode:OXe,getMindmap:DXe,nodeType:Bi,getType:PXe,setElementForId:BXe,decorateNode:FXe,type2Str:zXe,getLogger:$Xe,getElementById:GXe},VXe=UXe,WXe=12,HXe=v(function(t,e,r,n){e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+2*5} q0,-5 5,-5 h${r.width-2*5} q5,0 5,5 v${r.height-5} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},"defaultBkg"),qXe=v(function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},"rectBkg"),YXe=v(function(t,e,r){let n=r.width,i=r.height,a=.15*n,s=.25*n,o=.35*n,l=.2*n;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${a},${a} 0 0,1 ${n*.25},${-1*n*.1} a${o},${o} 1 0,1 ${n*.4},${-1*n*.1} a${s},${s} 1 0,1 ${n*.35},${1*n*.2} a${a},${a} 1 0,1 ${n*.15},${1*i*.35} a${l},${l} 1 0,1 ${-1*n*.15},${1*i*.65} a${s},${a} 1 0,1 ${-1*n*.25},${n*.15} a${o},${o} 1 0,1 ${-1*n*.5},0 a${a},${a} 1 0,1 ${-1*n*.25},${-1*n*.15} a${a},${a} 1 0,1 ${-1*n*.1},${-1*i*.35} a${l},${l} 1 0,1 ${n*.1},${-1*i*.65} H0 V0 Z`)},"cloudBkg"),XXe=v(function(t,e,r){let n=r.width,i=r.height,a=.15*n;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${a},${a} 1 0,0 ${n*.25},${-1*i*.1} a${a},${a} 1 0,0 ${n*.25},0 a${a},${a} 1 0,0 ${n*.25},0 a${a},${a} 1 0,0 ${n*.25},${1*i*.1} a${a},${a} 1 0,0 ${n*.15},${1*i*.33} a${a*.8},${a*.8} 1 0,0 0,${1*i*.34} a${a},${a} 1 0,0 ${-1*n*.15},${1*i*.33} a${a},${a} 1 0,0 ${-1*n*.25},${i*.15} a${a},${a} 1 0,0 ${-1*n*.25},0 a${a},${a} 1 0,0 ${-1*n*.25},0 a${a},${a} 1 0,0 ${-1*n*.25},${-1*i*.15} a${a},${a} 1 0,0 ${-1*n*.1},${-1*i*.33} a${a*.8},${a*.8} 1 0,0 0,${-1*i*.34} a${a},${a} 1 0,0 ${n*.1},${-1*i*.33} H0 V0 Z`)},"bangBkg"),jXe=v(function(t,e,r){e.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("r",r.width/2)},"circleBkg");v(dpe,"insertPolygonShape");KXe=v(function(t,e,r){let n=r.height,a=n/4,s=r.width-r.padding+2*a,o=[{x:a,y:0},{x:s-a,y:0},{x:s,y:-n/2},{x:s-a,y:-n},{x:a,y:-n},{x:0,y:-n/2}];dpe(e,s,n,o,r)},"hexagonBkg"),ZXe=v(function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},"roundedRectBkg"),QXe=v(async function(t,e,r,n,i){let a=i.htmlLabels,s=n%(WXe-1),o=e.append("g");r.section=s;let l="section-"+s;s<0&&(l+=" section-root"),o.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+l);let u=o.append("g"),h=o.append("g"),f=r.descr.replace(/()/g,` `);await oa(h,f,{useHtmlLabels:a,width:r.width,classes:"mindmap-node-label"},i),a||h.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let d=h.node().getBBox(),[p]=Ro(i.fontSize);if(r.height=d.height+p*1.1*.5+r.padding,r.width=d.width+2*r.padding,r.icon)if(r.type===t.nodeType.CIRCLE)r.height+=50,r.width+=50,o.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),h.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;let g=r.height;r.height=Math.max(g,60);let m=Math.abs(r.height-g);o.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+m/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),h.attr("transform","translate("+(25+r.width/2)+", "+(m/2+r.padding/2)+")")}else if(a){let g=(r.width-d.width)/2,m=(r.height-d.height)/2;h.attr("transform","translate("+g+", "+m+")")}else{let g=r.width/2,m=r.padding/2;h.attr("transform","translate("+g+", "+m+")")}switch(r.type){case t.nodeType.DEFAULT:HXe(t,u,r,s);break;case t.nodeType.ROUNDED_RECT:ZXe(t,u,r,s);break;case t.nodeType.RECT:qXe(t,u,r,s);break;case t.nodeType.CIRCLE:u.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),jXe(t,u,r,s);break;case t.nodeType.CLOUD:YXe(t,u,r,s);break;case t.nodeType.BANG:XXe(t,u,r,s);break;case t.nodeType.HEXAGON:KXe(t,u,r,s);break}return t.setElementForId(r.id,o),r.height},"drawNode"),JXe=v(function(t,e){let r=t.getElementById(e.id),n=e.x||0,i=e.y||0;r.attr("transform","translate("+n+","+i+")")},"positionNode");Jo.use(fpe.default);v(aO,"drawNodes");v(ppe,"drawEdges");v(sO,"addNodes");v(gpe,"layoutMindmap");v(mpe,"positionNodes");eje=v(async(t,e,r,n)=>{re.debug(`Rendering mindmap diagram `+t);let i=n.db,a=i.getMindmap();if(!a)return;let s=pe();s.htmlLabels=!1;let o=La(e),l=o.append("g");l.attr("class","mindmap-edges");let u=o.append("g");u.attr("class","mindmap-nodes"),await aO(i,u,a,-1,s);let h=await gpe(a,s);ppe(l,h),mpe(i,h),il(void 0,o,s.mindmap?.padding??sr.mindmap.padding,s.mindmap?.useMaxWidth??sr.mindmap.useMaxWidth)},"draw"),tje={draw:eje},rje=v(t=>{let e="";for(let r=0;r` .edge { stroke-width: 3; } ${rje(t)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${t.git0}; } .section-root text { fill: ${t.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .mindmap-node-label { dy: 1em; alignment-baseline: middle; text-anchor: middle; dominant-baseline: middle; text-align: center; } `,"getStyles"),ije=nje,aje={db:VXe,renderer:tje,parser:NXe,styles:ije}});var bpe={};vr(bpe,{diagram:()=>Eje});var oO,sje,el,cO,lO,uO,oje,lje,xpe,cje,uje,Fi,hje,fje,dje,pje,gje,mje,vje,yje,xje,bje,wje,kje,Tje,Eje,wpe=F(()=>{r4();yl();sl();bo();Ya();kn();Iu();or();go();oO=function(){var t=v(function(L,S,C,M){for(C=C||{},M=L.length;M--;C[L[M]]=S);return C},"o"),e=[1,4],r=[1,13],n=[1,12],i=[1,15],a=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],h=[1,24],f=[1,25],d=[6,7,11],p=[1,31],g=[6,7,11,24],m=[1,6,13,16,17,20,23],y=[1,35],x=[1,36],b=[1,6,7,11,13,16,17,20,23],w=[1,38],_={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:v(function(S,C,M,R,T,I,A){var D=I.length-1;switch(T){case 6:case 7:return R;case 8:R.getLogger().trace("Stop NL ");break;case 9:R.getLogger().trace("Stop EOF ");break;case 11:R.getLogger().trace("Stop NL2 ");break;case 12:R.getLogger().trace("Stop EOF2 ");break;case 15:R.getLogger().info("Node: ",I[D-1].id),R.addNode(I[D-2].length,I[D-1].id,I[D-1].descr,I[D-1].type,I[D]);break;case 16:R.getLogger().info("Node: ",I[D].id),R.addNode(I[D-1].length,I[D].id,I[D].descr,I[D].type);break;case 17:R.getLogger().trace("Icon: ",I[D]),R.decorateNode({icon:I[D]});break;case 18:case 23:R.decorateNode({class:I[D]});break;case 19:R.getLogger().trace("SPACELIST");break;case 20:R.getLogger().trace("Node: ",I[D-1].id),R.addNode(0,I[D-1].id,I[D-1].descr,I[D-1].type,I[D]);break;case 21:R.getLogger().trace("Node: ",I[D].id),R.addNode(0,I[D].id,I[D].descr,I[D].type);break;case 22:R.decorateNode({icon:I[D]});break;case 27:R.getLogger().trace("node found ..",I[D-2]),this.$={id:I[D-1],descr:I[D-1],type:R.getType(I[D-2],I[D])};break;case 28:this.$={id:I[D],descr:I[D],type:0};break;case 29:R.getLogger().trace("node found ..",I[D-3]),this.$={id:I[D-3],descr:I[D-1],type:R.getType(I[D-2],I[D])};break;case 30:this.$=I[D-1]+I[D];break;case 31:this.$=I[D];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:r,9:22,12:11,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},{6:u,7:h,10:23,11:f},t(d,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:o}),t(d,[2,19]),t(d,[2,21],{15:30,24:p}),t(d,[2,22]),t(d,[2,23]),t(g,[2,25]),t(g,[2,26]),t(g,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:h,10:34,11:f},{1:[2,7],6:r,12:21,13:n,14:14,16:i,17:a,18:17,19:18,20:s,23:o},t(m,[2,14],{7:y,11:x}),t(b,[2,8]),t(b,[2,9]),t(b,[2,10]),t(d,[2,16],{15:37,24:p}),t(d,[2,17]),t(d,[2,18]),t(d,[2,20],{24:w}),t(g,[2,31]),{21:[1,39]},{22:[1,40]},t(m,[2,13],{7:y,11:x}),t(b,[2,11]),t(b,[2,12]),t(d,[2,15],{24:w}),t(g,[2,30]),{22:[1,41]},t(g,[2,27]),t(g,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:v(function(S,C){if(C.recoverable)this.trace(S);else{var M=new Error(S);throw M.hash=C,M}},"parseError"),parse:v(function(S){var C=this,M=[0],R=[],T=[null],I=[],A=this.table,D="",N=0,O=0,B=0,P=2,$=1,z=I.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var X in this.yy)Object.prototype.hasOwnProperty.call(this.yy,X)&&(J.yy[X]=this.yy[X]);H.setInput(S,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var oe=H.yylloc;I.push(oe);var K=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ee(Oe){M.length=M.length-2*Oe,T.length=T.length-Oe,I.length=I.length-Oe}v(ee,"popStack");function Q(){var Oe;return Oe=R.pop()||H.lex()||$,typeof Oe!="number"&&(Oe instanceof Array&&(R=Oe,Oe=R.pop()),Oe=C.symbols_[Oe]||Oe),Oe}v(Q,"lex");for(var W,Y,Z,se,ce,ue,te={},Ne,ae,we,Ie;;){if(Z=M[M.length-1],this.defaultActions[Z]?se=this.defaultActions[Z]:((W===null||typeof W>"u")&&(W=Q()),se=A[Z]&&A[Z][W]),typeof se>"u"||!se.length||!se[0]){var Ee="";Ie=[];for(Ne in A[Z])this.terminals_[Ne]&&Ne>P&&Ie.push("'"+this.terminals_[Ne]+"'");H.showPosition?Ee="Parse error on line "+(N+1)+`: `+H.showPosition()+` Expecting `+Ie.join(", ")+", got '"+(this.terminals_[W]||W)+"'":Ee="Parse error on line "+(N+1)+": Unexpected "+(W==$?"end of input":"'"+(this.terminals_[W]||W)+"'"),this.parseError(Ee,{text:H.match,token:this.terminals_[W]||W,line:H.yylineno,loc:oe,expected:Ie})}if(se[0]instanceof Array&&se.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+W);switch(se[0]){case 1:M.push(W),T.push(H.yytext),I.push(H.yylloc),M.push(se[1]),W=null,Y?(W=Y,Y=null):(O=H.yyleng,D=H.yytext,N=H.yylineno,oe=H.yylloc,B>0&&B--);break;case 2:if(ae=this.productions_[se[1]][1],te.$=T[T.length-ae],te._$={first_line:I[I.length-(ae||1)].first_line,last_line:I[I.length-1].last_line,first_column:I[I.length-(ae||1)].first_column,last_column:I[I.length-1].last_column},K&&(te._$.range=[I[I.length-(ae||1)].range[0],I[I.length-1].range[1]]),ue=this.performAction.apply(te,[D,O,N,J.yy,se[1],T,I].concat(z)),typeof ue<"u")return ue;ae&&(M=M.slice(0,-1*ae*2),T=T.slice(0,-1*ae),I=I.slice(0,-1*ae)),M.push(this.productions_[se[1]][0]),T.push(te.$),I.push(te._$),we=A[M[M.length-2]][M[M.length-1]],M.push(we);break;case 3:return!0}}return!0},"parse")},k=function(){var L={EOF:1,parseError:v(function(C,M){if(this.yy.parser)this.yy.parser.parseError(C,M);else throw new Error(C)},"parseError"),setInput:v(function(S,C){return this.yy=C||this.yy||{},this._input=S,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var S=this._input[0];this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S;var C=S.match(/(?:\r\n?|\n).*/g);return C?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),S},"input"),unput:v(function(S){var C=S.length,M=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-C),this.offset-=C;var R=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),M.length-1&&(this.yylineno-=M.length-1);var T=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:M?(M.length===R.length?this.yylloc.first_column:0)+R[R.length-M.length].length-M[0].length:this.yylloc.first_column-C},this.options.ranges&&(this.yylloc.range=[T[0],T[0]+this.yyleng-C]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(S){this.unput(this.match.slice(S))},"less"),pastInput:v(function(){var S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var S=this.match;return S.length<20&&(S+=this._input.substr(0,20-S.length)),(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var S=this.pastInput(),C=new Array(S.length+1).join("-");return S+this.upcomingInput()+` `+C+"^"},"showPosition"),test_match:v(function(S,C){var M,R,T;if(this.options.backtrack_lexer&&(T={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(T.yylloc.range=this.yylloc.range.slice(0))),R=S[0].match(/(?:\r\n?|\n).*/g),R&&(this.yylineno+=R.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:R?R[R.length-1].length-R[R.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+S[0].length},this.yytext+=S[0],this.match+=S[0],this.matches=S,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(S[0].length),this.matched+=S[0],M=this.performAction.call(this,this.yy,this,C,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),M)return M;if(this._backtrack){for(var I in T)this[I]=T[I];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var S,C,M,R;this._more||(this.yytext="",this.match="");for(var T=this._currentRules(),I=0;IC[0].length)){if(C=M,R=I,this.options.backtrack_lexer){if(S=this.test_match(M,T[I]),S!==!1)return S;if(this._backtrack){C=!1;continue}else return!1}else if(!this.options.flex)break}return C?(S=this.test_match(C,T[R]),S!==!1?S:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var C=this.next();return C||this.lex()},"lex"),begin:v(function(C){this.conditionStack.push(C)},"begin"),popState:v(function(){var C=this.conditionStack.length-1;return C>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},"topState"),pushState:v(function(C){this.begin(C)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(C,M,R,T){var I=T;switch(R){case 0:return this.pushState("shapeData"),M.yytext="",24;break;case 1:return this.pushState("shapeDataStr"),24;break;case 2:return this.popState(),24;break;case 3:let A=/\n\s*/g;return M.yytext=M.yytext.replace(A,"
    "),24;break;case 4:return 24;case 5:this.popState();break;case 6:return C.getLogger().trace("Found comment",M.yytext),6;break;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;break;case 10:this.popState();break;case 11:C.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return C.getLogger().trace("SPACELINE"),6;break;case 13:return 7;case 14:return 16;case 15:C.getLogger().trace("end icon"),this.popState();break;case 16:return C.getLogger().trace("Exploding node"),this.begin("NODE"),20;break;case 17:return C.getLogger().trace("Cloud"),this.begin("NODE"),20;break;case 18:return C.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;break;case 19:return C.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;break;case 20:return this.begin("NODE"),20;break;case 21:return this.begin("NODE"),20;break;case 22:return this.begin("NODE"),20;break;case 23:return this.begin("NODE"),20;break;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:C.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return C.getLogger().trace("description:",M.yytext),"NODE_DESCR";break;case 32:this.popState();break;case 33:return this.popState(),C.getLogger().trace("node end ))"),"NODE_DEND";break;case 34:return this.popState(),C.getLogger().trace("node end )"),"NODE_DEND";break;case 35:return this.popState(),C.getLogger().trace("node end ...",M.yytext),"NODE_DEND";break;case 36:return this.popState(),C.getLogger().trace("node end (("),"NODE_DEND";break;case 37:return this.popState(),C.getLogger().trace("node end (-"),"NODE_DEND";break;case 38:return this.popState(),C.getLogger().trace("node end (-"),"NODE_DEND";break;case 39:return this.popState(),C.getLogger().trace("node end (("),"NODE_DEND";break;case 40:return this.popState(),C.getLogger().trace("node end (("),"NODE_DEND";break;case 41:return C.getLogger().trace("Long description:",M.yytext),21;break;case 42:return C.getLogger().trace("Long description:",M.yytext),21;break}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return L}();_.lexer=k;function E(){this.yy={}}return v(E,"Parser"),E.prototype=_,_.Parser=E,new E}();oO.parser=oO;sje=oO,el=[],cO=[],lO=0,uO={},oje=v(()=>{el=[],cO=[],lO=0,uO={}},"clear"),lje=v(t=>{if(el.length===0)return null;let e=el[0].level,r=null;for(let n=el.length-1;n>=0;n--)if(el[n].level===e&&!r&&(r=el[n]),el[n].levelo.parentId===i.id);for(let o of s){let l={id:o.id,parentId:i.id,label:yr(o.label??"",n),isGroup:!1,ticket:o?.ticket,priority:o?.priority,assigned:o?.assigned,icon:o?.icon,shape:"kanbanItem",level:o.level,rx:5,ry:5,cssStyles:["text-align: left"]};e.push(l)}}return{nodes:e,edges:t,other:{},config:pe()}},"getData"),uje=v((t,e,r,n,i)=>{let a=pe(),s=a.mindmap?.padding??sr.mindmap.padding;switch(n){case Fi.ROUNDED_RECT:case Fi.RECT:case Fi.HEXAGON:s*=2}let o={id:yr(e,a)||"kbn"+lO++,level:t,label:yr(r,a),width:a.mindmap?.maxNodeWidth??sr.mindmap.maxNodeWidth,padding:s,isGroup:!1};if(i!==void 0){let u;i.includes(` `)?u=i+` `:u=`{ `+i+` }`;let h=sp(u,{schema:ap});if(h.shape&&(h.shape!==h.shape.toLowerCase()||h.shape.includes("_")))throw new Error(`No such shape: ${h.shape}. Shape names should be lowercase.`);h?.shape&&h.shape==="kanbanItem"&&(o.shape=h?.shape),h?.label&&(o.label=h?.label),h?.icon&&(o.icon=h?.icon),h?.assigned&&(o.assigned=h?.assigned),h?.ticket&&(o.ticket=h?.ticket),h?.priority&&(o.priority=h?.priority)}let l=lje(t);l?o.parentId=l.id||"kbn"+lO++:cO.push(o),el.push(o)},"addNode"),Fi={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},hje=v((t,e)=>{switch(re.debug("In get type",t,e),t){case"[":return Fi.RECT;case"(":return e===")"?Fi.ROUNDED_RECT:Fi.CLOUD;case"((":return Fi.CIRCLE;case")":return Fi.CLOUD;case"))":return Fi.BANG;case"{{":return Fi.HEXAGON;default:return Fi.DEFAULT}},"getType"),fje=v((t,e)=>{uO[t]=e},"setElementForId"),dje=v(t=>{if(!t)return;let e=pe(),r=el[el.length-1];t.icon&&(r.icon=yr(t.icon,e)),t.class&&(r.cssClasses=yr(t.class,e))},"decorateNode"),pje=v(t=>{switch(t){case Fi.DEFAULT:return"no-border";case Fi.RECT:return"rect";case Fi.ROUNDED_RECT:return"rounded-rect";case Fi.CIRCLE:return"circle";case Fi.CLOUD:return"cloud";case Fi.BANG:return"bang";case Fi.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),gje=v(()=>re,"getLogger"),mje=v(t=>uO[t],"getElementById"),vje={clear:oje,addNode:uje,getSections:xpe,getData:cje,nodeType:Fi,getType:hje,setElementForId:fje,decorateNode:dje,type2Str:pje,getLogger:gje,getElementById:mje},yje=vje,xje=v(async(t,e,r,n)=>{re.debug(`Rendering kanban diagram `+t);let a=n.db.getData(),s=pe();s.htmlLabels=!1;let o=La(e),l=o.append("g");l.attr("class","sections");let u=o.append("g");u.attr("class","items");let h=a.nodes.filter(y=>y.isGroup),f=0,d=10,p=[],g=25;for(let y of h){let x=s?.kanban?.sectionWidth||200;f=f+1,y.x=x*f+(f-1)*d/2,y.width=x,y.y=0,y.height=x*3,y.rx=5,y.ry=5,y.cssClasses=y.cssClasses+" section-"+f;let b=await tg(l,y);g=Math.max(g,b?.labelBBox?.height),p.push(b)}let m=0;for(let y of h){let x=p[m];m=m+1;let b=s?.kanban?.sectionWidth||200,w=-b*3/2+g,_=w,k=a.nodes.filter(S=>S.parentId===y.id);for(let S of k){if(S.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");S.x=y.x,S.width=b-1.5*d;let M=(await wd(u,S,{config:s})).node().getBBox();S.y=_+M.height/2,await Jv(S),_=S.y+M.height/2+d/2}let E=x.cluster.select("rect"),L=Math.max(_-w+3*d,50)+(g-25);E.attr("height",L)}il(void 0,o,s.mindmap?.padding??sr.kanban.padding,s.mindmap?.useMaxWidth??sr.kanban.useMaxWidth)},"draw"),bje={draw:xje},wje=v(t=>{let e="";for(let n=0;nt.darkMode?Lt(n,i):kt(n,i),"adjuster");for(let n=0;n` .edge { stroke-width: 3; } ${wje(t)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${t.git0}; } .section-root text { fill: ${t.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .cluster-label, .label { color: ${t.textColor}; fill: ${t.textColor}; } .kanban-label { dy: 1em; alignment-baseline: middle; text-anchor: middle; dominant-baseline: middle; text-align: center; } `,"getStyles"),Tje=kje,Eje={db:yje,renderer:bje,parser:sje,styles:Tje}});function Yx(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r=i)&&(r=i)}return r}var kpe=F(()=>{});function l1(t,e){let r;if(e===void 0)for(let n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}var Tpe=F(()=>{});function c1(t,e){let r=0;if(e===void 0)for(let n of t)(n=+n)&&(r+=n);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&(r+=i)}return r}var Epe=F(()=>{});var hO=F(()=>{kpe();Tpe();Epe()});function Sje(t){return t.target.depth}function fO(t){return t.depth}function dO(t,e){return e-1-t.height}function Xx(t,e){return t.sourceLinks.length?t.depth:e-1}function pO(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?l1(t.sourceLinks,Sje)-1:0}var gO=F(()=>{hO()});function u1(t){return function(){return t}}var Spe=F(()=>{});function Cpe(t,e){return hE(t.source,e.source)||t.index-e.index}function Ape(t,e){return hE(t.target,e.target)||t.index-e.index}function hE(t,e){return t.y0-e.y0}function mO(t){return t.value}function Cje(t){return t.index}function Aje(t){return t.nodes}function _je(t){return t.links}function _pe(t,e){let r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function Lpe({nodes:t}){for(let e of t){let r=e.y0,n=r;for(let i of e.sourceLinks)i.y0=r+i.width/2,r+=i.width;for(let i of e.targetLinks)i.y1=n+i.width/2,n+=i.width}}function fE(){let t=0,e=0,r=1,n=1,i=24,a=8,s,o=Cje,l=Xx,u,h,f=Aje,d=_je,p=6;function g(){let D={nodes:f.apply(null,arguments),links:d.apply(null,arguments)};return m(D),y(D),x(D),b(D),k(D),Lpe(D),D}g.update=function(D){return Lpe(D),D},g.nodeId=function(D){return arguments.length?(o=typeof D=="function"?D:u1(D),g):o},g.nodeAlign=function(D){return arguments.length?(l=typeof D=="function"?D:u1(D),g):l},g.nodeSort=function(D){return arguments.length?(u=D,g):u},g.nodeWidth=function(D){return arguments.length?(i=+D,g):i},g.nodePadding=function(D){return arguments.length?(a=s=+D,g):a},g.nodes=function(D){return arguments.length?(f=typeof D=="function"?D:u1(D),g):f},g.links=function(D){return arguments.length?(d=typeof D=="function"?D:u1(D),g):d},g.linkSort=function(D){return arguments.length?(h=D,g):h},g.size=function(D){return arguments.length?(t=e=0,r=+D[0],n=+D[1],g):[r-t,n-e]},g.extent=function(D){return arguments.length?(t=+D[0][0],r=+D[1][0],e=+D[0][1],n=+D[1][1],g):[[t,e],[r,n]]},g.iterations=function(D){return arguments.length?(p=+D,g):p};function m({nodes:D,links:N}){for(let[B,P]of D.entries())P.index=B,P.sourceLinks=[],P.targetLinks=[];let O=new Map(D.map((B,P)=>[o(B,P,D),B]));for(let[B,P]of N.entries()){P.index=B;let{source:$,target:z}=P;typeof $!="object"&&($=P.source=_pe(O,$)),typeof z!="object"&&(z=P.target=_pe(O,z)),$.sourceLinks.push(P),z.targetLinks.push(P)}if(h!=null)for(let{sourceLinks:B,targetLinks:P}of D)B.sort(h),P.sort(h)}function y({nodes:D}){for(let N of D)N.value=N.fixedValue===void 0?Math.max(c1(N.sourceLinks,mO),c1(N.targetLinks,mO)):N.fixedValue}function x({nodes:D}){let N=D.length,O=new Set(D),B=new Set,P=0;for(;O.size;){for(let $ of O){$.depth=P;for(let{target:z}of $.sourceLinks)B.add(z)}if(++P>N)throw new Error("circular link");O=B,B=new Set}}function b({nodes:D}){let N=D.length,O=new Set(D),B=new Set,P=0;for(;O.size;){for(let $ of O){$.height=P;for(let{source:z}of $.targetLinks)B.add(z)}if(++P>N)throw new Error("circular link");O=B,B=new Set}}function w({nodes:D}){let N=Yx(D,P=>P.depth)+1,O=(r-t-i)/(N-1),B=new Array(N);for(let P of D){let $=Math.max(0,Math.min(N-1,Math.floor(l.call(null,P,N))));P.layer=$,P.x0=t+$*O,P.x1=P.x0+i,B[$]?B[$].push(P):B[$]=[P]}if(u)for(let P of B)P.sort(u);return B}function _(D){let N=l1(D,O=>(n-e-(O.length-1)*s)/c1(O,mO));for(let O of D){let B=e;for(let P of O){P.y0=B,P.y1=B+P.value*N,B=P.y1+s;for(let $ of P.sourceLinks)$.width=$.value*N}B=(n-B+s)/(O.length+1);for(let P=0;PO.length)-1)),_(N);for(let O=0;O0))continue;let X=(H/J-z.y0)*N;z.y0+=X,z.y1+=X,R(z)}u===void 0&&$.sort(hE),S($,O)}}function L(D,N,O){for(let B=D.length,P=B-2;P>=0;--P){let $=D[P];for(let z of $){let H=0,J=0;for(let{target:oe,value:K}of z.sourceLinks){let ee=K*(oe.layer-z.layer);H+=A(z,oe)*ee,J+=ee}if(!(J>0))continue;let X=(H/J-z.y0)*N;z.y0+=X,z.y1+=X,R(z)}u===void 0&&$.sort(hE),S($,O)}}function S(D,N){let O=D.length>>1,B=D[O];M(D,B.y0-s,O-1,N),C(D,B.y1+s,O+1,N),M(D,n,D.length-1,N),C(D,e,0,N)}function C(D,N,O,B){for(;O1e-6&&(P.y0+=$,P.y1+=$),N=P.y1+s}}function M(D,N,O,B){for(;O>=0;--O){let P=D[O],$=(P.y1-N)*B;$>1e-6&&(P.y0-=$,P.y1-=$),N=P.y0-s}}function R({sourceLinks:D,targetLinks:N}){if(h===void 0){for(let{source:{sourceLinks:O}}of N)O.sort(Ape);for(let{target:{targetLinks:O}}of D)O.sort(Cpe)}}function T(D){if(h===void 0)for(let{sourceLinks:N,targetLinks:O}of D)N.sort(Ape),O.sort(Cpe)}function I(D,N){let O=D.y0-(D.sourceLinks.length-1)*s/2;for(let{target:B,width:P}of D.sourceLinks){if(B===N)break;O+=P+s}for(let{source:B,width:P}of N.targetLinks){if(B===D)break;O-=P}return O}function A(D,N){let O=N.y0-(N.targetLinks.length-1)*s/2;for(let{source:B,width:P}of N.targetLinks){if(B===D)break;O+=P+s}for(let{target:B,width:P}of D.sourceLinks){if(B===N)break;O-=P}return O}return g}var Rpe=F(()=>{hO();gO();Spe()});function xO(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Npe(){return new xO}var vO,yO,G0,Lje,bO,Ipe=F(()=>{vO=Math.PI,yO=2*vO,G0=1e-6,Lje=yO-G0;xO.prototype=Npe.prototype={constructor:xO,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,r,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+r)+","+(this._y1=+n)},bezierCurveTo:function(t,e,r,n,i,a){this._+="C"+ +t+","+ +e+","+ +r+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,r,n,i){t=+t,e=+e,r=+r,n=+n,i=+i;var a=this._x1,s=this._y1,o=r-t,l=n-e,u=a-t,h=s-e,f=u*u+h*h;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>G0)if(!(Math.abs(h*o-l*u)>G0)||!i)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var d=r-a,p=n-s,g=o*o+l*l,m=d*d+p*p,y=Math.sqrt(g),x=Math.sqrt(f),b=i*Math.tan((vO-Math.acos((g+f-m)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>G0&&(this._+="L"+(t+w*u)+","+(e+w*h)),this._+="A"+i+","+i+",0,0,"+ +(h*d>u*p)+","+(this._x1=t+_*o)+","+(this._y1=e+_*l)}},arc:function(t,e,r,n,i,a){t=+t,e=+e,r=+r,a=!!a;var s=r*Math.cos(n),o=r*Math.sin(n),l=t+s,u=e+o,h=1^a,f=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+l+","+u:(Math.abs(this._x1-l)>G0||Math.abs(this._y1-u)>G0)&&(this._+="L"+l+","+u),r&&(f<0&&(f=f%yO+yO),f>Lje?this._+="A"+r+","+r+",0,1,"+h+","+(t-s)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):f>G0&&(this._+="A"+r+","+r+",0,"+ +(f>=vO)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};bO=Npe});var Mpe=F(()=>{Ipe()});function wO(t){return function(){return t}}var Dpe=F(()=>{});function Ope(t){return t[0]}function Ppe(t){return t[1]}var Bpe=F(()=>{});var Fpe,zpe=F(()=>{Fpe=Array.prototype.slice});function Rje(t){return t.source}function Nje(t){return t.target}function Ije(t){var e=Rje,r=Nje,n=Ope,i=Ppe,a=null;function s(){var o,l=Fpe.call(arguments),u=e.apply(this,l),h=r.apply(this,l);if(a||(a=o=bO()),t(a,+n.apply(this,(l[0]=u,l)),+i.apply(this,l),+n.apply(this,(l[0]=h,l)),+i.apply(this,l)),o)return a=null,o+""||null}return s.source=function(o){return arguments.length?(e=o,s):e},s.target=function(o){return arguments.length?(r=o,s):r},s.x=function(o){return arguments.length?(n=typeof o=="function"?o:wO(+o),s):n},s.y=function(o){return arguments.length?(i=typeof o=="function"?o:wO(+o),s):i},s.context=function(o){return arguments.length?(a=o??null,s):a},s}function Mje(t,e,r,n,i){t.moveTo(e,r),t.bezierCurveTo(e=(e+n)/2,r,e,i,n,i)}function kO(){return Ije(Mje)}var $pe=F(()=>{Mpe();zpe();Dpe();Bpe()});var Gpe=F(()=>{$pe()});function Dje(t){return[t.source.x1,t.y0]}function Oje(t){return[t.target.x0,t.y1]}function TO(){return kO().source(Dje).target(Oje)}var Upe=F(()=>{Gpe()});var Vpe=F(()=>{Rpe();gO();Upe()});var Hpe={};vr(Hpe,{diagram:()=>Kje});var EO,dE,gE,mE,pE,Pje,Bje,Fje,zje,$je,Gje,Uje,Vje,Wje,Wpe,Hje,qje,Yje,Xje,jje,Kje,qpe=F(()=>{or();lr();Vpe();EO=function(){var t=v(function(o,l,u,h){for(u=u||{},h=o.length;h--;u[o[h]]=l);return u},"o"),e=[1,9],r=[1,10],n=[1,5,10,12],i={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:v(function(l,u,h,f,d,p,g){var m=p.length-1;switch(d){case 7:let y=f.findOrCreateNode(p[m-4].trim().replaceAll('""','"')),x=f.findOrCreateNode(p[m-2].trim().replaceAll('""','"')),b=parseFloat(p[m].trim());f.addLink(y,x,b);break;case 8:case 9:case 11:this.$=p[m];break;case 10:this.$=p[m-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:e,20:r},{1:[2,6],7:11,10:[1,12]},t(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(n,[2,8]),t(n,[2,9]),{19:[1,16]},t(n,[2,11]),{1:[2,1]},{1:[2,5]},t(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:e,20:r},{15:18,16:7,17:8,18:e,20:r},{18:[1,19]},t(r,[2,3]),{12:[1,20]},t(n,[2,10]),{15:21,16:7,17:8,18:e,20:r},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:v(function(l,u){if(u.recoverable)this.trace(l);else{var h=new Error(l);throw h.hash=u,h}},"parseError"),parse:v(function(l){var u=this,h=[0],f=[],d=[null],p=[],g=this.table,m="",y=0,x=0,b=0,w=2,_=1,k=p.slice.call(arguments,1),E=Object.create(this.lexer),L={yy:{}};for(var S in this.yy)Object.prototype.hasOwnProperty.call(this.yy,S)&&(L.yy[S]=this.yy[S]);E.setInput(l,L.yy),L.yy.lexer=E,L.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var C=E.yylloc;p.push(C);var M=E.options&&E.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function R(oe){h.length=h.length-2*oe,d.length=d.length-oe,p.length=p.length-oe}v(R,"popStack");function T(){var oe;return oe=f.pop()||E.lex()||_,typeof oe!="number"&&(oe instanceof Array&&(f=oe,oe=f.pop()),oe=u.symbols_[oe]||oe),oe}v(T,"lex");for(var I,A,D,N,O,B,P={},$,z,H,J;;){if(D=h[h.length-1],this.defaultActions[D]?N=this.defaultActions[D]:((I===null||typeof I>"u")&&(I=T()),N=g[D]&&g[D][I]),typeof N>"u"||!N.length||!N[0]){var X="";J=[];for($ in g[D])this.terminals_[$]&&$>w&&J.push("'"+this.terminals_[$]+"'");E.showPosition?X="Parse error on line "+(y+1)+`: `+E.showPosition()+` Expecting `+J.join(", ")+", got '"+(this.terminals_[I]||I)+"'":X="Parse error on line "+(y+1)+": Unexpected "+(I==_?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(X,{text:E.match,token:this.terminals_[I]||I,line:E.yylineno,loc:C,expected:J})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+D+", token: "+I);switch(N[0]){case 1:h.push(I),d.push(E.yytext),p.push(E.yylloc),h.push(N[1]),I=null,A?(I=A,A=null):(x=E.yyleng,m=E.yytext,y=E.yylineno,C=E.yylloc,b>0&&b--);break;case 2:if(z=this.productions_[N[1]][1],P.$=d[d.length-z],P._$={first_line:p[p.length-(z||1)].first_line,last_line:p[p.length-1].last_line,first_column:p[p.length-(z||1)].first_column,last_column:p[p.length-1].last_column},M&&(P._$.range=[p[p.length-(z||1)].range[0],p[p.length-1].range[1]]),B=this.performAction.apply(P,[m,x,y,L.yy,N[1],d,p].concat(k)),typeof B<"u")return B;z&&(h=h.slice(0,-1*z*2),d=d.slice(0,-1*z),p=p.slice(0,-1*z)),h.push(this.productions_[N[1]][0]),d.push(P.$),p.push(P._$),H=g[h[h.length-2]][h[h.length-1]],h.push(H);break;case 3:return!0}}return!0},"parse")},a=function(){var o={EOF:1,parseError:v(function(u,h){if(this.yy.parser)this.yy.parser.parseError(u,h);else throw new Error(u)},"parseError"),setInput:v(function(l,u){return this.yy=u||this.yy||{},this._input=l,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var u=l.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:v(function(l){var u=l.length,h=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===f.length?this.yylloc.first_column:0)+f[f.length-h.length].length-h[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(l){this.unput(this.match.slice(l))},"less"),pastInput:v(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var l=this.pastInput(),u=new Array(l.length+1).join("-");return l+this.upcomingInput()+` `+u+"^"},"showPosition"),test_match:v(function(l,u){var h,f,d;if(this.options.backtrack_lexer&&(d={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(d.yylloc.range=this.yylloc.range.slice(0))),f=l[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+l[0].length},this.yytext+=l[0],this.match+=l[0],this.matches=l,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(l[0].length),this.matched+=l[0],h=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),h)return h;if(this._backtrack){for(var p in d)this[p]=d[p];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,u,h,f;this._more||(this.yytext="",this.match="");for(var d=this._currentRules(),p=0;pu[0].length)){if(u=h,f=p,this.options.backtrack_lexer){if(l=this.test_match(h,d[p]),l!==!1)return l;if(this._backtrack){u=!1;continue}else return!1}else if(!this.options.flex)break}return u?(l=this.test_match(u,d[f]),l!==!1?l:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var u=this.next();return u||this.lex()},"lex"),begin:v(function(u){this.conditionStack.push(u)},"begin"),popState:v(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:v(function(u){this.begin(u)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:v(function(u,h,f,d){var p=d;switch(f){case 0:return this.pushState("csv"),4;break;case 1:return 10;case 2:return 5;case 3:return 12;case 4:return this.pushState("escaped_text"),18;break;case 5:return 20;case 6:return this.popState("escaped_text"),18;break;case 7:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[1,2,3,4,5,6,7],inclusive:!1},escaped_text:{rules:[6,7],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return o}();i.lexer=a;function s(){this.yy={}}return v(s,"Parser"),s.prototype=i,i.Parser=s,new s}();EO.parser=EO;dE=EO,gE=[],mE=[],pE=new Map,Pje=v(()=>{gE=[],mE=[],pE=new Map,xr()},"clear"),Bje=class{constructor(t,e,r=0){this.source=t,this.target=e,this.value=r}static{v(this,"SankeyLink")}},Fje=v((t,e,r)=>{gE.push(new Bje(t,e,r))},"addLink"),zje=class{constructor(t){this.ID=t}static{v(this,"SankeyNode")}},$je=v(t=>{t=Xe.sanitizeText(t,pe());let e=pE.get(t);return e===void 0&&(e=new zje(t),pE.set(t,e),mE.push(e)),e},"findOrCreateNode"),Gje=v(()=>mE,"getNodes"),Uje=v(()=>gE,"getLinks"),Vje=v(()=>({nodes:mE.map(t=>({id:t.ID})),links:gE.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),Wje={nodesMap:pE,getConfig:v(()=>pe().sankey,"getConfig"),getNodes:Gje,getLinks:Uje,getGraph:Vje,addLink:Fje,findOrCreateNode:$je,getAccTitle:_r,setAccTitle:Tr,getAccDescription:Rr,setAccDescription:Lr,getDiagramTitle:qr,setDiagramTitle:tn,clear:Pje},Wpe=class SO{static{v(this,"Uid")}static{this.count=0}static next(e){return new SO(e+ ++SO.count)}constructor(e){this.id=e,this.href=`#${e}`}toString(){return"url("+this.href+")"}},Hje={left:fO,right:dO,center:pO,justify:Xx},qje=v(function(t,e,r,n){let{securityLevel:i,sankey:a}=pe(),s=Vb.sankey,o;i==="sandbox"&&(o=Ve("#i"+e));let l=i==="sandbox"?Ve(o.nodes()[0].contentDocument.body):Ve("body"),u=i==="sandbox"?l.select(`[id="${e}"]`):Ve(`[id="${e}"]`),h=a?.width??s.width,f=a?.height??s.width,d=a?.useMaxWidth??s.useMaxWidth,p=a?.nodeAlignment??s.nodeAlignment,g=a?.prefix??s.prefix,m=a?.suffix??s.suffix,y=a?.showValues??s.showValues,x=n.db.getGraph(),b=Hje[p];fE().nodeId(M=>M.id).nodeWidth(10).nodePadding(10+(y?15:0)).nodeAlign(b).extent([[0,0],[h,f]])(x);let k=du(a8);u.append("g").attr("class","nodes").selectAll(".node").data(x.nodes).join("g").attr("class","node").attr("id",M=>(M.uid=Wpe.next("node-")).id).attr("transform",function(M){return"translate("+M.x0+","+M.y0+")"}).attr("x",M=>M.x0).attr("y",M=>M.y0).append("rect").attr("height",M=>M.y1-M.y0).attr("width",M=>M.x1-M.x0).attr("fill",M=>k(M.id));let E=v(({id:M,value:R})=>y?`${M} ${g}${Math.round(R*100)/100}${m}`:M,"getText");u.append("g").attr("class","node-labels").attr("font-family","sans-serif").attr("font-size",14).selectAll("text").data(x.nodes).join("text").attr("x",M=>M.x0(M.y1+M.y0)/2).attr("dy",`${y?"0":"0.35"}em`).attr("text-anchor",M=>M.x0(R.uid=Wpe.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",R=>R.source.x1).attr("x2",R=>R.target.x0);M.append("stop").attr("offset","0%").attr("stop-color",R=>k(R.source.id)),M.append("stop").attr("offset","100%").attr("stop-color",R=>k(R.target.id))}let C;switch(S){case"gradient":C=v(M=>M.uid,"coloring");break;case"source":C=v(M=>k(M.source.id),"coloring");break;case"target":C=v(M=>k(M.target.id),"coloring");break;default:C=S}L.append("path").attr("d",TO()).attr("stroke",C).attr("stroke-width",M=>Math.max(1,M.width)),il(void 0,u,0,d)},"draw"),Yje={draw:qje},Xje=v(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` `).trim(),"prepareTextForParsing"),jje=dE.parse.bind(dE);dE.parse=t=>jje(Xje(t));Kje={parser:dE,db:Wje,renderer:Yje}});var Xpe={};vr(Xpe,{diagram:()=>hKe});var Ype,CO,Zje,Qje,Jje,eKe,tKe,h1,rKe,nKe,iKe,aKe,sKe,oKe,lKe,cKe,uKe,hKe,jpe=F(()=>{ky();kn();Iu();or();km();Ype={packet:[]},CO=structuredClone(Ype),Zje=sr.packet,Qje=v(()=>{let t=ws({...Zje,...Or().packet});return t.showBits&&(t.paddingY+=10),t},"getConfig"),Jje=v(()=>CO.packet,"getPacket"),eKe=v(t=>{t.length>0&&CO.packet.push(t)},"pushWord"),tKe=v(()=>{xr(),CO=structuredClone(Ype)},"clear"),h1={pushWord:eKe,getPacket:Jje,getConfig:Qje,clear:tKe,setAccTitle:Tr,getAccTitle:_r,setDiagramTitle:tn,getDiagramTitle:qr,getAccDescription:Rr,setAccDescription:Lr},rKe=1e4,nKe=v(t=>{Pu(t,h1);let e=-1,r=[],n=1,{bitsPerRow:i}=h1.getConfig();for(let{start:a,end:s,label:o}of t.blocks){if(s&&s{if(t.end===void 0&&(t.end=t.start),t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);return t.end+1<=e*r?[t,void 0]:[{start:t.start,end:e*r-1,label:t.label},{start:e*r,end:t.end,label:t.label}]},"getNextFittingBlock"),aKe={parse:v(async t=>{let e=await Nl("packet",t);re.debug(e),nKe(e)},"parse")},sKe=v((t,e,r,n)=>{let i=n.db,a=i.getConfig(),{rowHeight:s,paddingY:o,bitWidth:l,bitsPerRow:u}=a,h=i.getPacket(),f=i.getDiagramTitle(),d=s+o,p=d*(h.length+1)-(f?0:s),g=l*u+2,m=La(e);m.attr("viewbox",`0 0 ${g} ${p}`),Hr(m,p,g,a.useMaxWidth);for(let[y,x]of h.entries())oKe(m,x,y,a);m.append("text").text(f).attr("x",g/2).attr("y",p-d/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),oKe=v((t,e,r,{rowHeight:n,paddingX:i,paddingY:a,bitWidth:s,bitsPerRow:o,showBits:l})=>{let u=t.append("g"),h=r*(n+a)+a;for(let f of e){let d=f.start%o*s+1,p=(f.end-f.start+1)*s-i;if(u.append("rect").attr("x",d).attr("y",h).attr("width",p).attr("height",n).attr("class","packetBlock"),u.append("text").attr("x",d+p/2).attr("y",h+n/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(f.label),!l)continue;let g=f.end===f.start,m=h-2;u.append("text").attr("x",d+(g?p/2:0)).attr("y",m).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",g?"middle":"start").text(f.start),g||u.append("text").attr("x",d+p).attr("y",m).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(f.end)}},"drawWord"),lKe={draw:sKe},cKe={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},uKe=v(({packet:t}={})=>{let e=ws(cKe,t);return` .packetByte { font-size: ${e.byteFontSize}; } .packetByte.start { fill: ${e.startByteColor}; } .packetByte.end { fill: ${e.endByteColor}; } .packetLabel { fill: ${e.labelColor}; font-size: ${e.labelFontSize}; } .packetTitle { fill: ${e.titleColor}; font-size: ${e.titleFontSize}; } .packetBlock { stroke: ${e.blockStrokeColor}; stroke-width: ${e.blockStrokeWidth}; fill: ${e.blockFillColor}; } `},"styles"),hKe={parser:aKe,db:h1,renderer:lKe,styles:uKe}});var Sge={};vr(Sge,{diagram:()=>PZe});function oge(t){switch(re.debug("typeStr2Type",t),t){case"[]":return"square";case"()":return re.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function lge(t){switch(re.debug("typeStr2Type",t),t){case"==":return"thick";default:return"normal"}}function cge(t){switch(t.trim()){case"--x":return"arrow_cross";case"--o":return"arrow_circle";default:return"arrow_point"}}function uge(t,e){if(t===0||!Number.isInteger(t))throw new Error("Columns must be an integer !== 0.");if(e<0||!Number.isInteger(e))throw new Error("Position must be a non-negative integer."+e);if(t<0)return{px:e,py:0};if(t===1)return{px:0,py:e};let r=e%t,n=Math.floor(e/t);return{px:r,py:n}}function bE(t,e,r=0,n=0){re.debug("setBlockSizes abc95 (start)",t.id,t?.size?.x,"block width =",t?.size,"sieblingWidth",r),t?.size?.width||(t.size={width:r,height:n,x:0,y:0});let i=0,a=0;if(t.children?.length>0){for(let p of t.children)bE(p,e);let s=qKe(t);i=s.width,a=s.height,re.debug("setBlockSizes abc95 maxWidth of",t.id,":s children is ",i,a);for(let p of t.children)p.size&&(re.debug(`abc95 Setting size of children of ${t.id} id=${p.id} ${i} ${a} ${JSON.stringify(p.size)}`),p.size.width=i*(p.widthInColumns??1)+fi*((p.widthInColumns??1)-1),p.size.height=a,p.size.x=0,p.size.y=0,re.debug(`abc95 updating size of ${t.id} children child:${p.id} maxWidth:${i} maxHeight:${a}`));for(let p of t.children)bE(p,e,i,a);let o=t.columns??-1,l=0;for(let p of t.children)l+=p.widthInColumns??1;let u=t.children.length;o>0&&o0?Math.min(t.children.length,o):t.children.length;if(p>0){let g=(f-p*fi-fi)/p;re.debug("abc95 (growing to fit) width",t.id,f,t.size?.width,g);for(let m of t.children)m.size&&(m.size.width=g)}}t.size={width:f,height:d,x:0,y:0}}re.debug("setBlockSizes abc94 (done)",t.id,t?.size?.x,t?.size?.width,t?.size?.y,t?.size?.height)}function DO(t,e){re.debug(`abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${t?.size?.x} y: ${t?.size?.y} width: ${t?.size?.width}`);let r=t.columns??-1;if(re.debug("layoutBlocks columns abc95",t.id,"=>",r,t),t.children&&t.children.length>0){let n=t?.children[0]?.size?.width??0,i=t.children.length*n+(t.children.length-1)*fi;re.debug("widthOfChildren 88",i,"posX");let a=0;re.debug("abc91 block?.size?.x",t.id,t?.size?.x);let s=t?.size?.x?t?.size?.x+(-t?.size?.width/2||0):-fi,o=0;for(let l of t.children){let u=t;if(!l.size)continue;let{width:h,height:f}=l.size,{px:d,py:p}=uge(r,a);if(p!=o&&(o=p,s=t?.size?.x?t?.size?.x+(-t?.size?.width/2||0):-fi,re.debug("New row in layout for block",t.id," and child ",l.id,o)),re.debug(`abc89 layout blocks (child) id: ${l.id} Pos: ${a} (px, py) ${d},${p} (${u?.size?.x},${u?.size?.y}) parent: ${u.id} width: ${h}${fi}`),u.size){let g=h/2;l.size.x=s+fi+g,re.debug(`abc91 layout blocks (calc) px, pyid:${l.id} startingPos=X${s} new startingPosX${l.size.x} ${g} padding=${fi} width=${h} halfWidth=${g} => x:${l.size.x} y:${l.size.y} ${l.widthInColumns} (width * (child?.w || 1)) / 2 ${h*(l?.widthInColumns??1)/2}`),s=l.size.x+g,l.size.y=u.size.y-u.size.height/2+p*(f+fi)+f/2+fi,re.debug(`abc88 layout blocks (calc) px, pyid:${l.id}startingPosX${s}${fi}${g}=>x:${l.size.x}y:${l.size.y}${l.widthInColumns}(width * (child?.w || 1)) / 2${h*(l?.widthInColumns??1)/2}`)}l.children&&DO(l,e),a+=l?.widthInColumns??1,re.debug("abc88 columnsPos",l,a)}}re.debug(`layout blocks (<==layoutBlocks) ${t.id} x: ${t?.size?.x} y: ${t?.size?.y} width: ${t?.size?.width}`)}function OO(t,{minX:e,minY:r,maxX:n,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(t.size&&t.id!=="root"){let{x:a,y:s,width:o,height:l}=t.size;a-o/2n&&(n=a+o/2),s+l/2>i&&(i=s+l/2)}if(t.children)for(let a of t.children)({minX:e,minY:r,maxX:n,maxY:i}=OO(a,{minX:e,minY:r,maxX:n,maxY:i}));return{minX:e,minY:r,maxX:n,maxY:i}}function hge(t){let e=t.getBlock("root");if(!e)return;bE(e,t,0,0),DO(e,t),re.debug("getBlocks",JSON.stringify(e,null,2));let{minX:r,minY:n,maxX:i,maxY:a}=OO(e),s=a-n,o=i-r;return{x:r,y:n,width:o,height:s}}function LO(t,e){e&&t.attr("style",e)}function fge(t){let e=Ve(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),r=e.append("xhtml:div"),n=t.label,i=t.isNode?"nodeLabel":"edgeLabel",a=r.append("span");return a.html(n),LO(a,t.labelStyle),a.attr("class",i),LO(r,t.labelStyle),r.style("display","inline-block"),r.style("white-space","nowrap"),r.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}function jx(t,e){pe().flowchart.htmlLabels&&t&&(t.style.width=e.length*9+"px",t.style.height="12px")}function dge(t,e){return t.intersect(e)}function pge(t,e,r,n){var i=t.x,a=t.y,s=i-n.x,o=a-n.y,l=Math.sqrt(e*e*o*o+r*r*s*s),u=Math.abs(e*r*s/l);n.x0}function yge(t,e,r){var n=t.x,i=t.y,a=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;typeof e.forEach=="function"?e.forEach(function(g){s=Math.min(s,g.x),o=Math.min(o,g.y)}):(s=Math.min(s,e.x),o=Math.min(o,e.y));for(var l=n-t.width/2-s,u=i-t.height/2-o,h=0;h1&&a.sort(function(g,m){var y=g.x-r.x,x=g.y-r.y,b=Math.sqrt(y*y+x*x),w=m.x-r.x,_=m.y-r.y,k=Math.sqrt(w*w+_*_);return b{i.push(o,0)},"addBorder"),s=v(o=>{i.push(0,o)},"skipBorder");e.includes("t")?(re.debug("add top border"),a(r)):s(r),e.includes("r")?(re.debug("add right border"),a(n)):s(n),e.includes("b")?(re.debug("add bottom border"),a(r)):s(r),e.includes("l")?(re.debug("add left border"),a(n)):s(n),t.attr("stroke-dasharray",i.join(" "))}function PO(t,e,r=!1){let n=t,i="default";(n?.classes?.length||0)>0&&(i=(n?.classes??[]).join(" ")),i=i+" flowchart-label";let a=0,s="",o;switch(n.type){case"round":a=5,s="rect";break;case"composite":a=0,s="composite",o=0;break;case"square":s="rect";break;case"diamond":s="question";break;case"hexagon":s="hexagon";break;case"block_arrow":s="block_arrow";break;case"odd":s="rect_left_inv_arrow";break;case"lean_right":s="lean_right";break;case"lean_left":s="lean_left";break;case"trapezoid":s="trapezoid";break;case"inv_trapezoid":s="inv_trapezoid";break;case"rect_left_inv_arrow":s="rect_left_inv_arrow";break;case"circle":s="circle";break;case"ellipse":s="ellipse";break;case"stadium":s="stadium";break;case"subroutine":s="subroutine";break;case"cylinder":s="cylinder";break;case"group":s="rect";break;case"doublecircle":s="doublecircle";break;default:s="rect"}let l=G3(n?.styles??[]),u=n.label,h=n.size??{width:0,height:0,x:0,y:0};return{labelStyle:l.labelStyle,shape:s,labelText:u,rx:a,ry:a,class:i,style:l.style,id:n.id,directions:n.directions,width:h.width,height:h.height,x:h.x,y:h.y,positioned:r,intersect:void 0,type:n.type,padding:o??Or()?.block?.padding??0}}async function bge(t,e,r){let n=PO(e,r,!1);if(n.type==="group")return;let i=Or(),a=await xge(t,n,{config:i}),s=a.node().getBBox(),o=r.getBlock(n.id);o.size={width:s.width,height:s.height,x:0,y:0,node:a},r.setBlock(o),a.remove()}async function wge(t,e,r){let n=PO(e,r,!0);if(r.getBlock(n.id).type!=="space"){let a=Or();await xge(t,n,{config:a}),e.intersect=n?.intersect,IZe(n)}}async function kE(t,e,r,n){for(let i of e)await n(t,i,r),i.children&&await kE(t,i.children,r,n)}async function kge(t,e,r){await kE(t,e,r,bge)}async function Tge(t,e,r){await kE(t,e,r,wge)}async function Ege(t,e,r,n,i){let a=new Sr({multigraph:!0,compound:!0});a.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let s of r)s.size&&a.setNode(s.id,{width:s.size.width,height:s.size.height,intersect:s.intersect});for(let s of e)if(s.start&&s.end){let o=n.getBlock(s.start),l=n.getBlock(s.end);if(o?.size&&l?.size){let u=o.size,h=l.size,f=[{x:u.x,y:u.y},{x:u.x+(h.x-u.x)/2,y:u.y+(h.y-u.y)/2},{x:h.x,y:h.y}];eZe(t,{v:s.start,w:s.end,name:s.id},{...s,arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",a,i),s.label&&(await KKe(t,{...s,label:s.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),ZKe({...s,x:f[1].x,y:f[1].y},{originalPath:f}))}}}var AO,fKe,$l,IO,_O,Kpe,Zpe,dKe,age,pKe,xE,gKe,mKe,vKe,yKe,sge,MO,Kx,xKe,Qpe,bKe,wKe,kKe,TKe,EKe,SKe,CKe,AKe,_Ke,LKe,RKe,NKe,vE,IKe,MKe,DKe,OKe,PKe,BKe,FKe,zKe,$Ke,GKe,UKe,VKe,WKe,HKe,fi,qKe,YKe,tl,XKe,jKe,Jpe,RO,Ba,KKe,ZKe,QKe,JKe,ege,eZe,tZe,rZe,nZe,gge,iZe,aZe,sZe,oZe,lZe,$n,Ki,ai,cZe,uZe,tge,ho,rge,hZe,fZe,dZe,pZe,gZe,mZe,vZe,yZe,xZe,bZe,wZe,kZe,TZe,EZe,SZe,CZe,AZe,_Ze,LZe,nge,RZe,NZe,ige,yE,xge,IZe,MZe,DZe,OZe,PZe,Cge=F(()=>{pc();bo();Ya();kn();or();a_();go();lr();As();lr();lr();lr();lr();AO=function(){var t=v(function(w,_,k,E){for(k=k||{},E=w.length;E--;k[w[E]]=_);return k},"o"),e=[1,7],r=[1,13],n=[1,14],i=[1,15],a=[1,19],s=[1,16],o=[1,17],l=[1,18],u=[8,30],h=[8,21,28,29,30,31,32,40,44,47],f=[1,23],d=[1,24],p=[8,15,16,21,28,29,30,31,32,40,44,47],g=[8,15,16,21,27,28,29,30,31,32,40,44,47],m=[1,49],y={trace:v(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,block:31,NODE_ID:32,nodeShapeNLabel:33,dirList:34,DIR:35,NODE_DSTART:36,NODE_DEND:37,BLOCK_ARROW_START:38,BLOCK_ARROW_END:39,classDef:40,CLASSDEF_ID:41,CLASSDEF_STYLEOPTS:42,DEFAULT:43,class:44,CLASSENTITY_IDS:45,STYLECLASS:46,style:47,STYLE_ENTITY_IDS:48,STYLE_DEFINITION_DATA:49,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"block",32:"NODE_ID",35:"DIR",36:"NODE_DSTART",37:"NODE_DEND",38:"BLOCK_ARROW_START",39:"BLOCK_ARROW_END",40:"classDef",41:"CLASSDEF_ID",42:"CLASSDEF_STYLEOPTS",43:"DEFAULT",44:"class",45:"CLASSENTITY_IDS",46:"STYLECLASS",47:"style",48:"STYLE_ENTITY_IDS",49:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[34,1],[34,2],[33,3],[33,4],[23,3],[23,3],[24,3],[25,3]],performAction:v(function(_,k,E,L,S,C,M){var R=C.length-1;switch(S){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",C[R-1]),L.setHierarchy(C[R-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",C[R]),typeof C[R].length=="number"?this.$=C[R]:this.$=[C[R]];break;case 13:L.getLogger().debug("Rule: statement #2: ",C[R-1]),this.$=[C[R-1]].concat(C[R]);break;case 14:L.getLogger().debug("Rule: link: ",C[R],_),this.$={edgeTypeStr:C[R],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",C[R-3],C[R-1],C[R]),this.$={edgeTypeStr:C[R],label:C[R-1]};break;case 18:let T=parseInt(C[R]),I=L.generateId();this.$={id:I,type:"space",label:"",width:T,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",C[R-2],C[R-1],C[R]," typestr: ",C[R-1].edgeTypeStr);let A=L.edgeStrToEdgeData(C[R-1].edgeTypeStr);this.$=[{id:C[R-2].id,label:C[R-2].label,type:C[R-2].type,directions:C[R-2].directions},{id:C[R-2].id+"-"+C[R].id,start:C[R-2].id,end:C[R].id,label:C[R-1].label,type:"edge",directions:C[R].directions,arrowTypeEnd:A,arrowTypeStart:"arrow_open"},{id:C[R].id,label:C[R].label,type:L.typeStr2Type(C[R].typeStr),directions:C[R].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",C[R-1],C[R]),this.$={id:C[R-1].id,label:C[R-1].label,type:L.typeStr2Type(C[R-1].typeStr),directions:C[R-1].directions,widthInColumns:parseInt(C[R],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",C[R]),this.$={id:C[R].id,label:C[R].label,type:L.typeStr2Type(C[R].typeStr),directions:C[R].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",C[R]),this.$={type:"column-setting",columns:C[R]==="auto"?-1:parseInt(C[R])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",C[R-2],C[R-1]);let D=L.generateId();this.$={...C[R-2],type:"composite",children:C[R-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",C[R-2],C[R-1],C[R]);let N=L.generateId();this.$={id:N,type:"composite",label:"",children:C[R-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",C[R]),this.$={id:C[R]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",C[R-1],C[R]),this.$={id:C[R-1],label:C[R].label,typeStr:C[R].typeStr,directions:C[R].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",C[R]),this.$=[C[R]];break;case 32:L.getLogger().debug("Rule: dirList: ",C[R-1],C[R]),this.$=[C[R-1]].concat(C[R]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",C[R-2],C[R-1],C[R]),this.$={typeStr:C[R-2]+C[R],label:C[R-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",C[R-3],C[R-2]," #3:",C[R-1],C[R]),this.$={typeStr:C[R-3]+C[R],label:C[R-2],directions:C[R-1]};break;case 35:case 36:this.$={type:"classDef",id:C[R-1].trim(),css:C[R].trim()};break;case 37:this.$={type:"applyClass",id:C[R-1].trim(),styleClass:C[R].trim()};break;case 38:this.$={type:"applyStyles",id:C[R-1].trim(),stylesStr:C[R].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{11:3,13:4,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:r,29:n,31:i,32:a,40:s,44:o,47:l},{8:[1,20]},t(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,21:e,28:r,29:n,31:i,32:a,40:s,44:o,47:l}),t(h,[2,16],{14:22,15:f,16:d}),t(h,[2,17]),t(h,[2,18]),t(h,[2,19]),t(h,[2,20]),t(h,[2,21]),t(h,[2,22]),t(p,[2,25],{27:[1,25]}),t(h,[2,26]),{19:26,26:12,32:a},{11:27,13:4,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:r,29:n,31:i,32:a,40:s,44:o,47:l},{41:[1,28],43:[1,29]},{45:[1,30]},{48:[1,31]},t(g,[2,29],{33:32,36:[1,33],38:[1,34]}),{1:[2,7]},t(u,[2,13]),{26:35,32:a},{32:[2,14]},{17:[1,36]},t(p,[2,24]),{11:37,13:4,14:22,15:f,16:d,19:5,20:6,21:e,22:8,23:9,24:10,25:11,26:12,28:r,29:n,31:i,32:a,40:s,44:o,47:l},{30:[1,38]},{42:[1,39]},{42:[1,40]},{46:[1,41]},{49:[1,42]},t(g,[2,30]),{18:[1,43]},{18:[1,44]},t(p,[2,23]),{18:[1,45]},{30:[1,46]},t(h,[2,28]),t(h,[2,35]),t(h,[2,36]),t(h,[2,37]),t(h,[2,38]),{37:[1,47]},{34:48,35:m},{15:[1,50]},t(h,[2,27]),t(g,[2,33]),{39:[1,51]},{34:52,35:m,39:[2,31]},{32:[2,15]},t(g,[2,34]),{39:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:v(function(_,k){if(k.recoverable)this.trace(_);else{var E=new Error(_);throw E.hash=k,E}},"parseError"),parse:v(function(_){var k=this,E=[0],L=[],S=[null],C=[],M=this.table,R="",T=0,I=0,A=0,D=2,N=1,O=C.slice.call(arguments,1),B=Object.create(this.lexer),P={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(P.yy[$]=this.yy[$]);B.setInput(_,P.yy),P.yy.lexer=B,P.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var z=B.yylloc;C.push(z);var H=B.options&&B.options.ranges;typeof P.yy.parseError=="function"?this.parseError=P.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function J(ae){E.length=E.length-2*ae,S.length=S.length-ae,C.length=C.length-ae}v(J,"popStack");function X(){var ae;return ae=L.pop()||B.lex()||N,typeof ae!="number"&&(ae instanceof Array&&(L=ae,ae=L.pop()),ae=k.symbols_[ae]||ae),ae}v(X,"lex");for(var oe,K,ee,Q,W,Y,Z={},se,ce,ue,te;;){if(ee=E[E.length-1],this.defaultActions[ee]?Q=this.defaultActions[ee]:((oe===null||typeof oe>"u")&&(oe=X()),Q=M[ee]&&M[ee][oe]),typeof Q>"u"||!Q.length||!Q[0]){var Ne="";te=[];for(se in M[ee])this.terminals_[se]&&se>D&&te.push("'"+this.terminals_[se]+"'");B.showPosition?Ne="Parse error on line "+(T+1)+`: `+B.showPosition()+` Expecting `+te.join(", ")+", got '"+(this.terminals_[oe]||oe)+"'":Ne="Parse error on line "+(T+1)+": Unexpected "+(oe==N?"end of input":"'"+(this.terminals_[oe]||oe)+"'"),this.parseError(Ne,{text:B.match,token:this.terminals_[oe]||oe,line:B.yylineno,loc:z,expected:te})}if(Q[0]instanceof Array&&Q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ee+", token: "+oe);switch(Q[0]){case 1:E.push(oe),S.push(B.yytext),C.push(B.yylloc),E.push(Q[1]),oe=null,K?(oe=K,K=null):(I=B.yyleng,R=B.yytext,T=B.yylineno,z=B.yylloc,A>0&&A--);break;case 2:if(ce=this.productions_[Q[1]][1],Z.$=S[S.length-ce],Z._$={first_line:C[C.length-(ce||1)].first_line,last_line:C[C.length-1].last_line,first_column:C[C.length-(ce||1)].first_column,last_column:C[C.length-1].last_column},H&&(Z._$.range=[C[C.length-(ce||1)].range[0],C[C.length-1].range[1]]),Y=this.performAction.apply(Z,[R,I,T,P.yy,Q[1],S,C].concat(O)),typeof Y<"u")return Y;ce&&(E=E.slice(0,-1*ce*2),S=S.slice(0,-1*ce),C=C.slice(0,-1*ce)),E.push(this.productions_[Q[1]][0]),S.push(Z.$),C.push(Z._$),ue=M[E[E.length-2]][E[E.length-1]],E.push(ue);break;case 3:return!0}}return!0},"parse")},x=function(){var w={EOF:1,parseError:v(function(k,E){if(this.yy.parser)this.yy.parser.parseError(k,E);else throw new Error(k)},"parseError"),setInput:v(function(_,k){return this.yy=k||this.yy||{},this._input=_,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:v(function(){var _=this._input[0];this.yytext+=_,this.yyleng++,this.offset++,this.match+=_,this.matched+=_;var k=_.match(/(?:\r\n?|\n).*/g);return k?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),_},"input"),unput:v(function(_){var k=_.length,E=_.split(/(?:\r\n?|\n)/g);this._input=_+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-k),this.offset-=k;var L=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var S=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===L.length?this.yylloc.first_column:0)+L[L.length-E.length].length-E[0].length:this.yylloc.first_column-k},this.options.ranges&&(this.yylloc.range=[S[0],S[0]+this.yyleng-k]),this.yyleng=this.yytext.length,this},"unput"),more:v(function(){return this._more=!0,this},"more"),reject:v(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:v(function(_){this.unput(this.match.slice(_))},"less"),pastInput:v(function(){var _=this.matched.substr(0,this.matched.length-this.match.length);return(_.length>20?"...":"")+_.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:v(function(){var _=this.match;return _.length<20&&(_+=this._input.substr(0,20-_.length)),(_.substr(0,20)+(_.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:v(function(){var _=this.pastInput(),k=new Array(_.length+1).join("-");return _+this.upcomingInput()+` `+k+"^"},"showPosition"),test_match:v(function(_,k){var E,L,S;if(this.options.backtrack_lexer&&(S={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(S.yylloc.range=this.yylloc.range.slice(0))),L=_[0].match(/(?:\r\n?|\n).*/g),L&&(this.yylineno+=L.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:L?L[L.length-1].length-L[L.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+_[0].length},this.yytext+=_[0],this.match+=_[0],this.matches=_,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(_[0].length),this.matched+=_[0],E=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var C in S)this[C]=S[C];return!1}return!1},"test_match"),next:v(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var _,k,E,L;this._more||(this.yytext="",this.match="");for(var S=this._currentRules(),C=0;Ck[0].length)){if(k=E,L=C,this.options.backtrack_lexer){if(_=this.test_match(E,S[C]),_!==!1)return _;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(_=this.test_match(k,S[L]),_!==!1?_:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:v(function(){var k=this.next();return k||this.lex()},"lex"),begin:v(function(k){this.conditionStack.push(k)},"begin"),popState:v(function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:v(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:v(function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},"topState"),pushState:v(function(k){this.begin(k)},"pushState"),stateStackSize:v(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:v(function(k,E,L,S){var C=S;switch(L){case 0:return 10;case 1:return k.getLogger().debug("Found space-block"),31;break;case 2:return k.getLogger().debug("Found nl-block"),31;break;case 3:return k.getLogger().debug("Found space-block"),29;break;case 4:k.getLogger().debug(".",E.yytext);break;case 5:k.getLogger().debug("_",E.yytext);break;case 6:return 5;case 7:return E.yytext=-1,28;break;case 8:return E.yytext=E.yytext.replace(/columns\s+/,""),k.getLogger().debug("COLUMNS (LEX)",E.yytext),28;break;case 9:this.pushState("md_string");break;case 10:return"MD_STR";case 11:this.popState();break;case 12:this.pushState("string");break;case 13:k.getLogger().debug("LEX: POPPING STR:",E.yytext),this.popState();break;case 14:return k.getLogger().debug("LEX: STR end:",E.yytext),"STR";break;case 15:return E.yytext=E.yytext.replace(/space\:/,""),k.getLogger().debug("SPACE NUM (LEX)",E.yytext),21;break;case 16:return E.yytext="1",k.getLogger().debug("COLUMNS (LEX)",E.yytext),21;break;case 17:return 43;case 18:return"LINKSTYLE";case 19:return"INTERPOLATE";case 20:return this.pushState("CLASSDEF"),40;break;case 21:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 22:return this.popState(),this.pushState("CLASSDEFID"),41;break;case 23:return this.popState(),42;break;case 24:return this.pushState("CLASS"),44;break;case 25:return this.popState(),this.pushState("CLASS_STYLE"),45;break;case 26:return this.popState(),46;break;case 27:return this.pushState("STYLE_STMNT"),47;break;case 28:return this.popState(),this.pushState("STYLE_DEFINITION"),48;break;case 29:return this.popState(),49;break;case 30:return this.pushState("acc_title"),"acc_title";break;case 31:return this.popState(),"acc_title_value";break;case 32:return this.pushState("acc_descr"),"acc_descr";break;case 33:return this.popState(),"acc_descr_value";break;case 34:this.pushState("acc_descr_multiline");break;case 35:this.popState();break;case 36:return"acc_descr_multiline_value";case 37:return 30;case 38:return this.popState(),k.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),k.getLogger().debug("Lex: (("),"NODE_DEND";break;case 40:return this.popState(),k.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 41:return this.popState(),k.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),k.getLogger().debug("Lex: (("),"NODE_DEND";break;case 43:return this.popState(),k.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 44:return this.popState(),k.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 45:return this.popState(),k.getLogger().debug("Lex: (("),"NODE_DEND";break;case 46:return this.popState(),k.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 47:return this.popState(),k.getLogger().debug("Lex: ("),"NODE_DEND";break;case 48:return this.popState(),k.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 49:return this.popState(),k.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),k.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 51:return this.popState(),k.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 52:return this.popState(),k.getLogger().debug("Lex: )"),"NODE_DEND";break;case 53:return this.popState(),k.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 54:return this.popState(),k.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 55:return k.getLogger().debug("Lexa: -)"),this.pushState("NODE"),36;break;case 56:return k.getLogger().debug("Lexa: (-"),this.pushState("NODE"),36;break;case 57:return k.getLogger().debug("Lexa: ))"),this.pushState("NODE"),36;break;case 58:return k.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;break;case 59:return k.getLogger().debug("Lex: ((("),this.pushState("NODE"),36;break;case 60:return k.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;break;case 61:return k.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;break;case 62:return k.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;break;case 63:return k.getLogger().debug("Lexc: >"),this.pushState("NODE"),36;break;case 64:return k.getLogger().debug("Lexa: (["),this.pushState("NODE"),36;break;case 65:return k.getLogger().debug("Lexa: )"),this.pushState("NODE"),36;break;case 66:return this.pushState("NODE"),36;break;case 67:return this.pushState("NODE"),36;break;case 68:return this.pushState("NODE"),36;break;case 69:return this.pushState("NODE"),36;break;case 70:return this.pushState("NODE"),36;break;case 71:return this.pushState("NODE"),36;break;case 72:return this.pushState("NODE"),36;break;case 73:return k.getLogger().debug("Lexa: ["),this.pushState("NODE"),36;break;case 74:return this.pushState("BLOCK_ARROW"),k.getLogger().debug("LEX ARR START"),38;break;case 75:return k.getLogger().debug("Lex: NODE_ID",E.yytext),32;break;case 76:return k.getLogger().debug("Lex: EOF",E.yytext),8;break;case 77:this.pushState("md_string");break;case 78:this.pushState("md_string");break;case 79:return"NODE_DESCR";case 80:this.popState();break;case 81:k.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 82:k.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 83:return k.getLogger().debug("LEX: NODE_DESCR:",E.yytext),"NODE_DESCR";break;case 84:k.getLogger().debug("LEX POPPING"),this.popState();break;case 85:k.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 86:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (right): dir:",E.yytext),"DIR";break;case 87:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (left):",E.yytext),"DIR";break;case 88:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (x):",E.yytext),"DIR";break;case 89:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (y):",E.yytext),"DIR";break;case 90:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (up):",E.yytext),"DIR";break;case 91:return E.yytext=E.yytext.replace(/^,\s*/,""),k.getLogger().debug("Lex (down):",E.yytext),"DIR";break;case 92:return E.yytext="]>",k.getLogger().debug("Lex (ARROW_DIR end):",E.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 93:return k.getLogger().debug("Lex: LINK","#"+E.yytext+"#"),15;break;case 94:return k.getLogger().debug("Lex: LINK",E.yytext),15;break;case 95:return k.getLogger().debug("Lex: LINK",E.yytext),15;break;case 96:return k.getLogger().debug("Lex: LINK",E.yytext),15;break;case 97:return k.getLogger().debug("Lex: START_LINK",E.yytext),this.pushState("LLABEL"),16;break;case 98:return k.getLogger().debug("Lex: START_LINK",E.yytext),this.pushState("LLABEL"),16;break;case 99:return k.getLogger().debug("Lex: START_LINK",E.yytext),this.pushState("LLABEL"),16;break;case 100:this.pushState("md_string");break;case 101:return k.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 102:return this.popState(),k.getLogger().debug("Lex: LINK","#"+E.yytext+"#"),15;break;case 103:return this.popState(),k.getLogger().debug("Lex: LINK",E.yytext),15;break;case 104:return this.popState(),k.getLogger().debug("Lex: LINK",E.yytext),15;break;case 105:return k.getLogger().debug("Lex: COLON",E.yytext),E.yytext=E.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block\s+)/,/^(?:block\n+)/,/^(?:block:)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[29],inclusive:!1},STYLE_STMNT:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[23],inclusive:!1},CLASSDEF:{rules:[21,22],inclusive:!1},CLASS_STYLE:{rules:[26],inclusive:!1},CLASS:{rules:[25],inclusive:!1},LLABEL:{rules:[100,101,102,103,104],inclusive:!1},ARROW_DIR:{rules:[86,87,88,89,90,91,92],inclusive:!1},BLOCK_ARROW:{rules:[77,82,85],inclusive:!1},NODE:{rules:[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,78,81],inclusive:!1},md_string:{rules:[10,11,79,80],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[13,14,83,84],inclusive:!1},acc_descr_multiline:{rules:[35,36],inclusive:!1},acc_descr:{rules:[33],inclusive:!1},acc_title:{rules:[31],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,12,15,16,17,18,19,20,24,27,30,32,34,37,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,93,94,95,96,97,98,99,105],inclusive:!0}}};return w}();y.lexer=x;function b(){this.yy={}}return v(b,"Parser"),b.prototype=y,y.Parser=b,new b}();AO.parser=AO;fKe=AO,$l=new Map,IO=[],_O=new Map,Kpe="color",Zpe="fill",dKe="bgFill",age=",",pKe=pe(),xE=new Map,gKe=v(t=>Xe.sanitizeText(t,pKe),"sanitizeText"),mKe=v(function(t,e=""){let r=xE.get(t);r||(r={id:t,styles:[],textStyles:[]},xE.set(t,r)),e?.split(age).forEach(n=>{let i=n.replace(/([^;]*);/,"$1").trim();if(RegExp(Kpe).exec(n)){let s=i.replace(Zpe,dKe).replace(Kpe,Zpe);r.textStyles.push(s)}r.styles.push(i)})},"addStyleClass"),vKe=v(function(t,e=""){let r=$l.get(t);e!=null&&(r.styles=e.split(age))},"addStyle2Node"),yKe=v(function(t,e){t.split(",").forEach(function(r){let n=$l.get(r);if(n===void 0){let i=r.trim();n={id:i,type:"na",children:[]},$l.set(i,n)}n.classes||(n.classes=[]),n.classes.push(e)})},"setCssClass"),sge=v((t,e)=>{let r=t.flat(),n=[];for(let i of r){if(i.label&&(i.label=gKe(i.label)),i.type==="classDef"){mKe(i.id,i.css);continue}if(i.type==="applyClass"){yKe(i.id,i?.styleClass??"");continue}if(i.type==="applyStyles"){i?.stylesStr&&vKe(i.id,i?.stylesStr);continue}if(i.type==="column-setting")e.columns=i.columns??-1;else if(i.type==="edge"){let a=(_O.get(i.id)??0)+1;_O.set(i.id,a),i.id=a+"-"+i.id,IO.push(i)}else{i.label||(i.type==="composite"?i.label="":i.label=i.id);let a=$l.get(i.id);if(a===void 0?$l.set(i.id,i):(i.type!=="na"&&(a.type=i.type),i.label!==i.id&&(a.label=i.label)),i.children&&sge(i.children,i),i.type==="space"){let s=i.width??1;for(let o=0;o{re.debug("Clear called"),xr(),Kx={id:"root",type:"composite",children:[],columns:-1},$l=new Map([["root",Kx]]),MO=[],xE=new Map,IO=[],_O=new Map},"clear");v(oge,"typeStr2Type");v(lge,"edgeTypeStr2Type");v(cge,"edgeStrToEdgeData");Qpe=0,bKe=v(()=>(Qpe++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Qpe),"generateId"),wKe=v(t=>{Kx.children=t,sge(t,Kx),MO=Kx.children},"setHierarchy"),kKe=v(t=>{let e=$l.get(t);return e?e.columns?e.columns:e.children?e.children.length:-1:-1},"getColumns"),TKe=v(()=>[...$l.values()],"getBlocksFlat"),EKe=v(()=>MO||[],"getBlocks"),SKe=v(()=>IO,"getEdges"),CKe=v(t=>$l.get(t),"getBlock"),AKe=v(t=>{$l.set(t.id,t)},"setBlock"),_Ke=v(()=>console,"getLogger"),LKe=v(function(){return xE},"getClasses"),RKe={getConfig:v(()=>Or().block,"getConfig"),typeStr2Type:oge,edgeTypeStr2Type:lge,edgeStrToEdgeData:cge,getLogger:_Ke,getBlocksFlat:TKe,getBlocks:EKe,getEdges:SKe,setHierarchy:wKe,getBlock:CKe,setBlock:AKe,getColumns:kKe,getClasses:LKe,clear:xKe,generateId:bKe},NKe=RKe,vE=v((t,e)=>{let r=S1,n=r(t,"r"),i=r(t,"g"),a=r(t,"b");return $s(n,i,a,e)},"fade"),IKe=v(t=>`.label { font-family: ${t.fontFamily}; color: ${t.nodeTextColor||t.textColor}; } .cluster-label text { fill: ${t.titleColor}; } .cluster-label span,p { color: ${t.titleColor}; } .label text,span,p { fill: ${t.nodeTextColor||t.textColor}; color: ${t.nodeTextColor||t.textColor}; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: 1px; } .flowchart-label text { text-anchor: middle; } // .flowchart-label .text-outer-tspan { // text-anchor: middle; // } // .flowchart-label .text-inner-tspan { // text-anchor: start; // } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${t.arrowheadColor}; } .edgePath .path { stroke: ${t.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${t.lineColor}; fill: none; } .edgeLabel { background-color: ${t.edgeLabelBackground}; rect { opacity: 0.5; background-color: ${t.edgeLabelBackground}; fill: ${t.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${vE(t.edgeLabelBackground,.5)}; // background-color: } .node .cluster { // fill: ${vE(t.mainBkg,.5)}; fill: ${vE(t.clusterBkg,.5)}; stroke: ${vE(t.clusterBorder,.2)}; box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; stroke-width: 1px; } .cluster text { fill: ${t.titleColor}; } .cluster span,p { color: ${t.titleColor}; } /* .cluster div { color: ${t.titleColor}; } */ div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${t.fontFamily}; font-size: 12px; background: ${t.tertiaryColor}; border: 1px solid ${t.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .flowchartTitleText { text-anchor: middle; font-size: 18px; fill: ${t.textColor}; } `,"getStyles"),MKe=IKe,DKe=v((t,e,r,n)=>{e.forEach(i=>{WKe[i](t,r,n)})},"insertMarkers"),OKe=v((t,e,r)=>{re.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),PKe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),BKe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),FKe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),zKe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),$Ke=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),GKe=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),UKe=v((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),VKe=v((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),WKe={extension:OKe,composition:PKe,aggregation:BKe,dependency:FKe,lollipop:zKe,point:$Ke,circle:GKe,cross:UKe,barb:VKe},HKe=DKe,fi=pe()?.block?.padding??8;v(uge,"calculateBlockPosition");qKe=v(t=>{let e=0,r=0;for(let n of t.children){let{width:i,height:a,x:s,y:o}=n.size??{width:0,height:0,x:0,y:0};re.debug("getMaxChildSize abc95 child:",n.id,"width:",i,"height:",a,"x:",s,"y:",o,n.type),n.type!=="space"&&(i>e&&(e=i/(t.widthInColumns??1)),a>r&&(r=a))}return{width:e,height:r}},"getMaxChildSize");v(bE,"setBlockSizes");v(DO,"layoutBlocks");v(OO,"findBounds");v(hge,"layout");v(LO,"applyStyle");v(fge,"addHtmlLabel");YKe=v((t,e,r,n)=>{let i=t||"";if(typeof i=="object"&&(i=i[0]),Wr(pe().flowchart.htmlLabels)){i=i.replace(/\\n|\n/g,"
    "),re.debug("vertexText"+i);let a={isNode:n,label:Z3(Xs(i)),labelStyle:e.replace("fill:","color:")};return fge(a)}else{let a=document.createElementNS("http://www.w3.org/2000/svg","text");a.setAttribute("style",e.replace("color:","fill:"));let s=[];typeof i=="string"?s=i.split(/\\n|\n|/gi):Array.isArray(i)?s=i:s=[];for(let o of s){let l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),r?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=o.trim(),a.appendChild(l)}return a}},"createLabel"),tl=YKe,XKe=v((t,e,r,n,i)=>{e.arrowTypeStart&&Jpe(t,"start",e.arrowTypeStart,r,n,i),e.arrowTypeEnd&&Jpe(t,"end",e.arrowTypeEnd,r,n,i)},"addEdgeMarkers"),jKe={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Jpe=v((t,e,r,n,i,a)=>{let s=jKe[r];if(!s){re.warn(`Unknown arrow type: ${r}`);return}let o=e==="start"?"Start":"End";t.attr(`marker-${e}`,`url(${n}#${i}_${a}-${s}${o})`)},"addEdgeMarker"),RO={},Ba={},KKe=v((t,e)=>{let r=pe(),n=Wr(r.flowchart.htmlLabels),i=e.labelType==="markdown"?oa(t,e.label,{style:e.labelStyle,useHtmlLabels:n,addSvgBackground:!0},r):tl(e.label,e.labelStyle),a=t.insert("g").attr("class","edgeLabel"),s=a.insert("g").attr("class","label");s.node().appendChild(i);let o=i.getBBox();if(n){let u=i.children[0],h=Ve(i);o=u.getBoundingClientRect(),h.attr("width",o.width),h.attr("height",o.height)}s.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),RO[e.id]=a,e.width=o.width,e.height=o.height;let l;if(e.startLabelLeft){let u=tl(e.startLabelLeft,e.labelStyle),h=t.insert("g").attr("class","edgeTerminals"),f=h.insert("g").attr("class","inner");l=f.node().appendChild(u);let d=u.getBBox();f.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),Ba[e.id]||(Ba[e.id]={}),Ba[e.id].startLeft=h,jx(l,e.startLabelLeft)}if(e.startLabelRight){let u=tl(e.startLabelRight,e.labelStyle),h=t.insert("g").attr("class","edgeTerminals"),f=h.insert("g").attr("class","inner");l=h.node().appendChild(u),f.node().appendChild(u);let d=u.getBBox();f.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),Ba[e.id]||(Ba[e.id]={}),Ba[e.id].startRight=h,jx(l,e.startLabelRight)}if(e.endLabelLeft){let u=tl(e.endLabelLeft,e.labelStyle),h=t.insert("g").attr("class","edgeTerminals"),f=h.insert("g").attr("class","inner");l=f.node().appendChild(u);let d=u.getBBox();f.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),h.node().appendChild(u),Ba[e.id]||(Ba[e.id]={}),Ba[e.id].endLeft=h,jx(l,e.endLabelLeft)}if(e.endLabelRight){let u=tl(e.endLabelRight,e.labelStyle),h=t.insert("g").attr("class","edgeTerminals"),f=h.insert("g").attr("class","inner");l=f.node().appendChild(u);let d=u.getBBox();f.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),h.node().appendChild(u),Ba[e.id]||(Ba[e.id]={}),Ba[e.id].endRight=h,jx(l,e.endLabelRight)}return i},"insertEdgeLabel");v(jx,"setTerminalWidth");ZKe=v((t,e)=>{re.debug("Moving label abc88 ",t.id,t.label,RO[t.id],e);let r=e.updatedPath?e.updatedPath:e.originalPath,n=pe(),{subGraphTitleTotalMargin:i}=ou(n);if(t.label){let a=RO[t.id],s=t.x,o=t.y;if(r){let l=Ut.calcLabelPosition(r);re.debug("Moving label "+t.label+" from (",s,",",o,") to (",l.x,",",l.y,") abc88"),e.updatedPath&&(s=l.x,o=l.y)}a.attr("transform",`translate(${s}, ${o+i/2})`)}if(t.startLabelLeft){let a=Ba[t.id].startLeft,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.startLabelRight){let a=Ba[t.id].startRight,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.endLabelLeft){let a=Ba[t.id].endLeft,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}if(t.endLabelRight){let a=Ba[t.id].endRight,s=t.x,o=t.y;if(r){let l=Ut.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);s=l.x,o=l.y}a.attr("transform",`translate(${s}, ${o})`)}},"positionEdgeLabel"),QKe=v((t,e)=>{let r=t.x,n=t.y,i=Math.abs(e.x-r),a=Math.abs(e.y-n),s=t.width/2,o=t.height/2;return i>=s||a>=o},"outsideNode"),JKe=v((t,e,r)=>{re.debug(`intersection calc abc89: outsidePoint: ${JSON.stringify(e)} insidePoint : ${JSON.stringify(r)} node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);let n=t.x,i=t.y,a=Math.abs(n-r.x),s=t.width/2,o=r.xMath.abs(n-e.x)*l){let f=r.y{re.debug("abc88 cutPathAtIntersect",t,e);let r=[],n=t[0],i=!1;return t.forEach(a=>{if(!QKe(e,a)&&!i){let s=JKe(e,n,a),o=!1;r.forEach(l=>{o=o||l.x===s.x&&l.y===s.y}),r.some(l=>l.x===s.x&&l.y===s.y)||r.push(s),i=!0}else n=a,i||r.push(a)}),r},"cutPathAtIntersect"),eZe=v(function(t,e,r,n,i,a,s){let o=r.points;re.debug("abc88 InsertEdge: edge=",r,"e=",e);let l=!1,u=a.node(e.v);var h=a.node(e.w);h?.intersect&&u?.intersect&&(o=o.slice(1,r.points.length-1),o.unshift(u.intersect(o[0])),o.push(h.intersect(o[o.length-1]))),r.toCluster&&(re.debug("to cluster abc88",n[r.toCluster]),o=ege(r.points,n[r.toCluster].node),l=!0),r.fromCluster&&(re.debug("from cluster abc88",n[r.fromCluster]),o=ege(o.reverse(),n[r.fromCluster].node).reverse(),l=!0);let f=o.filter(_=>!Number.isNaN(_.y)),d=gl;r.curve&&(i==="graph"||i==="flowchart")&&(d=r.curve);let{x:p,y:g}=c5(r),m=ms().x(p).y(g).curve(d),y;switch(r.thickness){case"normal":y="edge-thickness-normal";break;case"thick":y="edge-thickness-thick";break;case"invisible":y="edge-thickness-thick";break;default:y=""}switch(r.pattern){case"solid":y+=" edge-pattern-solid";break;case"dotted":y+=" edge-pattern-dotted";break;case"dashed":y+=" edge-pattern-dashed";break}let x=t.append("path").attr("d",m(f)).attr("id",r.id).attr("class"," "+y+(r.classes?" "+r.classes:"")).attr("style",r.style),b="";(pe().flowchart.arrowMarkerAbsolute||pe().state.arrowMarkerAbsolute)&&(b=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,b=b.replace(/\(/g,"\\("),b=b.replace(/\)/g,"\\)")),XKe(x,r,b,s,i);let w={};return l&&(w.updatedPath=o),w.originalPath=r.points,w},"insertEdge"),tZe=v(t=>{let e=new Set;for(let r of t)switch(r){case"x":e.add("right"),e.add("left");break;case"y":e.add("up"),e.add("down");break;default:e.add(r);break}return e},"expandAndDeduplicateDirections"),rZe=v((t,e,r)=>{let n=tZe(t),i=2,a=e.height+2*r.padding,s=a/i,o=e.width+2*s+r.padding,l=r.padding/2;return n.has("right")&&n.has("left")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:s,y:0},{x:o/2,y:2*l},{x:o-s,y:0},{x:o,y:0},{x:o,y:-a/3},{x:o+2*l,y:-a/2},{x:o,y:-2*a/3},{x:o,y:-a},{x:o-s,y:-a},{x:o/2,y:-a-2*l},{x:s,y:-a},{x:0,y:-a},{x:0,y:-2*a/3},{x:-2*l,y:-a/2},{x:0,y:-a/3}]:n.has("right")&&n.has("left")&&n.has("up")?[{x:s,y:0},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}]:n.has("right")&&n.has("left")&&n.has("down")?[{x:0,y:0},{x:s,y:-a},{x:o-s,y:-a},{x:o,y:0}]:n.has("right")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:o,y:-s},{x:o,y:-a+s},{x:0,y:-a}]:n.has("left")&&n.has("up")&&n.has("down")?[{x:o,y:0},{x:0,y:-s},{x:0,y:-a+s},{x:o,y:-a}]:n.has("right")&&n.has("left")?[{x:s,y:0},{x:s,y:-l},{x:o-s,y:-l},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:o-s,y:-a+l},{x:s,y:-a+l},{x:s,y:-a},{x:0,y:-a/2}]:n.has("up")&&n.has("down")?[{x:o/2,y:0},{x:0,y:-l},{x:s,y:-l},{x:s,y:-a+l},{x:0,y:-a+l},{x:o/2,y:-a},{x:o,y:-a+l},{x:o-s,y:-a+l},{x:o-s,y:-l},{x:o,y:-l}]:n.has("right")&&n.has("up")?[{x:0,y:0},{x:o,y:-s},{x:0,y:-a}]:n.has("right")&&n.has("down")?[{x:0,y:0},{x:o,y:0},{x:0,y:-a}]:n.has("left")&&n.has("up")?[{x:o,y:0},{x:0,y:-s},{x:o,y:-a}]:n.has("left")&&n.has("down")?[{x:o,y:0},{x:0,y:0},{x:o,y:-a}]:n.has("right")?[{x:s,y:-l},{x:s,y:-l},{x:o-s,y:-l},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:o-s,y:-a+l},{x:s,y:-a+l},{x:s,y:-a+l}]:n.has("left")?[{x:s,y:0},{x:s,y:-l},{x:o-s,y:-l},{x:o-s,y:-a+l},{x:s,y:-a+l},{x:s,y:-a},{x:0,y:-a/2}]:n.has("up")?[{x:s,y:-l},{x:s,y:-a+l},{x:0,y:-a+l},{x:o/2,y:-a},{x:o,y:-a+l},{x:o-s,y:-a+l},{x:o-s,y:-l}]:n.has("down")?[{x:o/2,y:0},{x:0,y:-l},{x:s,y:-l},{x:s,y:-a+l},{x:o-s,y:-a+l},{x:o-s,y:-l},{x:o,y:-l}]:[{x:0,y:0}]},"getArrowPoints");v(dge,"intersectNode");nZe=dge;v(pge,"intersectEllipse");gge=pge;v(mge,"intersectCircle");iZe=mge;v(vge,"intersectLine");v(NO,"sameSign");aZe=vge,sZe=yge;v(yge,"intersectPolygon");oZe=v((t,e)=>{var r=t.x,n=t.y,i=e.x-r,a=e.y-n,s=t.width/2,o=t.height/2,l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=a===0?0:o*i/a,u=o):(i<0&&(s=-s),l=s,u=i===0?0:s*a/i),{x:r+l,y:n+u}},"intersectRect"),lZe=oZe,$n={node:nZe,circle:iZe,ellipse:gge,polygon:sZe,rect:lZe},Ki=v(async(t,e,r,n)=>{let i=pe(),a,s=e.useHtmlLabels||Wr(i.flowchart.htmlLabels);r?a=r:a="node default";let o=t.insert("g").attr("class",a).attr("id",e.domId||e.id),l=o.insert("g").attr("class","label").attr("style",e.labelStyle),u;e.labelText===void 0?u="":u=typeof e.labelText=="string"?e.labelText:e.labelText[0];let h=l.node(),f;e.labelType==="markdown"?f=oa(l,yr(Xs(u),i),{useHtmlLabels:s,width:e.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):f=h.appendChild(tl(yr(Xs(u),i),e.labelStyle,!1,n));let d=f.getBBox(),p=e.padding/2;if(Wr(i.flowchart.htmlLabels)){let g=f.children[0],m=Ve(f),y=g.getElementsByTagName("img");if(y){let x=u.replace(/]*>/g,"").trim()==="";await Promise.all([...y].map(b=>new Promise(w=>{function _(){if(b.style.display="flex",b.style.flexDirection="column",x){let k=i.fontSize?i.fontSize:window.getComputedStyle(document.body).fontSize,L=parseInt(k,10)*5+"px";b.style.minWidth=L,b.style.maxWidth=L}else b.style.width="100%";w(b)}v(_,"setupImage"),setTimeout(()=>{b.complete&&_()}),b.addEventListener("error",_),b.addEventListener("load",_)})))}d=g.getBoundingClientRect(),m.attr("width",d.width),m.attr("height",d.height)}return s?l.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"):l.attr("transform","translate(0, "+-d.height/2+")"),e.centerLabel&&l.attr("transform","translate("+-d.width/2+", "+-d.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:o,bbox:d,halfPadding:p,label:l}},"labelHelper"),ai=v((t,e)=>{let r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds");v(Gl,"insertPolygonShape");cZe=v(async(t,e)=>{e.useHtmlLabels||pe().flowchart.htmlLabels||(e.centerLabel=!0);let{shapeSvg:n,bbox:i,halfPadding:a}=await Ki(t,e,"node "+e.classes,!0);re.info("Classes = ",e.classes);let s=n.insert("rect",":first-child");return s.attr("rx",e.rx).attr("ry",e.ry).attr("x",-i.width/2-a).attr("y",-i.height/2-a).attr("width",i.width+e.padding).attr("height",i.height+e.padding),ai(e,s),e.intersect=function(o){return $n.rect(e,o)},n},"note"),uZe=cZe,tge=v(t=>t?" "+t:"","formatClass"),ho=v((t,e)=>`${e||"node default"}${tge(t.classes)} ${tge(t.class)}`,"getClassesFromNode"),rge=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=i+a,o=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}];re.info("Question main (Circle)");let l=Gl(r,s,s,o);return l.attr("style",e.style),ai(e,l),e.intersect=function(u){return re.warn("Intersect called"),$n.polygon(e,o,u)},r},"question"),hZe=v((t,e)=>{let r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),n=28,i=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}];return r.insert("polygon",":first-child").attr("points",i.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(s){return $n.circle(e,14,s)},r},"choice"),fZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=4,a=n.height+e.padding,s=a/i,o=n.width+2*s+e.padding,l=[{x:s,y:0},{x:o-s,y:0},{x:o,y:-a/2},{x:o-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}],u=Gl(r,o,a,l);return u.attr("style",e.style),ai(e,u),e.intersect=function(h){return $n.polygon(e,l,h)},r},"hexagon"),dZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,void 0,!0),i=2,a=n.height+2*e.padding,s=a/i,o=n.width+2*s+e.padding,l=rZe(e.directions,n,e),u=Gl(r,o,a,l);return u.attr("style",e.style),ai(e,u),e.intersect=function(h){return $n.polygon(e,l,h)},r},"block_arrow"),pZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:-a/2,y:0},{x:i,y:0},{x:i,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return Gl(r,i,a,s).attr("style",e.style),e.width=i+a,e.height=a,e.intersect=function(l){return $n.polygon(e,s,l)},r},"rect_left_inv_arrow"),gZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:-2*a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:a/6,y:-a}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"lean_right"),mZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:2*a/6,y:0},{x:i+a/6,y:0},{x:i-2*a/6,y:-a},{x:-a/6,y:-a}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"lean_left"),vZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:-2*a/6,y:0},{x:i+2*a/6,y:0},{x:i-a/6,y:-a},{x:a/6,y:-a}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"trapezoid"),yZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:a/6,y:0},{x:i-a/6,y:0},{x:i+2*a/6,y:-a},{x:-2*a/6,y:-a}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"inv_trapezoid"),xZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:0,y:0},{x:i+a/2,y:0},{x:i,y:-a/2},{x:i+a/2,y:-a},{x:0,y:-a}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"rect_right_inv_arrow"),bZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=i/2,s=a/(2.5+i/50),o=n.height+s+e.padding,l="M 0,"+s+" a "+a+","+s+" 0,0,0 "+i+" 0 a "+a+","+s+" 0,0,0 "+-i+" 0 l 0,"+o+" a "+a+","+s+" 0,0,0 "+i+" 0 l 0,"+-o,u=r.attr("label-offset-y",s).insert("path",":first-child").attr("style",e.style).attr("d",l).attr("transform","translate("+-i/2+","+-(o/2+s)+")");return ai(e,u),e.intersect=function(h){let f=$n.rect(e,h),d=f.x-e.x;if(a!=0&&(Math.abs(d)e.height/2-s)){let p=s*s*(1-d*d/(a*a));p!=0&&(p=Math.sqrt(p)),p=s-p,h.y-e.y>0&&(p=-p),f.y+=p}return f},r},"cylinder"),wZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Ki(t,e,"node "+e.classes+" "+e.class,!0),a=r.insert("rect",":first-child"),s=e.positioned?e.width:n.width+e.padding,o=e.positioned?e.height:n.height+e.padding,l=e.positioned?-s/2:-n.width/2-i,u=e.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),e.props){let h=new Set(Object.keys(e.props));e.props.borders&&(wE(a,e.props.borders,s,o),h.delete("borders")),h.forEach(f=>{re.warn(`Unknown node property ${f}`)})}return ai(e,a),e.intersect=function(h){return $n.rect(e,h)},r},"rect"),kZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Ki(t,e,"node "+e.classes,!0),a=r.insert("rect",":first-child"),s=e.positioned?e.width:n.width+e.padding,o=e.positioned?e.height:n.height+e.padding,l=e.positioned?-s/2:-n.width/2-i,u=e.positioned?-o/2:-n.height/2-i;if(a.attr("class","basic cluster composite label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",u).attr("width",s).attr("height",o),e.props){let h=new Set(Object.keys(e.props));e.props.borders&&(wE(a,e.props.borders,s,o),h.delete("borders")),h.forEach(f=>{re.warn(`Unknown node property ${f}`)})}return ai(e,a),e.intersect=function(h){return $n.rect(e,h)},r},"composite"),TZe=v(async(t,e)=>{let{shapeSvg:r}=await Ki(t,e,"label",!0);re.trace("Classes = ",e.class);let n=r.insert("rect",":first-child"),i=0,a=0;if(n.attr("width",i).attr("height",a),r.attr("class","label edgeLabel"),e.props){let s=new Set(Object.keys(e.props));e.props.borders&&(wE(n,e.props.borders,i,a),s.delete("borders")),s.forEach(o=>{re.warn(`Unknown node property ${o}`)})}return ai(e,n),e.intersect=function(s){return $n.rect(e,s)},r},"labelRect");v(wE,"applyNodePropertyBorders");EZe=v((t,e)=>{let r;e.classes?r="node "+e.classes:r="node default";let n=t.insert("g").attr("class",r).attr("id",e.domId||e.id),i=n.insert("rect",":first-child"),a=n.insert("line"),s=n.insert("g").attr("class","label"),o=e.labelText.flat?e.labelText.flat():e.labelText,l="";typeof o=="object"?l=o[0]:l=o,re.info("Label text abc79",l,o,typeof o=="object");let u=s.node().appendChild(tl(l,e.labelStyle,!0,!0)),h={width:0,height:0};if(Wr(pe().flowchart.htmlLabels)){let m=u.children[0],y=Ve(u);h=m.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}re.info("Text 2",o);let f=o.slice(1,o.length),d=u.getBBox(),p=s.node().appendChild(tl(f.join?f.join("
    "):f,e.labelStyle,!0,!0));if(Wr(pe().flowchart.htmlLabels)){let m=p.children[0],y=Ve(p);h=m.getBoundingClientRect(),y.attr("width",h.width),y.attr("height",h.height)}let g=e.padding/2;return Ve(p).attr("transform","translate( "+(h.width>d.width?0:(d.width-h.width)/2)+", "+(d.height+g+5)+")"),Ve(u).attr("transform","translate( "+(h.width{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.height+e.padding,a=n.width+i/4+e.padding,s=r.insert("rect",":first-child").attr("style",e.style).attr("rx",i/2).attr("ry",i/2).attr("x",-a/2).attr("y",-i/2).attr("width",a).attr("height",i);return ai(e,s),e.intersect=function(o){return $n.rect(e,o)},r},"stadium"),CZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Ki(t,e,ho(e,void 0),!0),a=r.insert("circle",":first-child");return a.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",n.width/2+i).attr("width",n.width+e.padding).attr("height",n.height+e.padding),re.info("Circle main"),ai(e,a),e.intersect=function(s){return re.info("Circle intersect",e,n.width/2+i,s),$n.circle(e,n.width/2+i,s)},r},"circle"),AZe=v(async(t,e)=>{let{shapeSvg:r,bbox:n,halfPadding:i}=await Ki(t,e,ho(e,void 0),!0),a=5,s=r.insert("g",":first-child"),o=s.insert("circle"),l=s.insert("circle");return s.attr("class",e.class),o.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",n.width/2+i+a).attr("width",n.width+e.padding+a*2).attr("height",n.height+e.padding+a*2),l.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",n.width/2+i).attr("width",n.width+e.padding).attr("height",n.height+e.padding),re.info("DoubleCircle main"),ai(e,o),e.intersect=function(u){return re.info("DoubleCircle intersect",e,n.width/2+i+a,u),$n.circle(e,n.width/2+i+a,u)},r},"doublecircle"),_Ze=v(async(t,e)=>{let{shapeSvg:r,bbox:n}=await Ki(t,e,ho(e,void 0),!0),i=n.width+e.padding,a=n.height+e.padding,s=[{x:0,y:0},{x:i,y:0},{x:i,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],o=Gl(r,i,a,s);return o.attr("style",e.style),ai(e,o),e.intersect=function(l){return $n.polygon(e,s,l)},r},"subroutine"),LZe=v((t,e)=>{let r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),n=r.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),ai(e,n),e.intersect=function(i){return $n.circle(e,7,i)},r},"start"),nge=v((t,e,r)=>{let n=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),i=70,a=10;r==="LR"&&(i=10,a=70);let s=n.append("rect").attr("x",-1*i/2).attr("y",-1*a/2).attr("width",i).attr("height",a).attr("class","fork-join");return ai(e,s),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(o){return $n.rect(e,o)},n},"forkJoin"),RZe=v((t,e)=>{let r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),n=r.insert("circle",":first-child"),i=r.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),ai(e,i),e.intersect=function(a){return $n.circle(e,7,a)},r},"end"),NZe=v((t,e)=>{let r=e.padding/2,n=4,i=8,a;e.classes?a="node "+e.classes:a="node default";let s=t.insert("g").attr("class",a).attr("id",e.domId||e.id),o=s.insert("rect",":first-child"),l=s.insert("line"),u=s.insert("line"),h=0,f=n,d=s.insert("g").attr("class","label"),p=0,g=e.classData.annotations?.[0],m=e.classData.annotations[0]?"\xAB"+e.classData.annotations[0]+"\xBB":"",y=d.node().appendChild(tl(m,e.labelStyle,!0,!0)),x=y.getBBox();if(Wr(pe().flowchart.htmlLabels)){let S=y.children[0],C=Ve(y);x=S.getBoundingClientRect(),C.attr("width",x.width),C.attr("height",x.height)}e.classData.annotations[0]&&(f+=x.height+n,h+=x.width);let b=e.classData.label;e.classData.type!==void 0&&e.classData.type!==""&&(pe().flowchart.htmlLabels?b+="<"+e.classData.type+">":b+="<"+e.classData.type+">");let w=d.node().appendChild(tl(b,e.labelStyle,!0,!0));Ve(w).attr("class","classTitle");let _=w.getBBox();if(Wr(pe().flowchart.htmlLabels)){let S=w.children[0],C=Ve(w);_=S.getBoundingClientRect(),C.attr("width",_.width),C.attr("height",_.height)}f+=_.height+n,_.width>h&&(h=_.width);let k=[];e.classData.members.forEach(S=>{let C=S.getDisplayDetails(),M=C.displayText;pe().flowchart.htmlLabels&&(M=M.replace(//g,">"));let R=d.node().appendChild(tl(M,C.cssStyle?C.cssStyle:e.labelStyle,!0,!0)),T=R.getBBox();if(Wr(pe().flowchart.htmlLabels)){let I=R.children[0],A=Ve(R);T=I.getBoundingClientRect(),A.attr("width",T.width),A.attr("height",T.height)}T.width>h&&(h=T.width),f+=T.height+n,k.push(R)}),f+=i;let E=[];if(e.classData.methods.forEach(S=>{let C=S.getDisplayDetails(),M=C.displayText;pe().flowchart.htmlLabels&&(M=M.replace(//g,">"));let R=d.node().appendChild(tl(M,C.cssStyle?C.cssStyle:e.labelStyle,!0,!0)),T=R.getBBox();if(Wr(pe().flowchart.htmlLabels)){let I=R.children[0],A=Ve(R);T=I.getBoundingClientRect(),A.attr("width",T.width),A.attr("height",T.height)}T.width>h&&(h=T.width),f+=T.height+n,E.push(R)}),f+=i,g){let S=(h-x.width)/2;Ve(y).attr("transform","translate( "+(-1*h/2+S)+", "+-1*f/2+")"),p=x.height+n}let L=(h-_.width)/2;return Ve(w).attr("transform","translate( "+(-1*h/2+L)+", "+(-1*f/2+p)+")"),p+=_.height+n,l.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,k.forEach(S=>{Ve(S).attr("transform","translate( "+-h/2+", "+(-1*f/2+p+i/2)+")");let C=S?.getBBox();p+=(C?.height??0)+n}),p+=i,u.attr("class","divider").attr("x1",-h/2-r).attr("x2",h/2+r).attr("y1",-f/2-r+i+p).attr("y2",-f/2-r+i+p),p+=i,E.forEach(S=>{Ve(S).attr("transform","translate( "+-h/2+", "+(-1*f/2+p)+")");let C=S?.getBBox();p+=(C?.height??0)+n}),o.attr("style",e.style).attr("class","outer title-state").attr("x",-h/2-r).attr("y",-(f/2)-r).attr("width",h+e.padding).attr("height",f+e.padding),ai(e,o),e.intersect=function(S){return $n.rect(e,S)},s},"class_box"),ige={rhombus:rge,composite:kZe,question:rge,rect:wZe,labelRect:TZe,rectWithTitle:EZe,choice:hZe,circle:CZe,doublecircle:AZe,stadium:SZe,hexagon:fZe,block_arrow:dZe,rect_left_inv_arrow:pZe,lean_right:gZe,lean_left:mZe,trapezoid:vZe,inv_trapezoid:yZe,rect_right_inv_arrow:xZe,cylinder:bZe,start:LZe,end:RZe,note:uZe,subroutine:_Ze,fork:nge,join:nge,class_box:NZe},yE={},xge=v(async(t,e,r)=>{let n,i;if(e.link){let a;pe().securityLevel==="sandbox"?a="_top":e.linkTarget&&(a=e.linkTarget||"_blank"),n=t.insert("svg:a").attr("xlink:href",e.link).attr("target",a),i=await ige[e.shape](n,e,r)}else i=await ige[e.shape](t,e,r),n=i;return e.tooltip&&i.attr("title",e.tooltip),e.class&&i.attr("class","node default "+e.class),yE[e.id]=n,e.haveCallback&&yE[e.id].attr("class",yE[e.id].attr("class")+" clickable"),n},"insertNode"),IZe=v(t=>{let e=yE[t.id];re.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");let r=8,n=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+n-t.width/2)+", "+(t.y-t.height/2-r)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),n},"positionNode");v(PO,"getNodeFromBlock");v(bge,"calculateBlockSize");v(wge,"insertBlockPositioned");v(kE,"performOperations");v(kge,"calculateBlockSizes");v(Tge,"insertBlocks");v(Ege,"insertEdges");MZe=v(function(t,e){return e.db.getClasses()},"getClasses"),DZe=v(async function(t,e,r,n){let{securityLevel:i,block:a}=Or(),s=n.db,o;i==="sandbox"&&(o=Ve("#i"+e));let l=i==="sandbox"?Ve(o.nodes()[0].contentDocument.body):Ve("body"),u=i==="sandbox"?l.select(`[id="${e}"]`):Ve(`[id="${e}"]`);HKe(u,["point","circle","cross"],n.type,e);let f=s.getBlocks(),d=s.getBlocksFlat(),p=s.getEdges(),g=u.insert("g").attr("class","block");await kge(g,f,s);let m=hge(s);if(await Tge(g,f,s),await Ege(g,p,d,s,e),m){let y=m,x=Math.max(1,Math.round(.125*(y.width/y.height))),b=y.height+x+10,w=y.width+10,{useMaxWidth:_}=a;Hr(u,b,w,!!_),re.debug("Here Bounds",m,y),u.attr("viewBox",`${y.x-5} ${y.y-5} ${y.width+10} ${y.height+10}`)}},"draw"),OZe={draw:DZe,getClasses:MZe},PZe={parser:fKe,db:NKe,renderer:OZe,styles:MKe}});var FO=di((Zx,BO)=>{(function(e,r){typeof Zx=="object"&&typeof BO=="object"?BO.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Zx=="object"?Zx.layoutBase=r():e.layoutBase=r()})(Zx,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.i=function(n){return n},r.d=function(n,i,a){r.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:a})},r.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(i,"a",i),i},r.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},r.p="",r(r.s=28)}([function(t,e,r){"use strict";function n(){}n.QUALITY=1,n.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,n.DEFAULT_INCREMENTAL=!1,n.DEFAULT_ANIMATION_ON_LAYOUT=!0,n.DEFAULT_ANIMATION_DURING_LAYOUT=!1,n.DEFAULT_ANIMATION_PERIOD=50,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,n.DEFAULT_GRAPH_MARGIN=15,n.NODE_DIMENSIONS_INCLUDE_LABELS=!1,n.SIMPLE_NODE_SIZE=40,n.SIMPLE_NODE_HALF_SIZE=n.SIMPLE_NODE_SIZE/2,n.EMPTY_COMPOUND_NODE_SIZE=40,n.MIN_EDGE_LENGTH=1,n.WORLD_BOUNDARY=1e6,n.INITIAL_WORLD_BOUNDARY=n.WORLD_BOUNDARY/1e3,n.WORLD_CENTER_X=1200,n.WORLD_CENTER_Y=900,t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(8),a=r(9);function s(l,u,h){n.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var h=this.getOtherEnd(l),f=u.getGraphManager().getRoot();;){if(h.getOwner()==u)return h;if(h.getOwner()==f)break;h=h.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,r){"use strict";function n(i){this.vGraphObject=i}t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(10),a=r(13),s=r(0),o=r(16),l=r(5);function u(f,d,p,g){p==null&&g==null&&(g=d),n.call(this,g),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=f,p!=null&&d!=null?this.rect=new a(d.x,d.y,p.width,p.height):this.rect=new a}u.prototype=Object.create(n.prototype);for(var h in n)u[h]=n[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(f){this.rect.width=f},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(f){this.rect.height=f},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(f,d){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=d.width,this.rect.height=d.height},u.prototype.setCenter=function(f,d){this.rect.x=f-this.rect.width/2,this.rect.y=d-this.rect.height/2},u.prototype.setLocation=function(f,d){this.rect.x=f,this.rect.y=d},u.prototype.moveBy=function(f,d){this.rect.x+=f,this.rect.y+=d},u.prototype.getEdgeListToNode=function(f){var d=[],p,g=this;return g.edges.forEach(function(m){if(m.target==f){if(m.source!=g)throw"Incorrect edge source!";d.push(m)}}),d},u.prototype.getEdgesBetween=function(f){var d=[],p,g=this;return g.edges.forEach(function(m){if(!(m.source==g||m.target==g))throw"Incorrect edge source and/or target";(m.target==f||m.source==f)&&d.push(m)}),d},u.prototype.getNeighborsList=function(){var f=new Set,d=this;return d.edges.forEach(function(p){if(p.source==d)f.add(p.target);else{if(p.target!=d)throw"Incorrect incidency!";f.add(p.source)}}),f},u.prototype.withChildren=function(){var f=new Set,d,p;if(f.add(this),this.child!=null)for(var g=this.child.getNodes(),m=0;md?(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(d+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(p+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>p?(this.rect.y-=(this.labelHeight-p)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(p+this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(f){var d=this.rect.x;d>s.WORLD_BOUNDARY?d=s.WORLD_BOUNDARY:d<-s.WORLD_BOUNDARY&&(d=-s.WORLD_BOUNDARY);var p=this.rect.y;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var g=new l(d,p),m=f.inverseTransformPoint(g);this.setLocation(m.x,m.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=u},function(t,e,r){"use strict";var n=r(0);function i(){}for(var a in n)i[a]=n[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=i},function(t,e,r){"use strict";function n(i,a){i==null&&a==null?(this.x=0,this.y=0):(this.x=i,this.y=a)}n.prototype.getX=function(){return this.x},n.prototype.getY=function(){return this.y},n.prototype.setX=function(i){this.x=i},n.prototype.setY=function(i){this.y=i},n.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},n.prototype.getCopy=function(){return new n(this.x,this.y)},n.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},t.exports=n},function(t,e,r){"use strict";var n=r(2),i=r(10),a=r(0),s=r(7),o=r(3),l=r(1),u=r(13),h=r(12),f=r(11);function d(g,m,y){n.call(this,y),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,m!=null&&m instanceof s?this.graphManager=m:m!=null&&m instanceof Layout&&(this.graphManager=m.graphManager)}d.prototype=Object.create(n.prototype);for(var p in n)d[p]=n[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(g,m,y){if(m==null&&y==null){var x=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var b=g;if(!(this.getNodes().indexOf(m)>-1&&this.getNodes().indexOf(y)>-1))throw"Source or target not in graph!";if(!(m.owner==y.owner&&m.owner==this))throw"Both owners must be this graph!";return m.owner!=y.owner?null:(b.source=m,b.target=y,b.isInterGraph=!1,this.getEdges().push(b),m.edges.push(b),y!=m&&y.edges.push(b),b)}},d.prototype.remove=function(g){var m=g;if(g instanceof o){if(m==null)throw"Node is null!";if(!(m.owner!=null&&m.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var y=m.edges.slice(),x,b=y.length,w=0;w-1&&E>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(k,1),x.target!=x.source&&x.target.edges.splice(E,1);var _=x.source.owner.getEdges().indexOf(x);if(_==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(_,1)}},d.prototype.updateLeftTop=function(){for(var g=i.MAX_VALUE,m=i.MAX_VALUE,y,x,b,w=this.getNodes(),_=w.length,k=0;k<_;k++){var E=w[k];y=E.getTop(),x=E.getLeft(),g>y&&(g=y),m>x&&(m=x)}return g==i.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?b=w[0].getParent().paddingLeft:b=this.margin,this.left=m-b,this.top=g-b,new h(this.left,this.top))},d.prototype.updateBounds=function(g){for(var m=i.MAX_VALUE,y=-i.MAX_VALUE,x=i.MAX_VALUE,b=-i.MAX_VALUE,w,_,k,E,L,S=this.nodes,C=S.length,M=0;Mw&&(m=w),y<_&&(y=_),x>k&&(x=k),bw&&(m=w),y<_&&(y=_),x>k&&(x=k),b=this.nodes.length){var C=0;y.forEach(function(M){M.owner==g&&C++}),C==this.nodes.length&&(this.isConnected=!0)}},t.exports=d},function(t,e,r){"use strict";var n,i=r(1);function a(s){n=r(6),this.layout=s,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},a.prototype.add=function(s,o,l,u,h){if(l==null&&u==null&&h==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{h=l,u=o,l=s;var f=u.getOwner(),d=h.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==d)return l.isInterGraph=!1,f.add(l,u,h);if(l.isInterGraph=!0,l.source=u,l.target=h,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},a.prototype.remove=function(s){if(s instanceof n){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,h=l.length,f=0;f=s.getRight()?o[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(o[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(o[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var h=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(h=1);var f=h*o[0],d=o[1]/h;o[0]f)return o[0]=l,o[1]=p,o[2]=h,o[3]=S,!1;if(uh)return o[0]=d,o[1]=u,o[2]=E,o[3]=f,!1;if(lh?(o[0]=m,o[1]=y,T=!0):(o[0]=g,o[1]=p,T=!0):A===N&&(l>h?(o[0]=d,o[1]=p,T=!0):(o[0]=x,o[1]=y,T=!0)),-D===N?h>l?(o[2]=L,o[3]=S,I=!0):(o[2]=E,o[3]=k,I=!0):D===N&&(h>l?(o[2]=_,o[3]=k,I=!0):(o[2]=C,o[3]=S,I=!0)),T&&I)return!1;if(l>h?u>f?(O=this.getCardinalDirection(A,N,4),B=this.getCardinalDirection(D,N,2)):(O=this.getCardinalDirection(-A,N,3),B=this.getCardinalDirection(-D,N,1)):u>f?(O=this.getCardinalDirection(-A,N,1),B=this.getCardinalDirection(-D,N,3)):(O=this.getCardinalDirection(A,N,2),B=this.getCardinalDirection(D,N,4)),!T)switch(O){case 1:$=p,P=l+-w/N,o[0]=P,o[1]=$;break;case 2:P=x,$=u+b*N,o[0]=P,o[1]=$;break;case 3:$=y,P=l+w/N,o[0]=P,o[1]=$;break;case 4:P=m,$=u+-b*N,o[0]=P,o[1]=$;break}if(!I)switch(B){case 1:H=k,z=h+-R/N,o[2]=z,o[3]=H;break;case 2:z=C,H=f+M*N,o[2]=z,o[3]=H;break;case 3:H=S,z=h+R/N,o[2]=z,o[3]=H;break;case 4:z=L,H=f+-M*N,o[2]=z,o[3]=H;break}}return!1},i.getCardinalDirection=function(a,s,o){return a>s?o:1+o%4},i.getIntersection=function(a,s,o,l){if(l==null)return this.getIntersection2(a,s,o);var u=a.x,h=a.y,f=s.x,d=s.y,p=o.x,g=o.y,m=l.x,y=l.y,x=void 0,b=void 0,w=void 0,_=void 0,k=void 0,E=void 0,L=void 0,S=void 0,C=void 0;return w=d-h,k=u-f,L=f*h-u*d,_=y-g,E=p-m,S=m*g-p*y,C=w*E-_*k,C===0?null:(x=(k*S-E*L)/C,b=(_*L-w*S)/C,new n(x,b))},i.angleOfVector=function(a,s,o,l){var u=void 0;return a!==o?(u=Math.atan((l-s)/(o-a)),o=0){var y=(-p+Math.sqrt(p*p-4*d*g))/(2*d),x=(-p-Math.sqrt(p*p-4*d*g))/(2*d),b=null;return y>=0&&y<=1?[y]:x>=0&&x<=1?[x]:b}else return null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,t.exports=i},function(t,e,r){"use strict";function n(){}n.sign=function(i){return i>0?1:i<0?-1:0},n.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},n.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},t.exports=n},function(t,e,r){"use strict";function n(){}n.MAX_VALUE=2147483647,n.MIN_VALUE=-2147483648,t.exports=n},function(t,e,r){"use strict";var n=function(){function u(h,f){for(var d=0;d"u"?"undefined":n(a);return a==null||s!="object"&&s!="function"},t.exports=i},function(t,e,r){"use strict";function n(p){if(Array.isArray(p)){for(var g=0,m=Array(p.length);g0&&g;){for(w.push(k[0]);w.length>0&&g;){var E=w[0];w.splice(0,1),b.add(E);for(var L=E.getEdges(),x=0;x-1&&k.splice(R,1)}b=new Set,_=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var g=[],m=p.source,y=this.graphManager.calcLowestCommonAncestor(p.source,p.target),x=0;x0){for(var y=this.edgeToDummyNodes.get(m),x=0;x=0&&g.splice(S,1);var C=_.getNeighborsList();C.forEach(function(T){if(m.indexOf(T)<0){var I=y.get(T),A=I-1;A==1&&E.push(T),y.set(T,A)}})}m=m.concat(E),(g.length==1||g.length==2)&&(x=!0,b=g[0])}return b},d.prototype.setGraphManager=function(p){this.graphManager=p},t.exports=d},function(t,e,r){"use strict";function n(){}n.seed=1,n.x=0,n.nextDouble=function(){return n.x=Math.sin(n.seed++)*1e4,n.x-Math.floor(n.x)},t.exports=n},function(t,e,r){"use strict";var n=r(5);function i(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(a){this.lworldExtX=a},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(a){this.lworldExtY=a},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},i.prototype.transformX=function(a){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/o),s},i.prototype.transformY=function(a){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/o),s},i.prototype.inverseTransformX=function(a){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/o),s},i.prototype.inverseTransformY=function(a){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/o),s},i.prototype.inverseTransformPoint=function(a){var s=new n(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},t.exports=i},function(t,e,r){"use strict";function n(f){if(Array.isArray(f)){for(var d=0,p=Array(f.length);da.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,g,m,y,x=this.getAllNodes(),b;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),b=new Set,p=0;pw||b>w)&&(f.gravitationForceX=-this.gravityConstant*m,f.gravitationForceY=-this.gravityConstant*y)):(w=d.getEstimatedSize()*this.compoundGravityRangeFactor,(x>w||b>w)&&(f.gravitationForceX=-this.gravityConstant*m*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*y*this.compoundGravityConstant))},u.prototype.isConverged=function(){var f,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=x.length||w>=x[0].length)){for(var _=0;_u}}]),o}();t.exports=s},function(t,e,r){"use strict";function n(){}n.svd=function(i){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=i.length,this.n=i[0].length;var a=Math.min(this.m,this.n);this.s=function(ot){for(var et=[];ot-- >0;)et.push(0);return et}(Math.min(this.m+1,this.n)),this.U=function(ot){var et=function ht(bt){if(bt.length==0)return 0;for(var tt=[],_t=0;_t0;)et.push(0);return et}(this.n),o=function(ot){for(var et=[];ot-- >0;)et.push(0);return et}(this.m),l=!0,u=!0,h=Math.min(this.m-1,this.n),f=Math.max(0,Math.min(this.n-2,this.m)),d=0;d=0;N--)if(this.s[N]!==0){for(var O=N+1;O=0;X--){if(function(ot,et){return ot&&et}(X0;){var ue=void 0,te=void 0;for(ue=I-2;ue>=-1&&ue!==-1;ue--)if(Math.abs(s[ue])<=ce+se*(Math.abs(this.s[ue])+Math.abs(this.s[ue+1]))){s[ue]=0;break}if(ue===I-2)te=4;else{var Ne=void 0;for(Ne=I-1;Ne>=ue&&Ne!==ue;Ne--){var ae=(Ne!==I?Math.abs(s[Ne]):0)+(Ne!==ue+1?Math.abs(s[Ne-1]):0);if(Math.abs(this.s[Ne])<=ce+se*ae){this.s[Ne]=0;break}}Ne===ue?te=3:Ne===I-1?te=1:(te=2,ue=Ne)}switch(ue++,te){case 1:{var we=s[I-2];s[I-2]=0;for(var Ie=I-2;Ie>=ue;Ie--){var Ee=n.hypot(this.s[Ie],we),Oe=this.s[Ie]/Ee,De=we/Ee;if(this.s[Ie]=Ee,Ie!==ue&&(we=-De*s[Ie-1],s[Ie-1]=Oe*s[Ie-1]),u)for(var We=0;We=this.s[ue+1]);){var Ke=this.s[ue];if(this.s[ue]=this.s[ue+1],this.s[ue+1]=Ke,u&&ueMath.abs(a)?(s=a/i,s=Math.abs(i)*Math.sqrt(1+s*s)):a!=0?(s=i/a,s=Math.abs(a)*Math.sqrt(1+s*s)):s=0,s},t.exports=n},function(t,e,r){"use strict";var n=function(){function s(o,l){for(var u=0;u2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=h,this.gap_penalty=f,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;o--){var l=this.listeners[o];l.event===a&&l.callback===s&&this.listeners.splice(o,1)}},i.emit=function(a,s){for(var o=0;o{(function(e,r){typeof Qx=="object"&&typeof zO=="object"?zO.exports=r(FO()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof Qx=="object"?Qx.coseBase=r(FO()):e.coseBase=r(e.layoutBase)})(Qx,function(t){return(()=>{"use strict";var e={45:(a,s,o)=>{var l={};l.layoutBase=o(551),l.CoSEConstants=o(806),l.CoSEEdge=o(767),l.CoSEGraph=o(880),l.CoSEGraphManager=o(578),l.CoSELayout=o(765),l.CoSENode=o(991),l.ConstraintHandler=o(902),a.exports=l},806:(a,s,o)=>{var l=o(551).FDLayoutConstants;function u(){}for(var h in l)u[h]=l[h];u.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,u.DEFAULT_RADIAL_SEPARATION=l.DEFAULT_EDGE_LENGTH,u.DEFAULT_COMPONENT_SEPERATION=60,u.TILE=!0,u.TILING_PADDING_VERTICAL=10,u.TILING_PADDING_HORIZONTAL=10,u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!0,u.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,u.TREE_REDUCTION_ON_INCREMENTAL=!0,u.PURE_INCREMENTAL=u.DEFAULT_INCREMENTAL,a.exports=u},767:(a,s,o)=>{var l=o(551).FDLayoutEdge;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u},880:(a,s,o)=>{var l=o(551).LGraph;function u(f,d,p){l.call(this,f,d,p)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u},578:(a,s,o)=>{var l=o(551).LGraphManager;function u(f){l.call(this,f)}u.prototype=Object.create(l.prototype);for(var h in l)u[h]=l[h];a.exports=u},765:(a,s,o)=>{var l=o(551).FDLayout,u=o(578),h=o(880),f=o(991),d=o(767),p=o(806),g=o(902),m=o(551).FDLayoutConstants,y=o(551).LayoutConstants,x=o(551).Point,b=o(551).PointD,w=o(551).DimensionD,_=o(551).Layout,k=o(551).Integer,E=o(551).IGeometry,L=o(551).LGraph,S=o(551).Transform,C=o(551).LinkedList;function M(){l.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(l.prototype);for(var R in l)M[R]=l[R];M.prototype.newGraphManager=function(){var T=new u(this);return this.graphManager=T,T},M.prototype.newGraph=function(T){return new h(null,this.graphManager,T)},M.prototype.newNode=function(T){return new f(this.graphManager,T)},M.prototype.newEdge=function(T){return new d(null,null,T)},M.prototype.initParameters=function(){l.prototype.initParameters.call(this,arguments),this.isSubLayout||(p.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=p.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=p.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=m.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=m.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=m.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){l.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/m.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var T=y.DEFAULT_CREATE_BENDS_AS_NEEDED;return T&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(p.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var I=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(O){return I.has(O)});this.graphManager.setAllNodesToApplyGravitation(A)}}else{var T=this.getFlatForest();if(T.length>0)this.positionNodesRadially(T);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var I=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(D){return I.has(D)});this.graphManager.setAllNodesToApplyGravitation(A),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(g.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),p.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%m.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var T=new Set(this.getAllNodes()),I=this.nodesWithGravity.filter(function(N){return T.has(N)});this.graphManager.setAllNodesToApplyGravitation(I),this.graphManager.updateBounds(),this.updateGrid(),p.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),p.PURE_INCREMENTAL?this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=m.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var A=!this.isTreeGrowing&&!this.isGrowthFinished,D=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(A,D),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var T=this.graphManager.getAllNodes(),I={},A=0;A0&&this.updateDisplacements();for(var A=0;A0&&(D.fixedNodeWeight=O)}}if(this.constraints.relativePlacementConstraint){var B=new Map,P=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(ee){T.fixedNodesOnHorizontal.add(ee),T.fixedNodesOnVertical.add(ee)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var $=this.constraints.alignmentConstraint.vertical,A=0;A<$.length;A++)this.dummyToNodeForVerticalAlignment.set("dummy"+A,[]),$[A].forEach(function(Q){B.set(Q,"dummy"+A),T.dummyToNodeForVerticalAlignment.get("dummy"+A).push(Q),T.fixedNodeSet.has(Q)&&T.fixedNodesOnHorizontal.add("dummy"+A)});if(this.constraints.alignmentConstraint.horizontal)for(var z=this.constraints.alignmentConstraint.horizontal,A=0;A=2*ee.length/3;Y--)Q=Math.floor(Math.random()*(Y+1)),W=ee[Y],ee[Y]=ee[Q],ee[Q]=W;return ee},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(ee){if(ee.left){var Q=B.has(ee.left)?B.get(ee.left):ee.left,W=B.has(ee.right)?B.get(ee.right):ee.right;T.nodesInRelativeHorizontal.includes(Q)||(T.nodesInRelativeHorizontal.push(Q),T.nodeToRelativeConstraintMapHorizontal.set(Q,[]),T.dummyToNodeForVerticalAlignment.has(Q)?T.nodeToTempPositionMapHorizontal.set(Q,T.idToNodeMap.get(T.dummyToNodeForVerticalAlignment.get(Q)[0]).getCenterX()):T.nodeToTempPositionMapHorizontal.set(Q,T.idToNodeMap.get(Q).getCenterX())),T.nodesInRelativeHorizontal.includes(W)||(T.nodesInRelativeHorizontal.push(W),T.nodeToRelativeConstraintMapHorizontal.set(W,[]),T.dummyToNodeForVerticalAlignment.has(W)?T.nodeToTempPositionMapHorizontal.set(W,T.idToNodeMap.get(T.dummyToNodeForVerticalAlignment.get(W)[0]).getCenterX()):T.nodeToTempPositionMapHorizontal.set(W,T.idToNodeMap.get(W).getCenterX())),T.nodeToRelativeConstraintMapHorizontal.get(Q).push({right:W,gap:ee.gap}),T.nodeToRelativeConstraintMapHorizontal.get(W).push({left:Q,gap:ee.gap})}else{var Y=P.has(ee.top)?P.get(ee.top):ee.top,Z=P.has(ee.bottom)?P.get(ee.bottom):ee.bottom;T.nodesInRelativeVertical.includes(Y)||(T.nodesInRelativeVertical.push(Y),T.nodeToRelativeConstraintMapVertical.set(Y,[]),T.dummyToNodeForHorizontalAlignment.has(Y)?T.nodeToTempPositionMapVertical.set(Y,T.idToNodeMap.get(T.dummyToNodeForHorizontalAlignment.get(Y)[0]).getCenterY()):T.nodeToTempPositionMapVertical.set(Y,T.idToNodeMap.get(Y).getCenterY())),T.nodesInRelativeVertical.includes(Z)||(T.nodesInRelativeVertical.push(Z),T.nodeToRelativeConstraintMapVertical.set(Z,[]),T.dummyToNodeForHorizontalAlignment.has(Z)?T.nodeToTempPositionMapVertical.set(Z,T.idToNodeMap.get(T.dummyToNodeForHorizontalAlignment.get(Z)[0]).getCenterY()):T.nodeToTempPositionMapVertical.set(Z,T.idToNodeMap.get(Z).getCenterY())),T.nodeToRelativeConstraintMapVertical.get(Y).push({bottom:Z,gap:ee.gap}),T.nodeToRelativeConstraintMapVertical.get(Z).push({top:Y,gap:ee.gap})}});else{var H=new Map,J=new Map;this.constraints.relativePlacementConstraint.forEach(function(ee){if(ee.left){var Q=B.has(ee.left)?B.get(ee.left):ee.left,W=B.has(ee.right)?B.get(ee.right):ee.right;H.has(Q)?H.get(Q).push(W):H.set(Q,[W]),H.has(W)?H.get(W).push(Q):H.set(W,[Q])}else{var Y=P.has(ee.top)?P.get(ee.top):ee.top,Z=P.has(ee.bottom)?P.get(ee.bottom):ee.bottom;J.has(Y)?J.get(Y).push(Z):J.set(Y,[Z]),J.has(Z)?J.get(Z).push(Y):J.set(Z,[Y])}});var X=function(Q,W){var Y=[],Z=[],se=new C,ce=new Set,ue=0;return Q.forEach(function(te,Ne){if(!ce.has(Ne)){Y[ue]=[],Z[ue]=!1;var ae=Ne;for(se.push(ae),ce.add(ae),Y[ue].push(ae);se.length!=0;){ae=se.shift(),W.has(ae)&&(Z[ue]=!0);var we=Q.get(ae);we.forEach(function(Ie){ce.has(Ie)||(se.push(Ie),ce.add(Ie),Y[ue].push(Ie))})}ue++}}),{components:Y,isFixed:Z}},oe=X(H,T.fixedNodesOnHorizontal);this.componentsOnHorizontal=oe.components,this.fixedComponentsOnHorizontal=oe.isFixed;var K=X(J,T.fixedNodesOnVertical);this.componentsOnVertical=K.components,this.fixedComponentsOnVertical=K.isFixed}}},M.prototype.updateDisplacements=function(){var T=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(K){var ee=T.idToNodeMap.get(K.nodeId);ee.displacementX=0,ee.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var I=this.constraints.alignmentConstraint.vertical,A=0;A1){var P;for(P=0;PD&&(D=Math.floor(B.y)),O=Math.floor(B.x+p.DEFAULT_COMPONENT_SEPERATION)}this.transform(new b(y.WORLD_CENTER_X-B.x/2,y.WORLD_CENTER_Y-B.y/2))},M.radialLayout=function(T,I,A){var D=Math.max(this.maxDiagonalInTree(T),p.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(I,null,0,359,0,D);var N=L.calculateBounds(T),O=new S;O.setDeviceOrgX(N.getMinX()),O.setDeviceOrgY(N.getMinY()),O.setWorldOrgX(A.x),O.setWorldOrgY(A.y);for(var B=0;B1;){var Y=W[0];W.splice(0,1);var Z=X.indexOf(Y);Z>=0&&X.splice(Z,1),ee--,oe--}I!=null?Q=(X.indexOf(W[0])+1)%ee:Q=0;for(var se=Math.abs(D-A)/oe,ce=Q;K!=oe;ce=++ce%ee){var ue=X[ce].getOtherEnd(T);if(ue!=I){var te=(A+K*se)%360,Ne=(te+se)%360;M.branchRadialLayout(ue,T,te,Ne,N+O,O),K++}}},M.maxDiagonalInTree=function(T){for(var I=k.MIN_VALUE,A=0;AI&&(I=N)}return I},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var T=this,I={};this.memberGroups={},this.idToDummyNode={};for(var A=[],D=this.graphManager.getAllNodes(),N=0;N"u"&&(I[P]=[]),I[P]=I[P].concat(O)}Object.keys(I).forEach(function($){if(I[$].length>1){var z="DummyCompound_"+$;T.memberGroups[z]=I[$];var H=I[$][0].getParent(),J=new f(T.graphManager);J.id=z,J.paddingLeft=H.paddingLeft||0,J.paddingRight=H.paddingRight||0,J.paddingBottom=H.paddingBottom||0,J.paddingTop=H.paddingTop||0,T.idToDummyNode[z]=J;var X=T.getGraphManager().add(T.newGraph(),J),oe=H.getChild();oe.add(J);for(var K=0;KN?(D.rect.x-=(D.labelWidth-N)/2,D.setWidth(D.labelWidth),D.labelMarginLeft=(D.labelWidth-N)/2):D.labelPosHorizontal=="right"&&D.setWidth(N+D.labelWidth)),D.labelHeight&&(D.labelPosVertical=="top"?(D.rect.y-=D.labelHeight,D.setHeight(O+D.labelHeight),D.labelMarginTop=D.labelHeight):D.labelPosVertical=="center"&&D.labelHeight>O?(D.rect.y-=(D.labelHeight-O)/2,D.setHeight(D.labelHeight),D.labelMarginTop=(D.labelHeight-O)/2):D.labelPosVertical=="bottom"&&D.setHeight(O+D.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var T=this.compoundOrder.length-1;T>=0;T--){var I=this.compoundOrder[T],A=I.id,D=I.paddingLeft,N=I.paddingTop,O=I.labelMarginLeft,B=I.labelMarginTop;this.adjustLocations(this.tiledMemberPack[A],I.rect.x,I.rect.y,D,N,O,B)}},M.prototype.repopulateZeroDegreeMembers=function(){var T=this,I=this.tiledZeroDegreePack;Object.keys(I).forEach(function(A){var D=T.idToDummyNode[A],N=D.paddingLeft,O=D.paddingTop,B=D.labelMarginLeft,P=D.labelMarginTop;T.adjustLocations(I[A],D.rect.x,D.rect.y,N,O,B,P)})},M.prototype.getToBeTiled=function(T){var I=T.id;if(this.toBeTiled[I]!=null)return this.toBeTiled[I];var A=T.getChild();if(A==null)return this.toBeTiled[I]=!1,!1;for(var D=A.getNodes(),N=0;N0)return this.toBeTiled[I]=!1,!1;if(O.getChild()==null){this.toBeTiled[O.id]=!1;continue}if(!this.getToBeTiled(O))return this.toBeTiled[I]=!1,!1}return this.toBeTiled[I]=!0,!0},M.prototype.getNodeDegree=function(T){for(var I=T.id,A=T.getEdges(),D=0,N=0;NH&&(H=X.rect.height)}A+=H+T.verticalPadding}},M.prototype.tileCompoundMembers=function(T,I){var A=this;this.tiledMemberPack=[],Object.keys(T).forEach(function(D){var N=I[D];if(A.tiledMemberPack[D]=A.tileNodes(T[D],N.paddingLeft+N.paddingRight),N.rect.width=A.tiledMemberPack[D].width,N.rect.height=A.tiledMemberPack[D].height,N.setCenter(A.tiledMemberPack[D].centerX,A.tiledMemberPack[D].centerY),N.labelMarginLeft=0,N.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var O=N.rect.width,B=N.rect.height;N.labelWidth&&(N.labelPosHorizontal=="left"?(N.rect.x-=N.labelWidth,N.setWidth(O+N.labelWidth),N.labelMarginLeft=N.labelWidth):N.labelPosHorizontal=="center"&&N.labelWidth>O?(N.rect.x-=(N.labelWidth-O)/2,N.setWidth(N.labelWidth),N.labelMarginLeft=(N.labelWidth-O)/2):N.labelPosHorizontal=="right"&&N.setWidth(O+N.labelWidth)),N.labelHeight&&(N.labelPosVertical=="top"?(N.rect.y-=N.labelHeight,N.setHeight(B+N.labelHeight),N.labelMarginTop=N.labelHeight):N.labelPosVertical=="center"&&N.labelHeight>B?(N.rect.y-=(N.labelHeight-B)/2,N.setHeight(N.labelHeight),N.labelMarginTop=(N.labelHeight-B)/2):N.labelPosVertical=="bottom"&&N.setHeight(B+N.labelHeight))}})},M.prototype.tileNodes=function(T,I){var A=this.tileNodesByFavoringDim(T,I,!0),D=this.tileNodesByFavoringDim(T,I,!1),N=this.getOrgRatio(A),O=this.getOrgRatio(D),B;return OP&&(P=K.getWidth())});var $=O/N,z=B/N,H=Math.pow(A-D,2)+4*($+D)*(z+A)*N,J=(D-A+Math.sqrt(H))/(2*($+D)),X;I?(X=Math.ceil(J),X==J&&X++):X=Math.floor(J);var oe=X*($+D)-D;return P>oe&&(oe=P),oe+=D*2,oe},M.prototype.tileNodesByFavoringDim=function(T,I,A){var D=p.TILING_PADDING_VERTICAL,N=p.TILING_PADDING_HORIZONTAL,O=p.TILING_COMPARE_BY,B={rows:[],rowWidth:[],rowHeight:[],width:0,height:I,verticalPadding:D,horizontalPadding:N,centerX:0,centerY:0};O&&(B.idealRowWidth=this.calcIdealRowWidth(T,A));var P=function(ee){return ee.rect.width*ee.rect.height},$=function(ee,Q){return P(Q)-P(ee)};T.sort(function(K,ee){var Q=$;return B.idealRowWidth?(Q=O,Q(K.id,ee.id)):Q(K,ee)});for(var z=0,H=0,J=0;J0&&(B+=T.horizontalPadding),T.rowWidth[A]=B,T.width0&&(P+=T.verticalPadding);var $=0;P>T.rowHeight[A]&&($=T.rowHeight[A],T.rowHeight[A]=P,$=T.rowHeight[A]-$),T.height+=$,T.rows[A].push(I)},M.prototype.getShortestRowIndex=function(T){for(var I=-1,A=Number.MAX_VALUE,D=0;DA&&(I=D,A=T.rowWidth[D]);return I},M.prototype.canAddHorizontal=function(T,I,A){if(T.idealRowWidth){var D=T.rows.length-1,N=T.rowWidth[D];return N+I+T.horizontalPadding<=T.idealRowWidth}var O=this.getShortestRowIndex(T);if(O<0)return!0;var B=T.rowWidth[O];if(B+T.horizontalPadding+I<=T.width)return!0;var P=0;T.rowHeight[O]0&&(P=A+T.verticalPadding-T.rowHeight[O]);var $;T.width-B>=I+T.horizontalPadding?$=(T.height+P)/(B+I+T.horizontalPadding):$=(T.height+P)/T.width,P=A+T.verticalPadding;var z;return T.widthO&&I!=A){D.splice(-1,1),T.rows[A].push(N),T.rowWidth[I]=T.rowWidth[I]-O,T.rowWidth[A]=T.rowWidth[A]+O,T.width=T.rowWidth[instance.getLongestRowIndex(T)];for(var B=Number.MIN_VALUE,P=0;PB&&(B=D[P].height);I>0&&(B+=T.verticalPadding);var $=T.rowHeight[I]+T.rowHeight[A];T.rowHeight[I]=B,T.rowHeight[A]0)for(var oe=N;oe<=O;oe++)X[0]+=this.grid[oe][B-1].length+this.grid[oe][B].length-1;if(O0)for(var oe=B;oe<=P;oe++)X[3]+=this.grid[N-1][oe].length+this.grid[N][oe].length-1;for(var K=k.MAX_VALUE,ee,Q,W=0;W{var l=o(551).FDLayoutNode,u=o(551).IMath;function h(d,p,g,m){l.call(this,d,p,g,m)}h.prototype=Object.create(l.prototype);for(var f in l)h[f]=l[f];h.prototype.calculateDisplacement=function(){var d=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementX=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementX)),Math.abs(this.displacementY)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementY=d.coolingFactor*d.maxNodeDisplacement*u.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},h.prototype.propogateDisplacementToChildren=function(d,p){for(var g=this.getChild().getNodes(),m,y=0;y{function l(g){if(Array.isArray(g)){for(var m=0,y=Array(g.length);m0){var st=0;Ze.forEach(function(Ke){ke=="horizontal"?(ge.set(Ke,x.has(Ke)?b[x.get(Ke)]:ye.get(Ke)),st+=ge.get(Ke)):(ge.set(Ke,x.has(Ke)?w[x.get(Ke)]:ye.get(Ke)),st+=ge.get(Ke))}),st=st/Ze.length,ft.forEach(function(Ke){j.has(Ke)||ge.set(Ke,st)})}else{var Ue=0;ft.forEach(function(Ke){ke=="horizontal"?Ue+=x.has(Ke)?b[x.get(Ke)]:ye.get(Ke):Ue+=x.has(Ke)?w[x.get(Ke)]:ye.get(Ke)}),Ue=Ue/ft.length,ft.forEach(function(Ke){ge.set(Ke,Ue)})}});for(var qe=function(){var Ze=Ce.shift(),st=U.get(Ze);st.forEach(function(Ue){if(ge.get(Ue.id)Ke&&(Ke=tt),_tit&&(it=_t)}}catch(Rn){Ht=!0,ot=Rn}finally{try{!mt&&et.return&&et.return()}finally{if(Ht)throw ot}}var ur=(st+Ke)/2-(Ue+it)/2,Qt=!0,Jt=!1,en=void 0;try{for(var Cr=ft[Symbol.iterator](),Kn;!(Qt=(Kn=Cr.next()).done);Qt=!0){var cn=Kn.value;ge.set(cn,ge.get(cn)+ur)}}catch(Rn){Jt=!0,en=Rn}finally{try{!Qt&&Cr.return&&Cr.return()}finally{if(Jt)throw en}}})}return ge},R=function(U){var ke=0,j=0,ye=0,Ae=0;if(U.forEach(function($e){$e.left?b[x.get($e.left)]-b[x.get($e.right)]>=0?ke++:j++:w[x.get($e.top)]-w[x.get($e.bottom)]>=0?ye++:Ae++}),ke>j&&ye>Ae)for(var Ge=0;Gej)for(var Fe=0;FeAe)for(var ge=0;ge1)m.fixedNodeConstraint.forEach(function(he,U){D[U]=[he.position.x,he.position.y],N[U]=[b[x.get(he.nodeId)],w[x.get(he.nodeId)]]}),O=!0;else if(m.alignmentConstraint)(function(){var he=0;if(m.alignmentConstraint.vertical){for(var U=m.alignmentConstraint.vertical,ke=function(ge){var $e=new Set;U[ge].forEach(function(lt){$e.add(lt)});var Ce=new Set([].concat(l($e)).filter(function(lt){return P.has(lt)})),qe=void 0;Ce.size>0?qe=b[x.get(Ce.values().next().value)]:qe=C($e).x,U[ge].forEach(function(lt){D[he]=[qe,w[x.get(lt)]],N[he]=[b[x.get(lt)],w[x.get(lt)]],he++})},j=0;j0?qe=b[x.get(Ce.values().next().value)]:qe=C($e).y,ye[ge].forEach(function(lt){D[he]=[b[x.get(lt)],qe],N[he]=[b[x.get(lt)],w[x.get(lt)]],he++})},Ge=0;GeJ&&(J=H[oe].length,X=oe);if(J0){var Oe={x:0,y:0};m.fixedNodeConstraint.forEach(function(he,U){var ke={x:b[x.get(he.nodeId)],y:w[x.get(he.nodeId)]},j=he.position,ye=S(j,ke);Oe.x+=ye.x,Oe.y+=ye.y}),Oe.x/=m.fixedNodeConstraint.length,Oe.y/=m.fixedNodeConstraint.length,b.forEach(function(he,U){b[U]+=Oe.x}),w.forEach(function(he,U){w[U]+=Oe.y}),m.fixedNodeConstraint.forEach(function(he){b[x.get(he.nodeId)]=he.position.x,w[x.get(he.nodeId)]=he.position.y})}if(m.alignmentConstraint){if(m.alignmentConstraint.vertical)for(var De=m.alignmentConstraint.vertical,We=function(U){var ke=new Set;De[U].forEach(function(Ae){ke.add(Ae)});var j=new Set([].concat(l(ke)).filter(function(Ae){return P.has(Ae)})),ye=void 0;j.size>0?ye=b[x.get(j.values().next().value)]:ye=C(ke).x,ke.forEach(function(Ae){P.has(Ae)||(b[x.get(Ae)]=ye)})},Re=0;Re0?ye=w[x.get(j.values().next().value)]:ye=C(ke).y,ke.forEach(function(Ae){P.has(Ae)||(w[x.get(Ae)]=ye)})},q=0;q{a.exports=t}},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return e[a](o,o.exports,n),o.exports}var i=n(45);return i})()})});var Age=di((Jx,GO)=>{(function(e,r){typeof Jx=="object"&&typeof GO=="object"?GO.exports=r($O()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof Jx=="object"?Jx.cytoscapeFcose=r($O()):e.cytoscapeFcose=r(e.coseBase)})(Jx,function(t){return(()=>{"use strict";var e={658:a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var o=arguments.length,l=Array(o>1?o-1:0),u=1;u{var l=function(){function f(d,p){var g=[],m=!0,y=!1,x=void 0;try{for(var b=d[Symbol.iterator](),w;!(m=(w=b.next()).done)&&(g.push(w.value),!(p&&g.length===p));m=!0);}catch(_){y=!0,x=_}finally{try{!m&&b.return&&b.return()}finally{if(y)throw x}}return g}return function(d,p){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return f(d,p);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=o(140).layoutBase.LinkedList,h={};h.getTopMostNodes=function(f){for(var d={},p=0;p0&&O.merge(z)});for(var B=0;B1){w=x[0],_=w.connectedEdges().length,x.forEach(function(N){N.connectedEdges().length<_&&(_=N.connectedEdges().length,w=N)}),L.push(w.id());var D=f.collection();D.merge(x[0]),x.forEach(function(N){D.merge(N)}),x=[],p=p.difference(D),E++}};do C();while(!k);return g&&L.length>0&&g.set("dummy"+(g.size+1),L),S},h.relocateComponent=function(f,d,p){if(!p.fixedNodeConstraint){var g=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY;if(p.quality=="draft"){var b=!0,w=!1,_=void 0;try{for(var k=d.nodeIndexes[Symbol.iterator](),E;!(b=(E=k.next()).done);b=!0){var L=E.value,S=l(L,2),C=S[0],M=S[1],R=p.cy.getElementById(C);if(R){var T=R.boundingBox(),I=d.xCoords[M]-T.w/2,A=d.xCoords[M]+T.w/2,D=d.yCoords[M]-T.h/2,N=d.yCoords[M]+T.h/2;Im&&(m=A),Dx&&(x=N)}}}catch(z){w=!0,_=z}finally{try{!b&&k.return&&k.return()}finally{if(w)throw _}}var O=f.x-(m+g)/2,B=f.y-(x+y)/2;d.xCoords=d.xCoords.map(function(z){return z+O}),d.yCoords=d.yCoords.map(function(z){return z+B})}else{Object.keys(d).forEach(function(z){var H=d[z],J=H.getRect().x,X=H.getRect().x+H.getRect().width,oe=H.getRect().y,K=H.getRect().y+H.getRect().height;Jm&&(m=X),oex&&(x=K)});var P=f.x-(m+g)/2,$=f.y-(x+y)/2;Object.keys(d).forEach(function(z){var H=d[z];H.setCenter(H.getCenterX()+P,H.getCenterY()+$)})}}},h.calcBoundingBox=function(f,d,p,g){for(var m=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,x=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER,w=void 0,_=void 0,k=void 0,E=void 0,L=f.descendants().not(":parent"),S=L.length,C=0;Cw&&(m=w),y<_&&(y=_),x>k&&(x=k),b{var l=o(548),u=o(140).CoSELayout,h=o(140).CoSENode,f=o(140).layoutBase.PointD,d=o(140).layoutBase.DimensionD,p=o(140).layoutBase.LayoutConstants,g=o(140).layoutBase.FDLayoutConstants,m=o(140).CoSEConstants,y=function(b,w){var _=b.cy,k=b.eles,E=k.nodes(),L=k.edges(),S=void 0,C=void 0,M=void 0,R={};b.randomize&&(S=w.nodeIndexes,C=w.xCoords,M=w.yCoords);var T=function(z){return typeof z=="function"},I=function(z,H){return T(z)?z(H):z},A=l.calcParentsWithoutChildren(_,k),D=function $(z,H,J,X){for(var oe=H.length,K=0;K0){var se=void 0;se=J.getGraphManager().add(J.newGraph(),W),$(se,Q,J,X)}}},N=function(z,H,J){for(var X=0,oe=0,K=0;K0?m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=X/oe:T(b.idealEdgeLength)?m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50:m.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=b.idealEdgeLength,m.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,m.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH)},O=function(z,H){H.fixedNodeConstraint&&(z.constraints.fixedNodeConstraint=H.fixedNodeConstraint),H.alignmentConstraint&&(z.constraints.alignmentConstraint=H.alignmentConstraint),H.relativePlacementConstraint&&(z.constraints.relativePlacementConstraint=H.relativePlacementConstraint)};b.nestingFactor!=null&&(m.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=b.nestingFactor),b.gravity!=null&&(m.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=b.gravity),b.numIter!=null&&(m.MAX_ITERATIONS=g.MAX_ITERATIONS=b.numIter),b.gravityRange!=null&&(m.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=b.gravityRange),b.gravityCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=b.gravityCompound),b.gravityRangeCompound!=null&&(m.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=b.gravityRangeCompound),b.initialEnergyOnIncremental!=null&&(m.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=b.initialEnergyOnIncremental),b.tilingCompareBy!=null&&(m.TILING_COMPARE_BY=b.tilingCompareBy),b.quality=="proof"?p.QUALITY=2:p.QUALITY=0,m.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=p.NODE_DIMENSIONS_INCLUDE_LABELS=b.nodeDimensionsIncludeLabels,m.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!b.randomize,m.ANIMATE=g.ANIMATE=p.ANIMATE=b.animate,m.TILE=b.tile,m.TILING_PADDING_VERTICAL=typeof b.tilingPaddingVertical=="function"?b.tilingPaddingVertical.call():b.tilingPaddingVertical,m.TILING_PADDING_HORIZONTAL=typeof b.tilingPaddingHorizontal=="function"?b.tilingPaddingHorizontal.call():b.tilingPaddingHorizontal,m.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!0,m.PURE_INCREMENTAL=!b.randomize,p.DEFAULT_UNIFORM_LEAF_NODE_SIZES=b.uniformNodeDimensions,b.step=="transformed"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!1),b.step=="enforced"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!1),b.step=="cose"&&(m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!1,m.APPLY_LAYOUT=!0),b.step=="all"&&(b.randomize?m.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:m.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,m.ENFORCE_CONSTRAINTS=!0,m.APPLY_LAYOUT=!0),b.fixedNodeConstraint||b.alignmentConstraint||b.relativePlacementConstraint?m.TREE_REDUCTION_ON_INCREMENTAL=!1:m.TREE_REDUCTION_ON_INCREMENTAL=!0;var B=new u,P=B.newGraphManager();return D(P.addRoot(),l.getTopMostNodes(E),B,b),N(B,P,L),O(B,b),B.runLayout(),R};a.exports={coseLayout:y}},212:(a,s,o)=>{var l=function(){function b(w,_){for(var k=0;k<_.length;k++){var E=_[k];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(w,E.key,E)}}return function(w,_,k){return _&&b(w.prototype,_),k&&b(w,k),w}}();function u(b,w){if(!(b instanceof w))throw new TypeError("Cannot call a class as a function")}var h=o(658),f=o(548),d=o(657),p=d.spectralLayout,g=o(816),m=g.coseLayout,y=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(w){return 4500},idealEdgeLength:function(w){return 50},edgeElasticity:function(w){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),x=function(){function b(w){u(this,b),this.options=h({},y,w)}return l(b,[{key:"run",value:function(){var _=this,k=this.options,E=k.cy,L=k.eles,S=[],C=void 0,M=void 0,R=[],T=void 0,I=[];k.fixedNodeConstraint&&(!Array.isArray(k.fixedNodeConstraint)||k.fixedNodeConstraint.length==0)&&(k.fixedNodeConstraint=void 0),k.alignmentConstraint&&(k.alignmentConstraint.vertical&&(!Array.isArray(k.alignmentConstraint.vertical)||k.alignmentConstraint.vertical.length==0)&&(k.alignmentConstraint.vertical=void 0),k.alignmentConstraint.horizontal&&(!Array.isArray(k.alignmentConstraint.horizontal)||k.alignmentConstraint.horizontal.length==0)&&(k.alignmentConstraint.horizontal=void 0)),k.relativePlacementConstraint&&(!Array.isArray(k.relativePlacementConstraint)||k.relativePlacementConstraint.length==0)&&(k.relativePlacementConstraint=void 0);var A=k.fixedNodeConstraint||k.alignmentConstraint||k.relativePlacementConstraint;A&&(k.tile=!1,k.packComponents=!1);var D=void 0,N=!1;if(E.layoutUtilities&&k.packComponents&&(D=E.layoutUtilities("get"),D||(D=E.layoutUtilities()),N=!0),L.nodes().length>0)if(N){var P=f.getTopMostNodes(k.eles.nodes());if(T=f.connectComponents(E,k.eles,P),T.forEach(function(ae){var we=ae.boundingBox();I.push({x:we.x1+we.w/2,y:we.y1+we.h/2})}),k.randomize&&T.forEach(function(ae){k.eles=ae,S.push(p(k))}),k.quality=="default"||k.quality=="proof"){var $=E.collection();if(k.tile){var z=new Map,H=[],J=[],X=0,oe={nodeIndexes:z,xCoords:H,yCoords:J},K=[];if(T.forEach(function(ae,we){ae.edges().length==0&&(ae.nodes().forEach(function(Ie,Ee){$.merge(ae.nodes()[Ee]),Ie.isParent()||(oe.nodeIndexes.set(ae.nodes()[Ee].id(),X++),oe.xCoords.push(ae.nodes()[0].position().x),oe.yCoords.push(ae.nodes()[0].position().y))}),K.push(we))}),$.length>1){var ee=$.boundingBox();I.push({x:ee.x1+ee.w/2,y:ee.y1+ee.h/2}),T.push($),S.push(oe);for(var Q=K.length-1;Q>=0;Q--)T.splice(K[Q],1),S.splice(K[Q],1),I.splice(K[Q],1)}}T.forEach(function(ae,we){k.eles=ae,R.push(m(k,S[we])),f.relocateComponent(I[we],R[we],k)})}else T.forEach(function(ae,we){f.relocateComponent(I[we],S[we],k)});var W=new Set;if(T.length>1){var Y=[],Z=L.filter(function(ae){return ae.css("display")=="none"});T.forEach(function(ae,we){var Ie=void 0;if(k.quality=="draft"&&(Ie=S[we].nodeIndexes),ae.nodes().not(Z).length>0){var Ee={};Ee.edges=[],Ee.nodes=[];var Oe=void 0;ae.nodes().not(Z).forEach(function(De){if(k.quality=="draft")if(!De.isParent())Oe=Ie.get(De.id()),Ee.nodes.push({x:S[we].xCoords[Oe]-De.boundingbox().w/2,y:S[we].yCoords[Oe]-De.boundingbox().h/2,width:De.boundingbox().w,height:De.boundingbox().h});else{var We=f.calcBoundingBox(De,S[we].xCoords,S[we].yCoords,Ie);Ee.nodes.push({x:We.topLeftX,y:We.topLeftY,width:We.width,height:We.height})}else R[we][De.id()]&&Ee.nodes.push({x:R[we][De.id()].getLeft(),y:R[we][De.id()].getTop(),width:R[we][De.id()].getWidth(),height:R[we][De.id()].getHeight()})}),ae.edges().forEach(function(De){var We=De.source(),Re=De.target();if(We.css("display")!="none"&&Re.css("display")!="none")if(k.quality=="draft"){var Pe=Ie.get(We.id()),xe=Ie.get(Re.id()),q=[],de=[];if(We.isParent()){var ie=f.calcBoundingBox(We,S[we].xCoords,S[we].yCoords,Ie);q.push(ie.topLeftX+ie.width/2),q.push(ie.topLeftY+ie.height/2)}else q.push(S[we].xCoords[Pe]),q.push(S[we].yCoords[Pe]);if(Re.isParent()){var he=f.calcBoundingBox(Re,S[we].xCoords,S[we].yCoords,Ie);de.push(he.topLeftX+he.width/2),de.push(he.topLeftY+he.height/2)}else de.push(S[we].xCoords[xe]),de.push(S[we].yCoords[xe]);Ee.edges.push({startX:q[0],startY:q[1],endX:de[0],endY:de[1]})}else R[we][We.id()]&&R[we][Re.id()]&&Ee.edges.push({startX:R[we][We.id()].getCenterX(),startY:R[we][We.id()].getCenterY(),endX:R[we][Re.id()].getCenterX(),endY:R[we][Re.id()].getCenterY()})}),Ee.nodes.length>0&&(Y.push(Ee),W.add(we))}});var se=D.packComponents(Y,k.randomize).shifts;if(k.quality=="draft")S.forEach(function(ae,we){var Ie=ae.xCoords.map(function(Oe){return Oe+se[we].dx}),Ee=ae.yCoords.map(function(Oe){return Oe+se[we].dy});ae.xCoords=Ie,ae.yCoords=Ee});else{var ce=0;W.forEach(function(ae){Object.keys(R[ae]).forEach(function(we){var Ie=R[ae][we];Ie.setCenter(Ie.getCenterX()+se[ce].dx,Ie.getCenterY()+se[ce].dy)}),ce++})}}}else{var O=k.eles.boundingBox();if(I.push({x:O.x1+O.w/2,y:O.y1+O.h/2}),k.randomize){var B=p(k);S.push(B)}k.quality=="default"||k.quality=="proof"?(R.push(m(k,S[0])),f.relocateComponent(I[0],R[0],k)):f.relocateComponent(I[0],S[0],k)}var ue=function(we,Ie){if(k.quality=="default"||k.quality=="proof"){typeof we=="number"&&(we=Ie);var Ee=void 0,Oe=void 0,De=we.data("id");return R.forEach(function(Re){De in Re&&(Ee={x:Re[De].getRect().getCenterX(),y:Re[De].getRect().getCenterY()},Oe=Re[De])}),k.nodeDimensionsIncludeLabels&&(Oe.labelWidth&&(Oe.labelPosHorizontal=="left"?Ee.x+=Oe.labelWidth/2:Oe.labelPosHorizontal=="right"&&(Ee.x-=Oe.labelWidth/2)),Oe.labelHeight&&(Oe.labelPosVertical=="top"?Ee.y+=Oe.labelHeight/2:Oe.labelPosVertical=="bottom"&&(Ee.y-=Oe.labelHeight/2))),Ee==null&&(Ee={x:we.position("x"),y:we.position("y")}),{x:Ee.x,y:Ee.y}}else{var We=void 0;return S.forEach(function(Re){var Pe=Re.nodeIndexes.get(we.id());Pe!=null&&(We={x:Re.xCoords[Pe],y:Re.yCoords[Pe]})}),We==null&&(We={x:we.position("x"),y:we.position("y")}),{x:We.x,y:We.y}}};if(k.quality=="default"||k.quality=="proof"||k.randomize){var te=f.calcParentsWithoutChildren(E,L),Ne=L.filter(function(ae){return ae.css("display")=="none"});k.eles=L.not(Ne),L.nodes().not(":parent").not(Ne).layoutPositions(_,k,ue),te.length>0&&te.forEach(function(ae){ae.position(ue(ae))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),b}();a.exports=x},657:(a,s,o)=>{var l=o(548),u=o(140).layoutBase.Matrix,h=o(140).layoutBase.SVD,f=function(p){var g=p.cy,m=p.eles,y=m.nodes(),x=m.nodes(":parent"),b=new Map,w=new Map,_=new Map,k=[],E=[],L=[],S=[],C=[],M=[],R=[],T=[],I=void 0,A=void 0,D=1e8,N=1e-9,O=p.piTol,B=p.samplingType,P=p.nodeSeparation,$=void 0,z=function(){for(var ke=0,j=0,ye=!1;j<$;){ke=Math.floor(Math.random()*A),ye=!1;for(var Ae=0;Ae=Ge;){ge=Ae[Ge++];for(var ft=k[ge],Ze=0;Zeqe&&(qe=C[Ue],lt=Ue)}return lt},J=function(ke){var j=void 0;if(ke){j=Math.floor(Math.random()*A),I=j;for(var Ae=0;Ae=1)break;qe=Ce}for(var ft=0;ft=1)break;qe=Ce}for(var st=0;st0&&(j.isParent()?k[ke].push(_.get(j.id())):k[ke].push(j.id()))})});var te=function(ke){var j=w.get(ke),ye=void 0;b.get(ke).forEach(function(Ae){g.getElementById(Ae).isParent()?ye=_.get(Ae):ye=Ae,k[j].push(ye),k[w.get(ye)].push(ke)})},Ne=!0,ae=!1,we=void 0;try{for(var Ie=b.keys()[Symbol.iterator](),Ee;!(Ne=(Ee=Ie.next()).done);Ne=!0){var Oe=Ee.value;te(Oe)}}catch(U){ae=!0,we=U}finally{try{!Ne&&Ie.return&&Ie.return()}finally{if(ae)throw we}}A=w.size;var De=void 0;if(A>2){$=A{var l=o(212),u=function(f){f&&f("layout","fcose",l)};typeof cytoscape<"u"&&u(cytoscape),a.exports=u},140:a=>{a.exports=t}},r={};function n(a){var s=r[a];if(s!==void 0)return s.exports;var o=r[a]={exports:{}};return e[a](o,o.exports,n),o.exports}var i=n(579);return i})()})});var Vge={};vr(Vge,{diagram:()=>pQe});function zi(t){let e=pe().architecture;return e?.[t]?e[t]:Mge[t]}function Oge(t,e){t.forEach(r=>{e.add({group:"nodes",data:{type:"service",id:r.id,icon:r.icon,label:r.title,parent:r.in,width:zi("iconSize"),height:zi("iconSize")},classes:"node-service"})})}function Pge(t,e){t.forEach(r=>{e.add({group:"nodes",data:{type:"junction",id:r.id,parent:r.in,width:zi("iconSize"),height:zi("iconSize")},classes:"node-junction"})})}function Bge(t,e){e.nodes().map(r=>{let n=d1(r);if(n.type==="group")return;n.x=r.position().x,n.y=r.position().y,t.getElementById(n.id).attr("transform","translate("+(n.x||0)+","+(n.y||0)+")")})}function Fge(t,e){t.forEach(r=>{e.add({group:"nodes",data:{type:"group",id:r.id,icon:r.icon,label:r.title,parent:r.in},classes:"node-group"})})}function zge(t,e){t.forEach(r=>{let{lhsId:n,rhsId:i,lhsInto:a,lhsGroup:s,rhsInto:o,lhsDir:l,rhsDir:u,rhsGroup:h,title:f}=r,d=Nge(r.lhsDir,r.rhsDir)?"segments":"straight",p={id:`${n}-${i}`,label:f,source:n,sourceDir:l,sourceArrow:a,sourceGroup:s,sourceEndpoint:l==="L"?"0 50%":l==="R"?"100% 50%":l==="T"?"50% 0":"50% 100%",target:i,targetDir:u,targetArrow:o,targetGroup:h,targetEndpoint:u==="L"?"0 50%":u==="R"?"100% 50%":u==="T"?"50% 0":"50% 100%"};e.add({group:"edges",data:p,classes:d})})}function $ge(t){let e=t.map(i=>{let a={},s={};return Object.entries(i).forEach(([o,[l,u]])=>{a[u]||(a[u]=[]),s[l]||(s[l]=[]),a[u].push(o),s[l].push(o)}),{horiz:Object.values(a).filter(o=>o.length>1),vert:Object.values(s).filter(o=>o.length>1)}}),[r,n]=e.reduce(([i,a],{horiz:s,vert:o})=>[[...i,...s],[...a,...o]],[[],[]]);return{horizontal:r,vertical:n}}function Gge(t){let e=[],r=v(i=>`${i[0]},${i[1]}`,"posToStr"),n=v(i=>i.split(",").map(a=>parseInt(a)),"strToPos");return t.forEach(i=>{let a=Object.fromEntries(Object.entries(i).map(([u,h])=>[r(h),u])),s=[r([0,0])],o={},l={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;s.length>0;){let u=s.shift();if(u){o[u]=1;let h=a[u];if(h){let f=n(u);Object.entries(l).forEach(([d,p])=>{let g=r([f[0]+p[0],f[1]+p[1]]),m=a[g];m&&!o[g]&&(s.push(g),e.push({[_ge[d]]:m,[_ge[BZe(d)]]:h,gap:1.5*zi("iconSize")}))})}}}}),e}function Uge(t,e,r,n,{spatialMaps:i}){return new Promise(a=>{let s=Ve("body").append("div").attr("id","cy").attr("style","display:none"),o=Jo({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${zi("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${zi("padding")}px`}}]});s.remove(),Fge(r,o),Oge(t,o),Pge(e,o),zge(n,o);let l=$ge(i),u=Gge(i),h=o.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(f){let[d,p]=f.connectedNodes(),{parent:g}=d1(d),{parent:m}=d1(p);return g===m?1.5*zi("iconSize"):.5*zi("iconSize")},edgeElasticity(f){let[d,p]=f.connectedNodes(),{parent:g}=d1(d),{parent:m}=d1(p);return g===m?.45:.001},alignmentConstraint:l,relativePlacementConstraint:u});h.one("layoutstop",()=>{function f(d,p,g,m){let y,x,{x:b,y:w}=d,{x:_,y:k}=p;x=(m-w+(b-g)*(w-k)/(b-_))/Math.sqrt(1+Math.pow((w-k)/(b-_),2)),y=Math.sqrt(Math.pow(m-w,2)+Math.pow(g-b,2)-Math.pow(x,2));let E=Math.sqrt(Math.pow(_-b,2)+Math.pow(k-w,2));y=y/E;let L=(_-b)*(m-w)-(k-w)*(g-b);switch(!0){case L>=0:L=1;break;case L<0:L=-1;break}let S=(_-b)*(g-b)+(k-w)*(m-w);switch(!0){case S>=0:S=1;break;case S<0:S=-1;break}return x=Math.abs(x)*L,y=y*S,{distances:x,weights:y}}v(f,"getSegmentWeights"),o.startBatch();for(let d of Object.values(o.edges()))if(d.data?.()){let{x:p,y:g}=d.source().position(),{x:m,y}=d.target().position();if(p!==m&&g!==y){let x=d.sourceEndpoint(),b=d.targetEndpoint(),{sourceDir:w}=Ige(d),[_,k]=Af(w)?[x.x,b.y]:[b.x,x.y],{weights:E,distances:L}=f(x,b,_,k);d.style("segment-distances",L),d.style("segment-weights",E)}}o.endBatch(),h.run()}),h.run(),o.ready(f=>{re.info("Ready",f),a(o)})})}var Dge,_ge,Lge,TE,BZe,Rge,zs,Af,Nge,FZe,zZe,UO,$Ze,GZe,UZe,VZe,Ige,d1,Mge,cr,WZe,HZe,qZe,YZe,XZe,jZe,KZe,ZZe,QZe,JZe,eQe,tQe,rQe,nQe,EE,iQe,aQe,sQe,oQe,f1,eb,lQe,cQe,uQe,hQe,fQe,dQe,pQe,Wge=F(()=>{sl();Ya();ky();Hw();kn();Iu();or();km();ZD();Dge=Gi(Age(),1);lr();_ge={L:"left",R:"right",T:"top",B:"bottom"},Lge={L:v(t=>`${t},${t/2} 0,${t} 0,0`,"L"),R:v(t=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:v(t=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:v(t=>`${t/2},0 ${t},${t} 0,${t}`,"B")},TE={L:v((t,e)=>t-e+2,"L"),R:v((t,e)=>t-2,"R"),T:v((t,e)=>t-e+2,"T"),B:v((t,e)=>t-2,"B")},BZe=v(function(t){return zs(t)?t==="L"?"R":"L":t==="T"?"B":"T"},"getOppositeArchitectureDirection"),Rge=v(function(t){let e=t;return e==="L"||e==="R"||e==="T"||e==="B"},"isArchitectureDirection"),zs=v(function(t){let e=t;return e==="L"||e==="R"},"isArchitectureDirectionX"),Af=v(function(t){let e=t;return e==="T"||e==="B"},"isArchitectureDirectionY"),Nge=v(function(t,e){let r=zs(t)&&Af(e),n=Af(t)&&zs(e);return r||n},"isArchitectureDirectionXY"),FZe=v(function(t){let e=t[0],r=t[1],n=zs(e)&&Af(r),i=Af(e)&&zs(r);return n||i},"isArchitecturePairXY"),zZe=v(function(t){return t!=="LL"&&t!=="RR"&&t!=="TT"&&t!=="BB"},"isValidArchitectureDirectionPair"),UO=v(function(t,e){let r=`${t}${e}`;return zZe(r)?r:void 0},"getArchitectureDirectionPair"),$Ze=v(function([t,e],r){let n=r[0],i=r[1];return zs(n)?Af(i)?[t+(n==="L"?-1:1),e+(i==="T"?1:-1)]:[t+(n==="L"?-1:1),e]:zs(i)?[t+(i==="L"?1:-1),e+(n==="T"?1:-1)]:[t,e+(n==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),GZe=v(function(t){return t==="LT"||t==="TL"?[1,1]:t==="BL"||t==="LB"?[1,-1]:t==="BR"||t==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),UZe=v(function(t){return t.type==="service"},"isArchitectureService"),VZe=v(function(t){return t.type==="junction"},"isArchitectureJunction"),Ige=v(t=>t.data(),"edgeData"),d1=v(t=>t.data(),"nodeData"),Mge=sr.architecture,cr=new Rg(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:Mge,dataStructures:void 0,elements:{}})),WZe=v(()=>{cr.reset(),xr()},"clear"),HZe=v(function({id:t,icon:e,in:r,title:n,iconText:i}){if(cr.records.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${cr.records.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The service [${t}] cannot be placed within itself`);if(cr.records.registeredIds[r]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(cr.records.registeredIds[r]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}cr.records.registeredIds[t]="node",cr.records.nodes[t]={id:t,type:"service",icon:e,iconText:i,title:n,edges:[],in:r}},"addService"),qZe=v(()=>Object.values(cr.records.nodes).filter(UZe),"getServices"),YZe=v(function({id:t,in:e}){cr.records.registeredIds[t]="node",cr.records.nodes[t]={id:t,type:"junction",edges:[],in:e}},"addJunction"),XZe=v(()=>Object.values(cr.records.nodes).filter(VZe),"getJunctions"),jZe=v(()=>Object.values(cr.records.nodes),"getNodes"),KZe=v(t=>cr.records.nodes[t],"getNode"),ZZe=v(function({id:t,icon:e,in:r,title:n}){if(cr.records.registeredIds[t]!==void 0)throw new Error(`The group id [${t}] is already in use by another ${cr.records.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The group [${t}] cannot be placed within itself`);if(cr.records.registeredIds[r]===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(cr.records.registeredIds[r]==="node")throw new Error(`The group [${t}]'s parent is not a group`)}cr.records.registeredIds[t]="group",cr.records.groups[t]={id:t,icon:e,title:n,in:r}},"addGroup"),QZe=v(()=>Object.values(cr.records.groups),"getGroups"),JZe=v(function({lhsId:t,rhsId:e,lhsDir:r,rhsDir:n,lhsInto:i,rhsInto:a,lhsGroup:s,rhsGroup:o,title:l}){if(!Rge(r))throw new Error(`Invalid direction given for left hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${r}`);if(!Rge(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${n}`);if(cr.records.nodes[t]===void 0&&cr.records.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(cr.records.nodes[e]===void 0&&cr.records.groups[t]===void 0)throw new Error(`The right-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);let u=cr.records.nodes[t].in,h=cr.records.nodes[e].in;if(s&&u&&h&&u==h)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(o&&u&&h&&u==h)throw new Error(`The right-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let f={lhsId:t,lhsDir:r,lhsInto:i,lhsGroup:s,rhsId:e,rhsDir:n,rhsInto:a,rhsGroup:o,title:l};cr.records.edges.push(f),cr.records.nodes[t]&&cr.records.nodes[e]&&(cr.records.nodes[t].edges.push(cr.records.edges[cr.records.edges.length-1]),cr.records.nodes[e].edges.push(cr.records.edges[cr.records.edges.length-1]))},"addEdge"),eQe=v(()=>cr.records.edges,"getEdges"),tQe=v(()=>{if(cr.records.dataStructures===void 0){let t=Object.entries(cr.records.nodes).reduce((s,[o,l])=>(s[o]=l.edges.reduce((u,h)=>{if(h.lhsId===o){let f=UO(h.lhsDir,h.rhsDir);f&&(u[f]=h.rhsId)}else{let f=UO(h.rhsDir,h.lhsDir);f&&(u[f]=h.lhsId)}return u},{}),s),{}),e=Object.keys(t)[0],r={[e]:1},n=Object.keys(t).reduce((s,o)=>o===e?s:{...s,[o]:1},{}),i=v(s=>{let o={[s]:[0,0]},l=[s];for(;l.length>0;){let u=l.shift();if(u){r[u]=1,delete n[u];let h=t[u],[f,d]=o[u];Object.entries(h).forEach(([p,g])=>{r[g]||(o[g]=$Ze([f,d],p),l.push(g))})}}return o},"BFS"),a=[i(e)];for(;Object.keys(n).length>0;)a.push(i(Object.keys(n)[0]));cr.records.dataStructures={adjList:t,spatialMaps:a}}return cr.records.dataStructures},"getDataStructures"),rQe=v((t,e)=>{cr.records.elements[t]=e},"setElementForId"),nQe=v(t=>cr.records.elements[t],"getElementById"),EE={clear:WZe,setDiagramTitle:tn,getDiagramTitle:qr,setAccTitle:Tr,getAccTitle:_r,setAccDescription:Lr,getAccDescription:Rr,addService:HZe,getServices:qZe,addJunction:YZe,getJunctions:XZe,getNodes:jZe,getNode:KZe,addGroup:ZZe,getGroups:QZe,addEdge:JZe,getEdges:eQe,setElementForId:rQe,getElementById:nQe,getDataStructures:tQe};v(zi,"getConfigField");iQe=v((t,e)=>{Pu(t,e),t.groups.map(e.addGroup),t.services.map(r=>e.addService({...r,type:"service"})),t.junctions.map(r=>e.addJunction({...r,type:"junction"})),t.edges.map(e.addEdge)},"populateDb"),aQe={parse:v(async t=>{let e=await Nl("architecture",t);re.debug(e),iQe(e,EE)},"parse")},sQe=v(t=>` .edge { stroke-width: ${t.archEdgeWidth}; stroke: ${t.archEdgeColor}; fill: none; } .arrow { fill: ${t.archEdgeArrowColor}; } .node-bkg { fill: none; stroke: ${t.archGroupBorderColor}; stroke-width: ${t.archGroupBorderWidth}; stroke-dasharray: 8; } .node-icon-text { display: flex; align-items: center; } .node-icon-text > div { color: #fff; margin: 1px; height: fit-content; text-align: center; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; } `,"getStyles"),oQe=sQe,f1=v(t=>`${t}`,"wrapIcon"),eb={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:f1('')},server:{body:f1('')},disk:{body:f1('')},internet:{body:f1('')},cloud:{body:f1('')},unknown:EC,blank:{body:f1("")}}},lQe=v(async function(t,e){let r=zi("padding"),n=zi("iconSize"),i=n/2,a=n/6,s=a/2;await Promise.all(e.edges().map(async o=>{let{source:l,sourceDir:u,sourceArrow:h,sourceGroup:f,target:d,targetDir:p,targetArrow:g,targetGroup:m,label:y}=Ige(o),{x,y:b}=o[0].sourceEndpoint(),{x:w,y:_}=o[0].midpoint(),{x:k,y:E}=o[0].targetEndpoint(),L=r+4;if(f&&(zs(u)?x+=u==="L"?-L:L:b+=u==="T"?-L:L+18),m&&(zs(p)?k+=p==="L"?-L:L:E+=p==="T"?-L:L+18),!f&&EE.getNode(l)?.type==="junction"&&(zs(u)?x+=u==="L"?i:-i:b+=u==="T"?i:-i),!m&&EE.getNode(d)?.type==="junction"&&(zs(p)?k+=p==="L"?i:-i:E+=p==="T"?i:-i),o[0]._private.rscratch){let S=t.insert("g");if(S.insert("path").attr("d",`M ${x},${b} L ${w},${_} L${k},${E} `).attr("class","edge"),h){let C=zs(u)?TE[u](x,a):x-s,M=Af(u)?TE[u](b,a):b-s;S.insert("polygon").attr("points",Lge[u](a)).attr("transform",`translate(${C},${M})`).attr("class","arrow")}if(g){let C=zs(p)?TE[p](k,a):k-s,M=Af(p)?TE[p](E,a):E-s;S.insert("polygon").attr("points",Lge[p](a)).attr("transform",`translate(${C},${M})`).attr("class","arrow")}if(y){let C=Nge(u,p)?"XY":zs(u)?"X":"Y",M=0;C==="X"?M=Math.abs(x-k):C==="Y"?M=Math.abs(b-E)/1.5:M=Math.abs(x-k)/2;let R=S.append("g");if(await oa(R,y,{useHtmlLabels:!1,width:M,classes:"architecture-service-label"},pe()),R.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),C==="X")R.attr("transform","translate("+w+", "+_+")");else if(C==="Y")R.attr("transform","translate("+w+", "+_+") rotate(-90)");else if(C==="XY"){let T=UO(u,p);if(T&&FZe(T)){let I=R.node().getBoundingClientRect(),[A,D]=GZe(T);R.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*A*D*45})`);let N=R.node().getBoundingClientRect();R.attr("transform",` translate(${w}, ${_-I.height/2}) translate(${A*N.width/2}, ${D*N.height/2}) rotate(${-1*A*D*45}, 0, ${I.height/2}) `)}}}}}))},"drawEdges"),cQe=v(async function(t,e){let n=zi("padding")*.75,i=zi("fontSize"),s=zi("iconSize")/2;await Promise.all(e.nodes().map(async o=>{let l=d1(o);if(l.type==="group"){let{h:u,w:h,x1:f,y1:d}=o.boundingBox();t.append("rect").attr("x",f+s).attr("y",d+s).attr("width",h).attr("height",u).attr("class","node-bkg");let p=t.append("g"),g=f,m=d;if(l.icon){let y=p.append("g");y.html(`${await su(l.icon,{height:n,width:n,fallbackPrefix:eb.prefix})}`),y.attr("transform","translate("+(g+s+1)+", "+(m+s+1)+")"),g+=n,m+=i/2-1-2}if(l.label){let y=p.append("g");await oa(y,l.label,{useHtmlLabels:!1,width:h,classes:"architecture-service-label"},pe()),y.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),y.attr("transform","translate("+(g+s+4)+", "+(m+s+2)+")")}}}))},"drawGroups"),uQe=v(async function(t,e,r){for(let n of r){let i=e.append("g"),a=zi("iconSize");if(n.title){let u=i.append("g");await oa(u,n.title,{useHtmlLabels:!1,width:a*1.5,classes:"architecture-service-label"},pe()),u.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),u.attr("transform","translate("+a/2+", "+a+")")}let s=i.append("g");if(n.icon)s.html(`${await su(n.icon,{height:a,width:a,fallbackPrefix:eb.prefix})}`);else if(n.iconText){s.html(`${await su("blank",{height:a,width:a,fallbackPrefix:eb.prefix})}`);let f=s.append("g").append("foreignObject").attr("width",a).attr("height",a).append("div").attr("class","node-icon-text").attr("style",`height: ${a}px;`).append("div").html(n.iconText),d=parseInt(window.getComputedStyle(f.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;f.attr("style",`-webkit-line-clamp: ${Math.floor((a-2)/d)};`)}else s.append("path").attr("class","node-bkg").attr("id","node-"+n.id).attr("d",`M0 ${a} v${-a} q0,-5 5,-5 h${a} q5,0 5,5 v${a} H0 Z`);i.attr("class","architecture-service");let{width:o,height:l}=i._groups[0][0].getBBox();n.width=o,n.height=l,t.setElementForId(n.id,i)}return 0},"drawServices"),hQe=v(function(t,e,r){r.forEach(n=>{let i=e.append("g"),a=zi("iconSize");i.append("g").append("rect").attr("id","node-"+n.id).attr("fill-opacity","0").attr("width",a).attr("height",a),i.attr("class","architecture-junction");let{width:o,height:l}=i._groups[0][0].getBBox();i.width=o,i.height=l,t.setElementForId(n.id,i)})},"drawJunctions");l4([{name:eb.prefix,icons:eb}]);Jo.use(Dge.default);v(Oge,"addServices");v(Pge,"addJunctions");v(Bge,"positionNodes");v(Fge,"addGroups");v(zge,"addEdges");v($ge,"getAlignments");v(Gge,"getRelativeConstraints");v(Uge,"layoutArchitecture");fQe=v(async(t,e,r,n)=>{let i=n.db,a=i.getServices(),s=i.getJunctions(),o=i.getGroups(),l=i.getEdges(),u=i.getDataStructures(),h=La(e),f=h.append("g");f.attr("class","architecture-edges");let d=h.append("g");d.attr("class","architecture-services");let p=h.append("g");p.attr("class","architecture-groups"),await uQe(i,d,a),hQe(i,d,s);let g=await Uge(a,s,o,l,u);await lQe(f,g),await cQe(p,g),Bge(i,g),il(void 0,h,zi("padding"),zi("useMaxWidth"))},"draw"),dQe={draw:fQe},pQe={parser:aQe,db:EE,renderer:dQe,styles:oQe}});function oP(t){for(;t.firstChild;)t.removeChild(t.firstChild)}r4();Nu();_u();yl();sl();pc();bo();Ya();kn();o9();Iu();or();xA();lr();var yw="comm",xw="rule",bw="decl";var Pre="@import";var Bre="@keyframes";var Fre="@layer";var l9=Math.abs,py=String.fromCharCode;function ww(t){return t.trim()}function gy(t,e,r){return t.replace(e,r)}function zre(t,e,r){return t.indexOf(e,r)}function Md(t,e){return t.charCodeAt(e)|0}function Yh(t,e,r){return t.slice(e,r)}function Js(t){return t.length}function $re(t){return t.length}function Tg(t,e){return e.push(t),t}var kw=1,Eg=1,Gre=0,Oo=0,mi=0,Cg="";function Tw(t,e,r,n,i,a,s,o){return{value:t,root:e,parent:r,type:n,props:i,children:a,line:kw,column:Eg,length:s,return:"",siblings:o}}function Ure(){return mi}function Vre(){return mi=Oo>0?Md(Cg,--Oo):0,Eg--,mi===10&&(Eg=1,kw--),mi}function Po(){return mi=Oo2||Sg(mi)>3?"":" "}function Yre(t,e){for(;--e&&Po()&&!(mi<48||mi>102||mi>57&&mi<65||mi>70&&mi<97););return Ew(t,my()+(e<6&&Mu()==32&&Po()==32))}function c9(t){for(;Po();)switch(mi){case t:return Oo;case 34:case 39:t!==34&&t!==39&&c9(mi);break;case 40:t===41&&c9(t);break;case 92:Po();break}return Oo}function Xre(t,e){for(;Po()&&t+mi!==57;)if(t+mi===84&&Mu()===47)break;return"/*"+Ew(e,Oo-1)+"*"+py(t===47?t:Po())}function jre(t){for(;!Sg(Mu());)Po();return Ew(t,Oo)}function Qre(t){return Hre(Cw("",null,null,null,[""],t=Wre(t),0,[0],t))}function Cw(t,e,r,n,i,a,s,o,l){for(var u=0,h=0,f=s,d=0,p=0,g=0,m=1,y=1,x=1,b=0,w="",_=i,k=a,E=n,L=w;y;)switch(g=b,b=Po()){case 40:if(g!=108&&Md(L,f-1)==58){zre(L+=gy(Sw(b),"&","&\f"),"&\f",l9(u?o[u-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:L+=Sw(b);break;case 9:case 10:case 13:case 32:L+=qre(g);break;case 92:L+=Yre(my()-1,7);continue;case 47:switch(Mu()){case 42:case 47:Tg(A9e(Xre(Po(),my()),e,r,l),l),(Sg(g||1)==5||Sg(Mu()||1)==5)&&Js(L)&&Yh(L,-1,void 0)!==" "&&(L+=" ");break;default:L+="/"}break;case 123*m:o[u++]=Js(L)*x;case 125*m:case 59:case 0:switch(b){case 0:case 125:y=0;case 59+h:x==-1&&(L=gy(L,/\f/g,"")),p>0&&(Js(L)-f||m===0&&g===47)&&Tg(p>32?Zre(L+";",n,r,f-1,l):Zre(gy(L," ","")+";",n,r,f-2,l),l);break;case 59:L+=";";default:if(Tg(E=Kre(L,e,r,u,h,i,o,w,_=[],k=[],f,a),a),b===123)if(h===0)Cw(L,e,E,E,_,a,f,o,k);else switch(d===99&&Md(L,3)===110?100:d){case 100:case 108:case 109:case 115:Cw(t,E,E,n&&Tg(Kre(t,E,E,0,0,i,o,w,i,_=[],f,k),k),i,k,f,o,n?_:k);break;default:Cw(L,E,E,E,[""],k,0,o,k)}}u=h=p=0,m=x=1,w=L="",f=s;break;case 58:f=1+Js(L),p=g;default:if(m<1){if(b==123)--m;else if(b==125&&m++==0&&Vre()==125)continue}switch(L+=py(b),b*m){case 38:x=h>0?1:(L+="\f",-1);break;case 44:o[u++]=(Js(L)-1)*x,x=1;break;case 64:Mu()===45&&(L+=Sw(Po())),d=Mu(),h=f=Js(w=L+=jre(my())),b++;break;case 45:g===45&&Js(L)==2&&(m=0)}}return a}function Kre(t,e,r,n,i,a,s,o,l,u,h,f){for(var d=i-1,p=i===0?a:[""],g=$re(p),m=0,y=0,x=0;m0?p[b]+" "+w:gy(w,/&\f/g,p[b])))&&(l[x++]=_);return Tw(t,e,r,i===0?xw:o,l,u,h,f)}function A9e(t,e,r,n){return Tw(t,e,r,yw,py(Ure()),Yh(t,2,-2),0,n)}function Zre(t,e,r,n,i){return Tw(t,e,r,bw,Yh(t,0,n),Yh(t,n+1,-1),n,i)}function Aw(t,e){for(var r="",n=0;n/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),mQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(gne(),pne));return{id:jge,diagram:t}},"loader"),vQe={id:jge,detector:gQe,loader:mQe},yQe=vQe,Kge="flowchart",xQe=v((t,e)=>e?.flowchart?.defaultRenderer==="dagre-wrapper"||e?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(t),"detector"),bQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Ww(),Vw));return{id:Kge,diagram:t}},"loader"),wQe={id:Kge,detector:xQe,loader:bQe},kQe=wQe,Zge="flowchart-v2",TQe=v((t,e)=>e?.flowchart?.defaultRenderer==="dagre-d3"?!1:(e?.flowchart?.defaultRenderer==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&e?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(t)),"detector"),EQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Ww(),Vw));return{id:Zge,diagram:t}},"loader"),SQe={id:Zge,detector:TQe,loader:EQe},CQe=SQe,Qge="er",AQe=v(t=>/^\s*erDiagram/.test(t),"detector"),_Qe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Hne(),Wne));return{id:Qge,diagram:t}},"loader"),LQe={id:Qge,detector:AQe,loader:_Qe},RQe=LQe,Jge="gitGraph",NQe=v(t=>/^\s*gitGraph/.test(t),"detector"),IQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Xle(),Yle));return{id:Jge,diagram:t}},"loader"),MQe={id:Jge,detector:NQe,loader:IQe},DQe=MQe,eme="gantt",OQe=v(t=>/^\s*gantt/.test(t),"detector"),PQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(pce(),dce));return{id:eme,diagram:t}},"loader"),BQe={id:eme,detector:OQe,loader:PQe},FQe=BQe,tme="info",zQe=v(t=>/^\s*info/.test(t),"detector"),$Qe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(mce(),gce));return{id:tme,diagram:t}},"loader"),GQe={id:tme,detector:zQe,loader:$Qe},rme="pie",UQe=v(t=>/^\s*pie/.test(t),"detector"),VQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(bce(),xce));return{id:rme,diagram:t}},"loader"),WQe={id:rme,detector:UQe,loader:VQe},nme="quadrantChart",HQe=v(t=>/^\s*quadrantChart/.test(t),"detector"),qQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Bce(),Pce));return{id:nme,diagram:t}},"loader"),YQe={id:nme,detector:HQe,loader:qQe},XQe=YQe,ime="xychart",jQe=v(t=>/^\s*xychart-beta/.test(t),"detector"),KQe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(iue(),nue));return{id:ime,diagram:t}},"loader"),ZQe={id:ime,detector:jQe,loader:KQe},QQe=ZQe,ame="requirement",JQe=v(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),eJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(hue(),uue));return{id:ame,diagram:t}},"loader"),tJe={id:ame,detector:JQe,loader:eJe},rJe=tJe,sme="sequence",nJe=v(t=>/^\s*sequenceDiagram/.test(t),"detector"),iJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Oue(),Due));return{id:sme,diagram:t}},"loader"),aJe={id:sme,detector:nJe,loader:iJe},sJe=aJe,ome="class",oJe=v((t,e)=>e?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t),"detector"),lJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(que(),Hue));return{id:ome,diagram:t}},"loader"),cJe={id:ome,detector:oJe,loader:lJe},uJe=cJe,lme="classDiagram",hJe=v((t,e)=>/^\s*classDiagram/.test(t)&&e?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t),"detector"),fJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Xue(),Yue));return{id:lme,diagram:t}},"loader"),dJe={id:lme,detector:hJe,loader:fJe},pJe=dJe,cme="state",gJe=v((t,e)=>e?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t),"detector"),mJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Mhe(),Ihe));return{id:cme,diagram:t}},"loader"),vJe={id:cme,detector:gJe,loader:mJe},yJe=vJe,ume="stateDiagram",xJe=v((t,e)=>!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&e?.state?.defaultRenderer==="dagre-wrapper"),"detector"),bJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Ohe(),Dhe));return{id:ume,diagram:t}},"loader"),wJe={id:ume,detector:xJe,loader:bJe},kJe=wJe,hme="journey",TJe=v(t=>/^\s*journey/.test(t),"detector"),EJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(qhe(),Hhe));return{id:hme,diagram:t}},"loader"),SJe={id:hme,detector:TJe,loader:EJe},CJe=SJe,AJe=v((t,e,r)=>{re.debug(`rendering svg for syntax error `);let n=La(e),i=n.append("g");n.attr("viewBox","0 0 2412 512"),Hr(n,100,512,!0),i.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),i.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),i.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),i.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),i.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),i.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),i.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),i.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),fme={draw:AJe},_Je=fme,LJe={db:{},renderer:fme,parser:{parse:v(()=>{},"parse")}},RJe=LJe,dme="flowchart-elk",NJe=v((t,e={})=>/^\s*flowchart-elk/.test(t)||/^\s*flowchart|graph/.test(t)&&e?.flowchart?.defaultRenderer==="elk"?(e.layout="elk",!0):!1,"detector"),IJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Ww(),Vw));return{id:dme,diagram:t}},"loader"),MJe={id:dme,detector:NJe,loader:IJe},DJe=MJe,pme="timeline",OJe=v(t=>/^\s*timeline/.test(t),"detector"),PJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(cfe(),lfe));return{id:pme,diagram:t}},"loader"),BJe={id:pme,detector:OJe,loader:PJe},FJe=BJe,gme="mindmap",zJe=v(t=>/^\s*mindmap/.test(t),"detector"),$Je=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(ype(),vpe));return{id:gme,diagram:t}},"loader"),GJe={id:gme,detector:zJe,loader:$Je},UJe=GJe,mme="kanban",VJe=v(t=>/^\s*kanban/.test(t),"detector"),WJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(wpe(),bpe));return{id:mme,diagram:t}},"loader"),HJe={id:mme,detector:VJe,loader:WJe},qJe=HJe,vme="sankey",YJe=v(t=>/^\s*sankey-beta/.test(t),"detector"),XJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(qpe(),Hpe));return{id:vme,diagram:t}},"loader"),jJe={id:vme,detector:YJe,loader:XJe},KJe=jJe,yme="packet",ZJe=v(t=>/^\s*packet-beta/.test(t),"detector"),QJe=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(jpe(),Xpe));return{id:yme,diagram:t}},"loader"),JJe={id:yme,detector:ZJe,loader:QJe},xme="block",eet=v(t=>/^\s*block-beta/.test(t),"detector"),tet=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Cge(),Sge));return{id:xme,diagram:t}},"loader"),ret={id:xme,detector:eet,loader:tet},net=ret,bme="architecture",iet=v(t=>/^\s*architecture/.test(t),"detector"),aet=v(async()=>{let{diagram:t}=await Promise.resolve().then(()=>(Wge(),Vge));return{id:bme,diagram:t}},"loader"),set={id:bme,detector:iet,loader:aet},oet=set,Hge=!1,CE=v(()=>{Hge||(Hge=!0,G1("error",RJe,t=>t.toLowerCase().trim()==="error"),G1("---",{db:{clear:v(()=>{},"clear")},styles:{},renderer:{draw:v(()=>{},"draw")},parser:{parse:v(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:v(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),PS(yQe,qJe,pJe,uJe,RQe,FQe,GQe,WQe,rJe,sJe,DJe,CQe,kQe,UJe,FJe,DQe,kJe,yJe,CJe,XQe,KJe,JJe,QQe,net,oet))},"addDiagrams"),cet=v(async()=>{re.debug("Loading registered diagrams");let e=(await Promise.allSettled(Object.entries(Bf).map(async([r,{detector:n,loader:i}])=>{if(i)try{Wb(r)}catch{try{let{diagram:a,id:s}=await i();G1(s,a,n)}catch(a){throw re.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Bf[r],a}}}))).filter(r=>r.status==="rejected");if(e.length>0){re.error(`Failed to load ${e.length} external diagrams`);for(let r of e)re.error(r);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams"),uet="graphics-document document";function kme(t,e){t.attr("role",uet),e!==""&&t.attr("aria-roledescription",e)}v(kme,"setA11yDiagramInfo");function Tme(t,e,r,n){if(t.insert!==void 0){if(r){let i=`chart-desc-${n}`;t.attr("aria-describedby",i),t.insert("desc",":first-child").attr("id",i).text(r)}if(e){let i=`chart-title-${n}`;t.attr("aria-labelledby",i),t.insert("title",":first-child").attr("id",i).text(e)}}}v(Tme,"addSVGa11yTitleDescription");var WO=class Eme{constructor(e,r,n,i,a){this.type=e,this.text=r,this.db=n,this.parser=i,this.renderer=a}static{v(this,"Diagram")}static async fromText(e,r={}){let n=Or(),i=F1(e,n);e=jX(e)+` `;try{Wb(i)}catch{let u=yF(i);if(!u)throw new OS(`Diagram ${i} not found.`);let{id:h,diagram:f}=await u();G1(h,f)}let{db:a,parser:s,renderer:o,init:l}=Wb(i);return s.parser&&(s.parser.yy=a),a.clear?.(),l?.(n),r.title&&a.setDiagramTitle?.(r.title),await s.parse(e),new Eme(i,e,a,s,o)}async render(e,r){await this.renderer.draw(this.text,e,r,this)}getParser(){return this.parser}getType(){return this.type}},qge=[],het=v(()=>{qge.forEach(t=>{t()}),qge=[]},"attachFunctions"),fet=v(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Sme(t){let e=t.match(DS);if(!e)return{text:t,metadata:{}};let r=sp(e[1],{schema:ap})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};let n={};return r.displayMode&&(n.displayMode=r.displayMode.toString()),r.title&&(n.title=r.title.toString()),r.config&&(n.config=r.config),{text:t.slice(e[0].length),metadata:n}}v(Sme,"extractFrontMatter");var det=v(t=>t.replace(/\r\n?/g,` `).replace(/<(\w+)([^>]*)>/g,(e,r,n)=>"<"+r+n.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),pet=v(t=>{let{text:e,metadata:r}=Sme(t),{displayMode:n,title:i,config:a={}}=r;return n&&(a.gantt||(a.gantt={}),a.gantt.displayMode=n),{title:i,config:a,text:e}},"processFrontmatter"),get=v(t=>{let e=Ut.detectInit(t)??{},r=Ut.detectDirective(t,"wrap");return Array.isArray(r)?e.wrap=r.some(({type:n})=>n==="wrap"):r?.type==="wrap"&&(e.wrap=!0),{text:VX(t),directive:e}},"processDirectives");function qO(t){let e=det(t),r=pet(e),n=get(r.text),i=ws(r.config,n.directive);return t=fet(n.text),{code:t,title:r.title,config:i}}v(qO,"preprocessDiagram");function Cme(t){let e=new TextEncoder().encode(t),r=Array.from(e,n=>String.fromCodePoint(n)).join("");return btoa(r)}v(Cme,"toBase64");var met=5e4,vet="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",yet="sandbox",xet="loose",bet="http://www.w3.org/2000/svg",wet="http://www.w3.org/1999/xlink",ket="http://www.w3.org/1999/xhtml",Tet="100%",Eet="100%",Cet="border:0;margin:0;",Aet="margin:0",_et="allow-top-navigation-by-user-activation allow-popups",Let='The "iframe" tag is not supported by your browser.',Ret=["foreignobject"],Net=["dominant-baseline"];function YO(t){let e=qO(t);return $1(),CF(e.config??{}),e}v(YO,"processAndSetConfigs");async function Ame(t,e){CE();try{let{code:r,config:n}=YO(t);return{diagramType:(await Lme(r)).type,config:n}}catch(r){if(e?.suppressErrors)return!1;throw r}}v(Ame,"parse");var Yge=v((t,e,r=[])=>` .${t} ${e} { ${r.join(" !important; ")} !important; }`,"cssImportantStyles"),Iet=v((t,e=new Map)=>{let r="";if(t.themeCSS!==void 0&&(r+=` ${t.themeCSS}`),t.fontFamily!==void 0&&(r+=` :root { --mermaid-font-family: ${t.fontFamily}}`),t.altFontFamily!==void 0&&(r+=` :root { --mermaid-alt-font-family: ${t.altFontFamily}}`),e instanceof Map){let s=t.htmlLabels??t.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(o=>{ir(o.styles)||s.forEach(l=>{r+=Yge(o.id,l,o.styles)}),ir(o.textStyles)||(r+=Yge(o.id,"tspan",(o?.textStyles||[]).map(l=>l.replace("color","fill"))))})}return r},"createCssStyles"),Met=v((t,e,r,n)=>{let i=Iet(t,r),a=NF(e,i,t.themeVariables);return Aw(Qre(`${n}{${a}}`),Jre)},"createUserStyles"),Det=v((t="",e,r)=>{let n=t;return!r&&!e&&(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=Xs(n),n=n.replace(/
    /g,"
    "),n},"cleanUpSvgCode"),Oet=v((t="",e)=>{let r=e?.viewBox?.baseVal?.height?e.viewBox.baseVal.height+"px":Eet,n=Cme(`${t}`);return``},"putIntoIFrame"),Xge=v((t,e,r,n,i)=>{let a=t.append("div");a.attr("id",r),n&&a.attr("style",n);let s=a.append("svg").attr("id",e).attr("width","100%").attr("xmlns",bet);return i&&s.attr("xmlns:xlink",i),s.append("g"),t},"appendDivSvgG");function HO(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}v(HO,"sandboxedIframe");var Pet=v((t,e,r,n)=>{t.getElementById(e)?.remove(),t.getElementById(r)?.remove(),t.getElementById(n)?.remove()},"removeExistingElements"),Bet=v(async function(t,e,r){CE();let n=YO(e);e=n.code;let i=Or();re.debug(i),e.length>(i?.maxTextSize??met)&&(e=vet);let a="#"+t,s="i"+t,o="#"+s,l="d"+t,u="#"+l,h=v(()=>{let I=Ve(d?o:u).node();I&&"remove"in I&&I.remove()},"removeTempElements"),f=Ve("body"),d=i.securityLevel===yet,p=i.securityLevel===xet,g=i.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),d){let T=HO(Ve(r),s);f=Ve(T.nodes()[0].contentDocument.body),f.node().style.margin=0}else f=Ve(r);Xge(f,t,l,`font-family: ${g}`,wet)}else{if(Pet(document,t,l,s),d){let T=HO(Ve("body"),s);f=Ve(T.nodes()[0].contentDocument.body),f.node().style.margin=0}else f=Ve("body");Xge(f,t,l)}let m,y;try{m=await WO.fromText(e,{title:n.title})}catch(T){if(i.suppressErrorRendering)throw h(),T;m=await WO.fromText("error"),y=T}let x=f.select(u).node(),b=m.type,w=x.firstChild,_=w.firstChild,k=m.renderer.getClasses?.(e,m),E=Met(i,b,k,a),L=document.createElement("style");L.innerHTML=E,w.insertBefore(L,_);try{await m.renderer.draw(e,t,dy,m)}catch(T){throw i.suppressErrorRendering?h():_Je.draw(e,t,dy),T}let S=f.select(`${u} svg`),C=m.db.getAccTitle?.(),M=m.db.getAccDescription?.();Rme(b,S,C,M),f.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",ket);let R=f.select(u).node().innerHTML;if(re.debug("config.arrowMarkerAbsolute",i.arrowMarkerAbsolute),R=Det(R,d,Wr(i.arrowMarkerAbsolute)),d){let T=f.select(u+" svg").node();R=Oet(R,T)}else p||(R=wme.default.sanitize(R,{ADD_TAGS:Ret,ADD_ATTR:Net}));if(het(),y)throw y;return h(),{diagramType:b,svg:R,bindFunctions:m.db.bindFunctions}},"render");function _me(t={}){let e=Hn({},t);e?.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),TF(e),e?.theme&&e.theme in ec?e.themeVariables=ec[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=ec.default.getThemeVariables(e.themeVariables));let r=typeof e=="object"?kF(e):BS();Fb(r.logLevel),CE()}v(_me,"initialize");var Lme=v((t,e={})=>{let{code:r}=qO(t);return WO.fromText(r,e)},"getDiagramFromText");function Rme(t,e,r,n){kme(e,t),Tme(e,r,n,e.attr("id"))}v(Rme,"addA11yInfo");var U0=Object.freeze({render:Bet,parse:Ame,getDiagramFromText:Lme,initialize:_me,getConfig:Or,setConfig:FS,getSiteConfig:BS,updateSiteConfig:EF,reset:v(()=>{$1()},"reset"),globalReset:v(()=>{$1(Ff)},"globalReset"),defaultConfig:Ff});Fb(Or().logLevel);$1(Or());var Fet=v((t,e,r)=>{re.warn(t),U3(t)?(r&&r(t.str,t.hash),e.push({...t,message:t.str,error:t})):(r&&r(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),Nme=v(async function(t={querySelector:".mermaid"}){try{await zet(t)}catch(e){if(U3(e)&&re.error(e.str),nh.parseError&&nh.parseError(e),!t.suppressErrors)throw re.error("Use the suppressErrors option to suppress these errors"),e}},"run"),zet=v(async function({postRenderCallback:t,querySelector:e,nodes:r}={querySelector:".mermaid"}){let n=U0.getConfig();re.debug(`${t?"":"No "}Callback function found`);let i;if(r)i=r;else if(e)i=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");re.debug(`Found ${i.length} diagrams`),n?.startOnLoad!==void 0&&(re.debug("Start On Load: "+n?.startOnLoad),U0.updateSiteConfig({startOnLoad:n?.startOnLoad}));let a=new Ut.InitIDGenerator(n.deterministicIds,n.deterministicIDSeed),s,o=[];for(let l of Array.from(i)){if(re.info("Rendering diagram: "+l.id),l.getAttribute("data-processed"))continue;l.setAttribute("data-processed","true");let u=`mermaid-${a.next()}`;s=l.innerHTML,s=Y3(Ut.entityDecode(s)).trim().replace(//gi,"
    ");let h=Ut.detectInit(s);h&&re.debug("Detected early reinit: ",h);try{let{svg:f,bindFunctions:d}=await Ome(u,s,l);l.innerHTML=f,t&&await t(u),d&&d(l)}catch(f){Fet(f,o,nh.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),Ime=v(function(t){U0.initialize(t)},"initialize"),$et=v(async function(t,e,r){re.warn("mermaid.init is deprecated. Please use run instead."),t&&Ime(t);let n={postRenderCallback:r,querySelector:".mermaid"};typeof e=="string"?n.querySelector=e:e&&(e instanceof HTMLElement?n.nodes=[e]:n.nodes=e),await Nme(n)},"init"),Get=v(async(t,{lazyLoad:e=!0}={})=>{CE(),PS(...t),e===!1&&await cet()},"registerExternalDiagrams"),Mme=v(function(){if(nh.startOnLoad){let{startOnLoad:t}=U0.getConfig();t&&nh.run().catch(e=>re.error("Mermaid failed to initialize",e))}},"contentLoaded");typeof document<"u"&&window.addEventListener("load",Mme,!1);var Uet=v(function(t){nh.parseError=t},"setParseErrorHandler"),SE=[],VO=!1,Dme=v(async()=>{if(!VO){for(VO=!0;SE.length>0;){let t=SE.shift();if(t)try{await t()}catch(e){re.error("Error executing queue",e)}}VO=!1}},"executeQueue"),Vet=v(async(t,e)=>new Promise((r,n)=>{let i=v(()=>new Promise((a,s)=>{U0.parse(t,e).then(o=>{a(o),r(o)},o=>{re.error("Error parsing",o),nh.parseError?.(o),s(o),n(o)})}),"performCall");SE.push(i),Dme().catch(n)}),"parse"),Ome=v((t,e,r)=>new Promise((n,i)=>{let a=v(()=>new Promise((s,o)=>{U0.render(t,e,r).then(l=>{s(l),n(l)},l=>{re.error("Error parsing",l),nh.parseError?.(l),o(l),i(l)})}),"performCall");SE.push(a),Dme().catch(i)}),"render"),nh={startOnLoad:!0,mermaidAPI:U0,parse:Vet,render:Ome,init:$et,run:Nme,registerExternalDiagrams:Get,registerLayoutLoaders:s9,initialize:Ime,parseError:void 0,contentLoaded:Mme,setParseErrorHandler:Uet,detectType:F1,registerIconPacks:l4},XO=nh;var jO=class{constructor(e,r){this.container=e;this.content=r;this.setupEventListeners(),this.setupNavigationControls()}isDragging=!1;startPan={x:0,y:0};currentPan={x:0,y:0};scale=1;MIN_SCALE=.5;MAX_SCALE=3;ZOOM_SENSITIVITY=.001;setupEventListeners(){this.container.addEventListener("mousedown",this.onMouseDown.bind(this)),document.addEventListener("mousemove",this.onMouseMove.bind(this)),document.addEventListener("mouseup",this.onMouseUp.bind(this)),this.container.addEventListener("wheel",this.onWheel.bind(this),{passive:!1}),window.addEventListener("resize",this.resetTransform.bind(this))}setupNavigationControls(){let e=document.createElement("div");e.className="mermaid-controls";let r=this.createButton("+",()=>this.zoom(.1)),n=this.createButton("-",()=>this.zoom(-.1)),i=this.createButton("Reset",()=>this.resetTransform());e.appendChild(n),e.appendChild(i),e.appendChild(r),this.container.appendChild(e)}createButton(e,r){let n=document.createElement("button");return n.textContent=e,n.className="mermaid-control-button",n.addEventListener("click",r),window.addCleanup(()=>n.removeEventListener("click",r)),n}onMouseDown(e){e.button===0&&(this.isDragging=!0,this.startPan={x:e.clientX-this.currentPan.x,y:e.clientY-this.currentPan.y},this.container.style.cursor="grabbing")}onMouseMove(e){this.isDragging&&(e.preventDefault(),this.currentPan={x:e.clientX-this.startPan.x,y:e.clientY-this.startPan.y},this.updateTransform())}onMouseUp(){this.isDragging=!1,this.container.style.cursor="grab"}onWheel(e){e.preventDefault();let r=-e.deltaY*this.ZOOM_SENSITIVITY,n=Math.min(Math.max(this.scale+r,this.MIN_SCALE),this.MAX_SCALE),i=this.content.getBoundingClientRect(),a=e.clientX-i.left,s=e.clientY-i.top,o=n-this.scale;this.currentPan.x-=a*o,this.currentPan.y-=s*o,this.scale=n,this.updateTransform()}zoom(e){let r=Math.min(Math.max(this.scale+e,this.MIN_SCALE),this.MAX_SCALE),n=this.content.getBoundingClientRect(),i=n.width/2,a=n.height/2,s=r-this.scale;this.currentPan.x-=i*s,this.currentPan.y-=a*s,this.scale=r,this.updateTransform()}updateTransform(){this.content.style.transform=`translate(${this.currentPan.x}px, ${this.currentPan.y}px) scale(${this.scale})`}resetTransform(){this.scale=1,this.currentPan={x:0,y:0},this.updateTransform()}},Wet=["--secondary","--tertiary","--gray","--light","--lightgray","--highlight","--dark","--darkgray","--codeFont"];document.addEventListener("nav",async()=>{let e=document.querySelector(".center").querySelectorAll("code.mermaid");if(e.length===0)return;let r=Wet.reduce((i,a)=>(i[a]=getComputedStyle(document.documentElement).getPropertyValue(a),i),{}),n=document.documentElement.getAttribute("saved-theme")==="dark";XO.initialize({startOnLoad:!1,securityLevel:"loose",theme:n?"dark":"base",themeVariables:{fontFamily:r["--codeFont"],primaryColor:r["--light"],primaryTextColor:r["--darkgray"],primaryBorderColor:r["--tertiary"],lineColor:r["--darkgray"],secondaryColor:r["--secondary"],tertiaryColor:r["--tertiary"],clusterBkg:r["--light"],edgeLabelBackground:r["--highlight"]}}),await XO.run({nodes:e});for(let i=0;i{y.removeEventListener("click",g),l.removeEventListener("click",p),document.removeEventListener("keydown",m)})}}); /*! Bundled license information: dompurify/dist/purify.js: (*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE *) mermaid/dist/chunks/mermaid.core/chunk-RDESMYQM.mjs: (*! Bundled license information: js-yaml/dist/js-yaml.mjs: (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *) *) lodash-es/lodash.js: (** * @license * Lodash (Custom Build) * Build: `lodash modularize exports="es" -o ./` * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) cytoscape/dist/cytoscape.esm.mjs: (*! Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) Licensed under The MIT License (http://opensource.org/licenses/MIT) *) (*! Event object based on jQuery events, MIT license https://jquery.org/license/ https://tldrlegal.com/license/mit-license https://github.com/jquery/jquery/blob/master/src/event.js *) (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *) (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *) mermaid/dist/mermaid.core.mjs: (*! Check if previously processed *) (*! * Wait for document loaded before starting the execution *) */