type) throws Exception {
- requireMapper();
- try {
- return mapper.readValue(req.body().bytes(), type);
- } catch (JsonProcessingException e) {
- throw HttpException.badRequest("Invalid request body: " + e.getOriginalMessage());
- }
- }
-
- /**
- * Serializes {@code obj} to JSON, sets {@code Content-Type: application/json},
- * and returns the JSON string as the response body.
- */
- protected String json(Response res, Object obj) throws Exception {
- requireMapper();
- res.setContentType(ContentType.JSON);
- return mapper.writeValueAsString(obj);
- }
-
- /**
- * Like {@link #json} but serializes only fields visible under the given
- * {@code view} class (see Jackson {@code @JsonView}).
- */
- protected String jsonView(Response res, Object obj, Class> view) throws Exception {
- requireMapper();
- res.setContentType(ContentType.JSON);
- return mapper.writerWithView(view).writeValueAsString(obj);
- }
-
- private static void requireMapper() {
- if (mapper == null)
- throw new IllegalStateException(
- "JacksonExtension not installed: call FlashApp.install(new JacksonExtension()) first");
- }
-}
diff --git a/flash-extensions/flash-ext-jackson/src/main/java/dev/relism/ext/jackson/Json.java b/flash-extensions/flash-ext-jackson/src/main/java/dev/relism/ext/jackson/Json.java
new file mode 100644
index 0000000..a8760f6
--- /dev/null
+++ b/flash-extensions/flash-ext-jackson/src/main/java/dev/relism/ext/jackson/Json.java
@@ -0,0 +1,126 @@
+package dev.relism.ext.jackson;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import dev.relism.exceptions.HttpException;
+import dev.relism.http.ContentType;
+import dev.relism.models.Request;
+import dev.relism.models.Response;
+
+/**
+ * Thread-safe JSON toolbox. Single point of access for all JSON I/O operations
+ * within a Flash application.
+ *
+ * Retrieve once at boot time via {@code require(Json.class)} inside
+ * {@code onInit()}, cache in a private field, and call on the hot path
+ * with zero lookup or allocation overhead:
+ *
+ *
{@code
+ * @Route(method = HttpMethod.POST, path = "/api/items")
+ * public class CreateItemHandler extends RequestHandler {
+ *
+ * private Json json;
+ *
+ * @Override
+ * protected void onInit() {
+ * json = require(Json.class);
+ * }
+ *
+ * public Object handle(Request req, Response res) throws Exception {
+ * CreateItemRequest body = json.body(req, CreateItemRequest.class);
+ * return json.write(res, itemService.create(body));
+ * }
+ * }
+ * }
+ *
+ * The underlying {@link ObjectMapper} is shared across all handlers in the same
+ * scope (one instance per app / per child scope). Jackson's {@code ObjectMapper}
+ * is fully thread-safe after configuration — no synchronization is needed.
+ *
+ *
Install via {@link JacksonExtension} before calling {@code scan()} or
+ * {@code register()}.
+ */
+public final class Json {
+
+ private final ObjectMapper mapper;
+
+ /** Package-private — constructed exclusively by {@link JacksonExtension}. */
+ Json(ObjectMapper mapper) {
+ this.mapper = mapper;
+ }
+
+ // ── Input ─────────────────────────────────────────────────────────────────
+
+ /**
+ * Deserializes the full request body into an instance of {@code type}.
+ *
+ *
Reads {@code req.body().bytes()} in one shot. For streaming bodies
+ * use {@link #bodyFrom(Request, Class)} instead.
+ *
+ * @throws HttpException 400 if the body cannot be parsed as {@code type}
+ */
+ public T body(Request req, Class type) throws Exception {
+ try {
+ return mapper.readValue(req.body().bytes(), type);
+ } catch (JsonProcessingException e) {
+ throw HttpException.badRequest("Invalid request body: " + e.getOriginalMessage());
+ }
+ }
+
+ /**
+ * Deserializes the request body via the raw {@link java.io.InputStream},
+ * avoiding the intermediate {@code byte[]} allocation. Prefer this for
+ * large bodies or when allocation budget is tight.
+ *
+ * @throws HttpException 400 on parse failure
+ */
+ public T bodyFrom(Request req, Class type) throws Exception {
+ try {
+ return mapper.readValue(req.body().stream(), type);
+ } catch (JsonProcessingException e) {
+ throw HttpException.badRequest("Invalid request body: " + e.getOriginalMessage());
+ }
+ }
+
+ // ── Output ────────────────────────────────────────────────────────────────
+
+ /**
+ * Serializes {@code obj} to a JSON string and sets
+ * {@code Content-Type: application/json} on the response.
+ *
+ * The returned string is used as the response body by the Flash runtime.
+ */
+ public String write(Response res, Object obj) throws Exception {
+ res.setContentType(ContentType.JSON);
+ return mapper.writeValueAsString(obj);
+ }
+
+ /**
+ * Like {@link #write(Response, Object)} but also sets an explicit HTTP status code.
+ */
+ public String write(Response res, int status, Object obj) throws Exception {
+ res.status(status);
+ res.setContentType(ContentType.JSON);
+ return mapper.writeValueAsString(obj);
+ }
+
+ /**
+ * Like {@link #write} but applies a Jackson {@code @JsonView} filter,
+ * restricting serialization to fields visible under {@code view}.
+ */
+ public String writeView(Response res, Object obj, Class> view) throws Exception {
+ res.setContentType(ContentType.JSON);
+ return mapper.writerWithView(view).writeValueAsString(obj);
+ }
+
+ // ── Escape hatch ──────────────────────────────────────────────────────────
+
+ /**
+ * Returns the underlying {@link ObjectMapper} for advanced operations
+ * (custom serialization, schema generation, etc.) not covered by the
+ * methods above.
+ */
+ public ObjectMapper mapper() {
+ return mapper;
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/docs/README.md b/flash-extensions/flash-ext-limiter/docs/README.md
new file mode 100644
index 0000000..098b0d8
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/README.md
@@ -0,0 +1,65 @@
+# flash-ext-limiter
+
+Rate limiting for the Flash HTTP server. Zero-allocation hot-path, lock-free counters,
+pluggable key resolvers, and two built-in algorithms.
+
+## What it provides
+
+| Component | Description |
+|---|---|
+| `@Limit` | Annotation for class-based handlers — processed once at boot |
+| `Guard` | Programmatic middleware factory for lambda routes |
+| `LimiterConfig` | Resolver registry — map string names to key-extraction lambdas |
+| `FIXED_WINDOW` | Clock-aligned counter reset; minimal memory |
+| `TOKEN_BUCKET` | Continuous refill; absorbs bursts smoothly |
+
+## Dependency
+
+```xml
+
+ dev.relism
+ flash-ext-limiter
+ 1.0-SNAPSHOT
+
+```
+
+## Quick start
+
+```java
+// Default install — only the built-in "ip" resolver available
+FlashApp.create(8080)
+ .install(new LimiterExtension())
+ .scan("com.example.handlers");
+```
+
+```java
+// With custom resolvers
+LimiterConfig conf = new LimiterConfig()
+ .registerResolver("auth_user", req ->
+ ClaimsHolder.exists() ? ClaimsHolder.user().sub() : "anonymous");
+
+FlashApp.create(8080)
+ .install(new LimiterExtension(conf))
+ .scan("com.example.handlers");
+```
+
+## Installation order
+
+Install `LimiterExtension` **before** authentication extensions. Rate-limit checks
+then short-circuit over-limit requests before expensive token validation runs.
+
+```java
+app.install(new LimiterExtension(conf)) // ← first
+ .install(new OidcExtension(oidcConf)) // ← second
+ .scan("com.example");
+```
+
+## Docs
+
+| File | Contents |
+|---|---|
+| [key-resolvers.md](key-resolvers.md) | Resolver registration, built-in defaults, custom logic |
+| [annotation.md](annotation.md) | `@Limit` reference — all fields and examples |
+| [guard.md](guard.md) | `Guard` for lambda routes — all overloads |
+| [strategies.md](strategies.md) | `FIXED_WINDOW` vs `TOKEN_BUCKET` — algorithm reference |
+| [http-headers.md](http-headers.md) | HTTP compliance — headers and 429 response |
diff --git a/flash-extensions/flash-ext-limiter/docs/annotation.md b/flash-extensions/flash-ext-limiter/docs/annotation.md
new file mode 100644
index 0000000..8523a7a
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/annotation.md
@@ -0,0 +1,132 @@
+# @Limit annotation
+
+Applies a rate limit to a **class-based** `RequestHandler`. The annotation is read once
+per handler class at boot by the `LimiterExtension` annotation processor — zero overhead
+at request time.
+
+## Declaration
+
+```java
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Limit {
+ String key() default "ip";
+ int requests();
+ long window();
+ TimeUnit windowUnit() default TimeUnit.SECONDS;
+ LimitStrategy strategy() default LimitStrategy.FIXED_WINDOW;
+}
+```
+
+## Fields
+
+| Field | Type | Default | Description |
+|---|---|---|---|
+| `key` | `String` | `"ip"` | Name of the key resolver registered in `LimiterConfig` |
+| `requests` | `int` | — | Maximum requests allowed per window (required) |
+| `window` | `long` | — | Window duration in `windowUnit` units (required) |
+| `windowUnit` | `TimeUnit` | `SECONDS` | Time unit for `window` |
+| `strategy` | `LimitStrategy` | `FIXED_WINDOW` | Rate-limit algorithm |
+
+## Basic usage
+
+### 100 requests per second per IP (default)
+
+```java
+@Route(method = HttpMethod.GET, path = "/api/search")
+@Limit(requests = 100, window = 1)
+public class SearchHandler extends RequestHandler {
+ public Object handle(Request req, Response res) {
+ return searchService.query(req.query("q"));
+ }
+}
+```
+
+### 20 requests per minute per authenticated user
+
+```java
+@Route(method = HttpMethod.POST, path = "/api/report")
+@Limit(key = "auth_user", requests = 20, window = 1, windowUnit = TimeUnit.MINUTES)
+@Authenticated
+public class ReportHandler extends RequestHandler {
+ public Object handle(Request req, Response res) { ... }
+}
+```
+
+Order of annotation processors: register `LimiterExtension` before `OidcExtension`
+so the rate-limit middleware wraps the outer layer of the chain and fires before auth.
+
+### Token bucket — absorb bursts
+
+```java
+@Route(method = HttpMethod.POST, path = "/api/upload")
+@Limit(
+ key = "api_key",
+ requests = 50,
+ window = 1,
+ windowUnit = TimeUnit.MINUTES,
+ strategy = LimitStrategy.TOKEN_BUCKET
+)
+public class UploadHandler extends RequestHandler { ... }
+```
+
+### Large window — 1000 requests per hour
+
+```java
+@Route(method = HttpMethod.GET, path = "/api/export")
+@Limit(requests = 1000, window = 1, windowUnit = TimeUnit.HOURS)
+public class ExportHandler extends RequestHandler { ... }
+```
+
+### Strict per-second limit on a public endpoint
+
+```java
+@Route(method = HttpMethod.GET, path = "/api/prices")
+@Limit(requests = 10, window = 1, windowUnit = TimeUnit.SECONDS)
+public class PriceHandler extends RequestHandler { ... }
+```
+
+## Combining @Limit with other annotations
+
+`@Limit` composes naturally with `@Authenticated`, `@RolesAllowed`, and `@ApiOperation`.
+Each annotation is processed by its own processor; Flash collects all middleware and
+composes them in processor registration order.
+
+```java
+@Route(method = HttpMethod.DELETE, path = "/admin/users/{id}")
+@Limit(key = "auth_user", requests = 5, window = 1, windowUnit = TimeUnit.MINUTES)
+@RolesAllowed("admin")
+@ApiOperation(summary = "Delete a user", tags = "admin")
+public class DeleteUserHandler extends RequestHandler { ... }
+```
+
+Execution chain (outermost → handler):
+`LimiterMiddleware → OidcRolesMiddleware → DeleteUserHandler`
+
+## Fail-fast at boot
+
+If `key` names a resolver not registered in `LimiterConfig`, the server refuses to start:
+
+```
+dev.relism.exceptions.InitializationException:
+ Rate-limit resolver "auth_user" is not registered.
+ Call LimiterConfig.registerResolver("auth_user", req -> ...) before install.
+```
+
+There is no silent fallback — a misconfigured rate limit is treated as a hard error.
+
+## What happens on violation
+
+```
+HTTP/1.1 429 Too Many Requests
+X-RateLimit-Limit: 100
+X-RateLimit-Remaining: 0
+X-RateLimit-Reset: 1711750860
+Retry-After: 1
+Content-Type: text/plain
+
+Too Many Requests
+```
+
+The handler body is never invoked. See [http-headers.md](http-headers.md) for the full
+header reference.
diff --git a/flash-extensions/flash-ext-limiter/docs/guard.md b/flash-extensions/flash-ext-limiter/docs/guard.md
new file mode 100644
index 0000000..62edb8f
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/guard.md
@@ -0,0 +1,144 @@
+# Guard — programmatic rate limiting for lambda routes
+
+`Guard` is the rate-limit API for lambda (inline) route registrations. It produces
+a `Middleware` that is composed once at route-wiring time — the resolver lambda is
+captured directly into the closure, with no map lookup on the request hot-path.
+
+## Obtaining Guard
+
+`Guard` is provided in the `FlashContext` after `LimiterExtension` is installed:
+
+```java
+Guard guard = app.ctx().require(Guard.class);
+```
+
+Or inside another extension:
+
+```java
+public void install(FlashRegistrar app, FlashContext ctx) {
+ Guard guard = ctx.require(Guard.class);
+ // ...
+}
+```
+
+## API
+
+```java
+// Fixed window (default strategy)
+Middleware limit(String resolverKey, int requests, long window, TimeUnit unit)
+
+// Explicit strategy
+Middleware limit(String resolverKey, int requests, long window, TimeUnit unit, LimitStrategy strategy)
+```
+
+Both overloads:
+- Resolve the named key lambda **once** at call time (fail-fast if unknown).
+- Return a stateless `Middleware` whose closure captures the lambda and `LimitConfig` directly.
+- Share the `BucketStore` with all other rules registered through this `LimiterExtension` instance.
+
+## Examples
+
+### Simple per-IP limit on a lambda route
+
+```java
+Guard guard = app.ctx().require(Guard.class);
+
+app.get("/api/search", (req, res) -> searchService.query(req.query("q")))
+ .with(guard.limit("ip", 100, 1, TimeUnit.SECONDS));
+```
+
+### Per authenticated user — token bucket
+
+```java
+app.post("/api/export", (req, res) -> exportService.run(req))
+ .with(guard.limit("auth_user", 10, 1, TimeUnit.MINUTES, LimitStrategy.TOKEN_BUCKET));
+```
+
+### Chaining with other middleware
+
+`Guard.limit(...)` returns a plain `Middleware`, so it composes with `Middleware.of()`
+and `.andThen()` exactly like any other middleware:
+
+```java
+Middleware secured = Middleware.of(
+ guard.limit("ip", 200, 1, TimeUnit.SECONDS), // ← outermost: runs first
+ oidc.protect()
+);
+
+app.get("/dashboard", handler).with(secured);
+```
+
+Or with `.andThen()` for two middlewares:
+
+```java
+app.get("/dashboard", handler)
+ .with(guard.limit("ip", 200, 1, TimeUnit.SECONDS).andThen(oidc.protect()));
+```
+
+### Different limits on the same path by method
+
+```java
+// Read: 500/s; Write: 20/s
+app.get("/api/items", readHandler) .with(guard.limit("ip", 500, 1, TimeUnit.SECONDS));
+app.post("/api/items", writeHandler).with(guard.limit("ip", 20, 1, TimeUnit.SECONDS));
+```
+
+Each `.with(guard.limit(...))` call creates an independent bucket store key namespace —
+GET and POST requests to `/api/items` share the same IP bucket only if you share the same
+`Middleware` instance. Using two `guard.limit(...)` calls creates **two independent buckets**.
+
+### Reusing a middleware instance across routes
+
+To share a single bucket pool across multiple routes (treating them as one combined limit):
+
+```java
+Middleware sharedIpLimit = guard.limit("ip", 1000, 1, TimeUnit.MINUTES);
+
+app.get("/api/items", handler1).with(sharedIpLimit);
+app.get("/api/items/{id}", handler2).with(sharedIpLimit);
+app.post("/api/items", handler3).with(sharedIpLimit);
+```
+
+All three routes now draw from the same per-IP bucket — 1000 combined requests per minute.
+
+### Inside an extension
+
+```java
+public class MyApiExtension implements FlashExtension {
+ public void install(FlashRegistrar app, FlashContext ctx) {
+ Guard guard = ctx.require(Guard.class); // LimiterExtension must be installed first
+
+ Middleware ipLimit = guard.limit("ip", 60, 1, TimeUnit.SECONDS);
+
+ app.get("/api/status", statusHandler) .with(ipLimit);
+ app.get("/api/metrics", metricsHandler).with(ipLimit);
+ }
+}
+```
+
+### Large window
+
+```java
+app.get("/api/export", exportHandler)
+ .with(guard.limit("api_key", 50, 24, TimeUnit.HOURS));
+```
+
+## Fail-fast
+
+If the resolver name is not registered, `guard.limit(...)` throws immediately
+(at wiring time, not at request time):
+
+```
+InitializationException: Rate-limit resolver "auth_user" is not registered.
+```
+
+## Comparison: Guard vs @Limit
+
+| | `@Limit` | `Guard.limit(...)` |
+|---|---|---|
+| Route style | Class-based `RequestHandler` | Lambda `(req, res) -> ...` |
+| Configuration | Annotation fields | Method arguments |
+| Where resolved | `AnnotationProcessor` at `scan()` | `guard.limit(...)` call at wiring |
+| Hot-path overhead | Zero | Zero |
+| Fail-fast | Yes | Yes |
+| Composable with `Middleware.of()` | Via annotation processor order | Yes, directly |
diff --git a/flash-extensions/flash-ext-limiter/docs/http-headers.md b/flash-extensions/flash-ext-limiter/docs/http-headers.md
new file mode 100644
index 0000000..1d91443
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/http-headers.md
@@ -0,0 +1,122 @@
+# HTTP headers and 429 response
+
+The extension injects standard rate-limit headers on **every** request — both allowed
+and rejected. Clients can use these headers to implement back-off logic without waiting
+for a 429.
+
+## Response headers
+
+| Header | Type | Description |
+|---|---|---|
+| `X-RateLimit-Limit` | integer | Maximum requests allowed in the current window |
+| `X-RateLimit-Remaining` | integer | Requests remaining in the current window (≥ 0) |
+| `X-RateLimit-Reset` | Unix timestamp (s) | When the quota resets or the next token arrives |
+| `Retry-After` | seconds | **Only on 429** — how long to wait before retrying (≥ 1) |
+
+### Example — allowed request
+
+```
+HTTP/1.1 200 OK
+X-RateLimit-Limit: 100
+X-RateLimit-Remaining: 73
+X-RateLimit-Reset: 1711750860
+Content-Type: application/json
+```
+
+### Example — rejected request (429)
+
+```
+HTTP/1.1 429 Too Many Requests
+X-RateLimit-Limit: 100
+X-RateLimit-Remaining: 0
+X-RateLimit-Reset: 1711750860
+Retry-After: 1
+Content-Type: text/plain
+
+Too Many Requests
+```
+
+## Header semantics by strategy
+
+### FIXED_WINDOW
+
+| Header | Value |
+|---|---|
+| `X-RateLimit-Reset` | Unix timestamp of the **next window start** (aligned to clock) |
+| `Retry-After` | Seconds until `X-RateLimit-Reset` (minimum 1) |
+
+At a 1-second window boundary `Retry-After` will typically be `1`.
+
+### TOKEN_BUCKET
+
+| Header | Value |
+|---|---|
+| `X-RateLimit-Remaining` | Current token count (may increase between requests due to refill) |
+| `X-RateLimit-Reset` | Estimated Unix timestamp when the **next token arrives** |
+| `Retry-After` | Milliseconds-precise estimate converted to seconds (minimum 1) |
+
+Because the token bucket refills continuously, `X-RateLimit-Reset` is a near-future
+timestamp rather than an aligned window boundary.
+
+## Retry-After precision
+
+`Retry-After` is computed as:
+
+```
+retryAfter = max(1, X-RateLimit-Reset - currentTimeSeconds)
+```
+
+The minimum value is always `1` second — RFC 7231 discourages `Retry-After: 0` as it
+encourages instant retry loops.
+
+## Client-side back-off example (Java)
+
+```java
+HttpResponse res = client.send(request, BodyHandlers.ofString());
+
+if (res.statusCode() == 429) {
+ String retryAfter = res.headers().firstValue("Retry-After").orElse("1");
+ long waitMs = Long.parseLong(retryAfter) * 1000L;
+ Thread.sleep(waitMs);
+ // retry...
+}
+```
+
+## Client-side back-off example (JavaScript fetch)
+
+```js
+const res = await fetch('/api/search?q=flash');
+
+if (res.status === 429) {
+ const retryAfter = parseInt(res.headers.get('Retry-After') ?? '1', 10);
+ await new Promise(r => setTimeout(r, retryAfter * 1000));
+ // retry...
+}
+```
+
+## Monitoring / alerting
+
+`X-RateLimit-Remaining` can be scraped by a metrics agent to track approaching limits
+before they hit 429:
+
+- `remaining / limit < 0.1` → warning (less than 10% quota left)
+- `status == 429` → rate-limit violation counter increment
+
+If `flash-ext-limiter` is used together with a future metrics extension, the 429 rate
+per resolver key is a natural signal for abuse detection or auto-scaling.
+
+## Header injection timing
+
+Headers are injected **before** calling `next.handle(req, res)` on allowed requests,
+and **instead of** calling it on rejected requests. This means:
+
+- Handlers cannot accidentally overwrite `X-RateLimit-*` headers (they are set first,
+ but handlers that call `res.header(...)` with the same name will add a second value —
+ avoid this by not setting these headers manually).
+- On 429, the handler body is never executed — no side effects occur.
+
+## Integration with Swagger UI (flash-ext-openapi)
+
+Rate-limit headers are not currently injected into the OpenAPI spec. If you want to
+document them, add them manually via `@ApiOperation` on the handler class using the
+response headers section of the OpenAPI spec.
diff --git a/flash-extensions/flash-ext-limiter/docs/key-resolvers.md b/flash-extensions/flash-ext-limiter/docs/key-resolvers.md
new file mode 100644
index 0000000..1b39d34
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/key-resolvers.md
@@ -0,0 +1,143 @@
+# Key Resolvers
+
+A **key resolver** is a lambda `Request → String` that extracts the partition key used
+to identify who a rate limit applies to. Each unique key value gets its own independent
+bucket — so `"ip"` limits per client address, `"auth_user"` limits per logged-in user, etc.
+
+## Built-in resolver: `"ip"`
+
+Always present. Cannot be removed; can be overridden with `registerResolver("ip", ...)`.
+
+Resolution order:
+1. `X-Forwarded-For` header — first address in the comma-separated list (client behind proxy)
+2. `X-Real-IP` header — single forwarded IP (nginx `proxy_set_header X-Real-IP`)
+3. `req.remoteAddress().getAddress().getHostAddress()` — direct socket address, zero allocation
+ (the `InetSocketAddress` already exists from `ServerSocket.accept()`; only `getHostAddress()`
+ allocates a String, and only when the first two headers are absent)
+4. `"unknown"` — only if `remoteAddress()` is null (test-constructed requests)
+
+```java
+// Override the built-in "ip" resolver to trust only the last hop in X-Forwarded-For
+conf.registerResolver("ip", req -> {
+ String xff = req.header("X-Forwarded-For");
+ if (xff != null) {
+ String[] parts = xff.split(",");
+ return parts[parts.length - 1].strip(); // last = most recent proxy
+ }
+ return req.header("X-Real-IP") != null ? req.header("X-Real-IP").strip() : "unknown";
+});
+```
+
+
+## Registering custom resolvers
+
+```java
+LimiterConfig conf = new LimiterConfig();
+```
+
+### By authenticated user (OIDC / ClaimsHolder)
+
+```java
+conf.registerResolver("auth_user", req ->
+ ClaimsHolder.exists() ? ClaimsHolder.user().sub() : "anonymous");
+```
+
+Requests from unauthenticated users share the `"anonymous"` bucket. If you want
+unauthenticated requests to be unlimited, pair this resolver with `@Limit` only on
+handlers that are already protected by `@Authenticated`.
+
+### By API key header
+
+```java
+conf.registerResolver("api_key", req -> {
+ String key = req.header("X-Api-Key");
+ return key != null ? key : "none";
+});
+```
+
+### By tenant (multi-tenant SaaS)
+
+```java
+conf.registerResolver("tenant", req -> {
+ // Extract from subdomain: acme.api.example.com → "acme"
+ String host = req.header("Host");
+ if (host == null) return "unknown";
+ int dot = host.indexOf('.');
+ return dot > 0 ? host.substring(0, dot) : host;
+});
+```
+
+### By IP + path (per-endpoint per-IP)
+
+Combines two dimensions into a single key string:
+
+```java
+conf.registerResolver("ip_path", req -> {
+ String ip = req.header("X-Forwarded-For");
+ if (ip == null) ip = "unknown";
+ int comma = ip.indexOf(',');
+ if (comma > 0) ip = ip.substring(0, comma).strip();
+ return ip + "|" + req.path();
+});
+```
+
+### Composite: role-based bucket size
+
+One resolver, two different `@Limit` thresholds on two handler classes. The resolver
+returns the same key for the same user regardless of endpoint; the limit is set per handler.
+
+```java
+conf.registerResolver("auth_user", req ->
+ ClaimsHolder.exists() ? ClaimsHolder.user().sub() : "anon");
+```
+
+```java
+@Limit(key = "auth_user", requests = 1000, window = 1) // privileged endpoint
+public class AdminReportHandler extends RequestHandler { ... }
+
+@Limit(key = "auth_user", requests = 20, window = 1) // public endpoint
+public class PublicSearchHandler extends RequestHandler { ... }
+```
+
+The two handlers maintain **independent buckets** for the same user — each `@Limit`
+annotation gets its own `BucketStore`.
+
+## Resolver contract
+
+```java
+@FunctionalInterface
+public interface KeyResolver {
+ String resolve(Request req); // must never return null; return "unknown" as fallback
+}
+```
+
+- Must not return `null` — a null key will throw `NullPointerException` inside `ConcurrentHashMap`.
+- Must be **thread-safe** — called concurrently from virtual threads.
+- Should be **fast** — it runs on every request for every rate-limited route.
+- No state should be mutated — treat `Request` as read-only.
+
+## Fail-fast validation
+
+If a `@Limit` annotation or `guard.limit(...)` call references a resolver name that was never
+registered, the server **refuses to start** with `InitializationException`:
+
+```
+InitializationException: Rate-limit resolver "auth_user" is not registered.
+Call LimiterConfig.registerResolver("auth_user", req -> ...) before install.
+```
+
+This check happens at boot time (annotation processor / Guard wiring), not at request time.
+
+## Registration API
+
+```java
+LimiterConfig conf = new LimiterConfig()
+ .registerResolver("auth_user", req -> ...)
+ .registerResolver("tenant", req -> ...)
+ .registerResolver("api_key", req -> ...);
+
+app.install(new LimiterExtension(conf));
+```
+
+`registerResolver` returns `this` for fluent chaining. Calling it with an existing name
+**replaces** the previous resolver — this is how you override the built-in `"ip"` resolver.
diff --git a/flash-extensions/flash-ext-limiter/docs/strategies.md b/flash-extensions/flash-ext-limiter/docs/strategies.md
new file mode 100644
index 0000000..6420e7a
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/docs/strategies.md
@@ -0,0 +1,178 @@
+# Rate-limit strategies
+
+Two algorithms are built in. Both are lock-free (CAS-only), operate on pre-allocated
+`Bucket` state, and write results into a caller-supplied `long[2]` — zero per-request allocation.
+
+## FIXED_WINDOW
+
+```java
+@Limit(strategy = LimitStrategy.FIXED_WINDOW, ...) // default, can be omitted
+guard.limit("ip", 100, 1, TimeUnit.SECONDS) // default
+```
+
+### How it works
+
+The request counter resets to zero at each clock-aligned window boundary.
+
+```
+ window 1 window 2 window 3
+|────────────────|────────────────|────────────────|
+ cnt: 0 1 2 … N cnt: 0 1 2 … N cnt: 0 1 2 … N
+```
+
+With `requests = 100, window = 1s`:
+- Requests 1–100 in a given second → allowed
+- Request 101+ in that second → 429, allowed again at second +1
+
+### Implementation
+
+All state is packed into a single `AtomicLong` (`Bucket.slot0`):
+
+```
+high 32 bits = reduced epoch = (currentTimeMs / windowMs) & 0xFFFFFFFF
+low 32 bits = request count in the current window
+```
+
+One CAS operation per request. At a window boundary the same CAS atomically resets the
+counter to 1. No locks, no additional fields.
+
+### Burst behaviour
+
+Because the window is fixed to the clock, a burst can occur at the boundary:
+up to `N` requests at the end of window 1 followed immediately by `N` requests at the
+start of window 2 → `2N` requests in a short interval.
+
+```
+ window 1 │ window 2
+ ────────────┼────────────
+ 99 100 101 │ 1 2 3 4
+ ↑ reset: 101 → 429, then 1 is allowed
+```
+
+If burst tolerance is unacceptable, use `TOKEN_BUCKET`.
+
+### When to use
+
+- Simple API rate limiting where occasional boundary bursts are acceptable.
+- Scenarios where a hard "N requests per clock second/minute" guarantee matters.
+- When you want minimal per-bucket memory (one `AtomicLong`, `Bucket.slot1` unused).
+
+---
+
+## TOKEN_BUCKET
+
+```java
+@Limit(strategy = LimitStrategy.TOKEN_BUCKET, ...)
+guard.limit("ip", 100, 1, TimeUnit.SECONDS, LimitStrategy.TOKEN_BUCKET)
+```
+
+### How it works
+
+The bucket holds up to `requests` tokens and refills at a continuous rate of
+`requests / window` tokens per millisecond. Each request consumes one token.
+A client that was idle accumulates tokens and can fire a burst, but sustained
+excess traffic drains the bucket and triggers 429s.
+
+```
+tokens
+ N ─┐ ┌──── refill slope ────┐
+ │ │ │
+ 0 └───────────┘ ←─ burst consumed ──→│
+ burst here 429s during drain recovery
+```
+
+### Refill rate
+
+`refillPerMs = (requests × 1000) / windowMs` (integer, minimum 1)
+
+For `requests = 100, window = 1s`:
+- Refill rate: 100 tokens/s = 1 token/10 ms
+- Max capacity: 100 tokens
+- A client idle for 500 ms accumulates 50 tokens and can fire 50 requests instantly.
+
+### Implementation
+
+- `Bucket.slot0` — current tokens × 1000 (fixed-point, avoids floating-point math)
+- `Bucket.slot1` — last-refill timestamp in ms (0 = uninitialised → bucket starts full)
+
+One CAS loop on `slot0` per request; `slot1` updated best-effort after CAS success.
+The bounded inaccuracy from the non-atomic dual update is at most a few nanoseconds —
+negligible and self-correcting for rate limiting.
+
+### Bucket starts full
+
+On the very first request, `slot1 == 0`. The strategy treats this as "one full window
+elapsed" → `currentTokens = max`. The bucket starts at capacity; no warm-up needed.
+
+### When to use
+
+- APIs where clients legitimately batch requests (analytics, bulk imports).
+- Endpoints where smooth throughput matters more than hard per-second guarantees.
+- Any scenario where `FIXED_WINDOW` boundary bursts would be problematic.
+
+---
+
+## Comparison
+
+| | `FIXED_WINDOW` | `TOKEN_BUCKET` |
+|---|---|---|
+| Algorithm | Aligned counter reset | Continuous token refill |
+| Burst handling | Allows 2× limit at boundaries | Absorbs bursts up to bucket capacity |
+| Memory per bucket | 1 × `AtomicLong` used | 2 × `AtomicLong` used |
+| Clock alignment | Yes (predictable resets) | No (smooth) |
+| Typical use case | Simple request quotas | APIs with legitimate burst patterns |
+| CAS operations per request | 1 (usually) | 1 (usually) |
+
+Both strategies use the same `Bucket` type. Both are lock-free and allocation-free after
+the bucket is first created.
+
+---
+
+## Adding a custom strategy
+
+Implement `RateLimitStrategy` and wrap it in a `LimitStrategy` enum constant:
+
+```java
+// 1. Implement the strategy
+public final class SlidingWindowStrategy implements RateLimitStrategy {
+ @Override
+ public boolean check(Bucket bucket, LimitConfig cfg, long[] out) {
+ // ... lock-free implementation using bucket.slot0 / slot1
+ return allowed;
+ }
+}
+
+// 2. Add to the enum
+public enum LimitStrategy {
+ FIXED_WINDOW { ... },
+ TOKEN_BUCKET { ... },
+ SLIDING_WINDOW {
+ @Override
+ public RateLimitStrategy create() { return new SlidingWindowStrategy(); }
+ };
+ public abstract RateLimitStrategy create();
+}
+```
+
+The new strategy is immediately available to `@Limit(strategy = LimitStrategy.SLIDING_WINDOW)`
+and `guard.limit("ip", 100, 1, SECONDS, LimitStrategy.SLIDING_WINDOW)`.
+
+### Strategy contract
+
+```java
+public interface RateLimitStrategy {
+ /**
+ * @param bucket pre-allocated per-key state (never null)
+ * @param cfg immutable rule config (limit, windowMs)
+ * @param out out[0] = remaining, out[1] = reset epoch-seconds
+ * @return true = allowed, false = rejected (429)
+ */
+ boolean check(Bucket bucket, LimitConfig cfg, long[] out);
+}
+```
+
+Requirements for custom implementations:
+- **Lock-free** — use `AtomicLong.compareAndSet`; no `synchronized` or `ReentrantLock`.
+- **Stateless** — all mutable state must live in `Bucket.slot0` / `Bucket.slot1`.
+- **No allocation** — `out[]` is the only output channel; do not create objects on the hot path.
+- **Thread-safe** — called concurrently from many virtual threads.
diff --git a/flash-extensions/flash-ext-limiter/pom.xml b/flash-extensions/flash-ext-limiter/pom.xml
new file mode 100644
index 0000000..534cc87
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/pom.xml
@@ -0,0 +1,30 @@
+
+
+ 4.0.0
+
+
+ dev.relism
+ flash-extensions
+ 1.0-SNAPSHOT
+
+
+ flash-ext-limiter
+
+
+
+ dev.relism
+ flash
+
+
+ org.projectlombok
+ lombok
+
+
+ org.junit.jupiter
+ junit-jupiter
+
+
+
+
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Bucket.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Bucket.java
new file mode 100644
index 0000000..89cfbce
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Bucket.java
@@ -0,0 +1,22 @@
+package dev.relism.ext.limiter;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Pre-allocated per-key rate limit state. Holds two {@link AtomicLong} slots whose
+ * semantics are strategy-specific:
+ *
+ *
+ * - FIXED_WINDOW: {@code slot0} = packed {@code (epoch << 32 | count)},
+ * {@code slot1} unused.
+ * - TOKEN_BUCKET: {@code slot0} = tokens × 1000 (scaled),
+ * {@code slot1} = last-refill timestamp (ms since epoch).
+ *
+ *
+ * Buckets are created once per unique key (via {@link BucketStore}) and reused
+ * for the lifetime of the server — zero allocation on the warm path.
+ */
+public final class Bucket {
+ public final AtomicLong slot0 = new AtomicLong(0L);
+ public final AtomicLong slot1 = new AtomicLong(0L);
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/BucketStore.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/BucketStore.java
new file mode 100644
index 0000000..ad43b12
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/BucketStore.java
@@ -0,0 +1,28 @@
+package dev.relism.ext.limiter;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Thread-safe store of pre-allocated {@link Bucket} instances keyed by partition key.
+ *
+ *
On the warm path (key already seen), {@link #get} performs a single
+ * {@link ConcurrentHashMap} lookup — no allocation. On the cold path (new key),
+ * {@code computeIfAbsent} allocates exactly one {@link Bucket} and inserts it.
+ *
+ *
Buckets accumulate indefinitely; for workloads with unbounded unique keys
+ * (e.g. one-shot crawlers), consider periodic store replacement or a bounded
+ * LRU map implementation.
+ */
+public final class BucketStore {
+
+ private final ConcurrentHashMap map = new ConcurrentHashMap<>();
+
+ /**
+ * Returns the bucket for {@code key}, creating one if absent.
+ * Two threads racing on the same new key are guaranteed to receive the same bucket instance.
+ */
+ public Bucket get(String key) {
+ Bucket b = map.get(key);
+ return b != null ? b : map.computeIfAbsent(key, k -> new Bucket());
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Guard.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Guard.java
new file mode 100644
index 0000000..a43348a
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Guard.java
@@ -0,0 +1,69 @@
+package dev.relism.ext.limiter;
+
+import dev.relism.routing.Middleware;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Manual rate-limit guard for lambda routes.
+ *
+ * Available via {@link dev.relism.extension.FlashContext}:
+ *
{@code
+ * Guard guard = ctx.require(Guard.class);
+ * }
+ *
+ * {@link #limit} creates a {@link Middleware} that is composed once at route registration
+ * time — the resolver lambda is captured directly from the registry (no runtime map lookup):
+ *
{@code
+ * // 50 req/s per IP — fixed window (default)
+ * app.get("/api/search", handler)
+ * .with(guard.limit("ip", 50, 1, TimeUnit.SECONDS));
+ *
+ * // 10 req/min per authenticated user — token bucket
+ * app.post("/api/export", handler)
+ * .with(guard.limit("auth_user", 10, 1, TimeUnit.MINUTES, LimitStrategy.TOKEN_BUCKET));
+ * }
+ *
+ * The resolver name is looked up once here (at {@code .with(guard.limit(...))} call time,
+ * i.e. during app wiring, not on each request). If the name is not registered,
+ * {@link dev.relism.exceptions.InitializationException} is thrown immediately.
+ */
+public final class Guard {
+
+ private final LimiterConfig config;
+ private final BucketStore store;
+
+ Guard(LimiterConfig config, BucketStore store) {
+ this.config = config;
+ this.store = store;
+ }
+
+ /**
+ * Returns a {@link Middleware} that enforces the given rate limit using
+ * {@link LimitStrategy#FIXED_WINDOW}.
+ *
+ * @param resolverKey name registered via {@link LimiterConfig#registerResolver}
+ * @param requests maximum requests allowed per window
+ * @param window window duration in {@code unit}
+ * @param unit time unit for {@code window}
+ */
+ public Middleware limit(String resolverKey, int requests, long window, TimeUnit unit) {
+ return limit(resolverKey, requests, window, unit, LimitStrategy.FIXED_WINDOW);
+ }
+
+ /**
+ * Returns a {@link Middleware} that enforces the given rate limit with the specified strategy.
+ *
+ * @param resolverKey name registered via {@link LimiterConfig#registerResolver}
+ * @param requests maximum requests allowed per window
+ * @param window window duration in {@code unit}
+ * @param unit time unit for {@code window}
+ * @param strategy rate-limit algorithm
+ */
+ public Middleware limit(String resolverKey, int requests, long window, TimeUnit unit, LimitStrategy strategy) {
+ // Fail-fast: resolve the lambda at wiring time, not at request time.
+ KeyResolver resolver = config.requireResolver(resolverKey);
+ LimitConfig cfg = new LimitConfig(requests, unit.toMillis(window), strategy.create());
+ return LimiterExtension.buildMiddleware(resolver, cfg, store);
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/KeyResolver.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/KeyResolver.java
new file mode 100644
index 0000000..ef4bb06
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/KeyResolver.java
@@ -0,0 +1,20 @@
+package dev.relism.ext.limiter;
+
+import dev.relism.models.Request;
+
+/**
+ * Extracts a partition key from an incoming request.
+ *
+ *
The resolved key identifies who the rate limit applies to — an IP address,
+ * an authenticated user ID, an API key, etc. Implementations are captured once
+ * at route registration time and called directly (no registry lookup) on every request.
+ *
+ *
{@code
+ * conf.registerResolver("ip", req -> req.header("X-Forwarded-For"));
+ * conf.registerResolver("auth_user", req -> ClaimsHolder.user().sub());
+ * }
+ */
+@FunctionalInterface
+public interface KeyResolver {
+ String resolve(Request req);
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Limit.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Limit.java
new file mode 100644
index 0000000..ea4b484
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/Limit.java
@@ -0,0 +1,45 @@
+package dev.relism.ext.limiter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Applies a rate limit to a class-based {@link dev.relism.models.RequestHandler}.
+ *
+ * The annotation is processed at boot time by the {@link LimiterExtension} annotation
+ * processor. If {@link #key()} names a resolver that was never registered,
+ * startup fails immediately with {@link dev.relism.exceptions.InitializationException}.
+ *
+ *
{@code
+ * // 100 req/s per client IP — fixed window
+ * @Limit(requests = 100, window = 1)
+ * public class SearchHandler extends RequestHandler { ... }
+ *
+ * // 20 req/min per authenticated user — token bucket
+ * @Limit(key = "auth_user", requests = 20, window = 1, windowUnit = TimeUnit.MINUTES,
+ * strategy = LimitStrategy.TOKEN_BUCKET)
+ * public class ExpensiveHandler extends RequestHandler { ... }
+ * }
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Limit {
+
+ /** Name of the resolver registered via {@link LimiterConfig#registerResolver}. Default: {@code "ip"}. */
+ String key() default "ip";
+
+ /** Maximum number of requests allowed per {@link #window()}. */
+ int requests();
+
+ /** Window duration in {@link #windowUnit()} units. */
+ long window();
+
+ /** Unit for {@link #window()}. Default: {@link TimeUnit#SECONDS}. */
+ TimeUnit windowUnit() default TimeUnit.SECONDS;
+
+ /** Rate-limit algorithm. Default: {@link LimitStrategy#FIXED_WINDOW}. */
+ LimitStrategy strategy() default LimitStrategy.FIXED_WINDOW;
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitConfig.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitConfig.java
new file mode 100644
index 0000000..2e63f19
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitConfig.java
@@ -0,0 +1,11 @@
+package dev.relism.ext.limiter;
+
+/**
+ * Immutable configuration snapshot for a single rate-limit rule.
+ * Created once at boot time and captured directly in the middleware closure.
+ *
+ * @param limit Maximum allowed requests per window.
+ * @param windowMs Window duration in milliseconds.
+ * @param strategy Strategy instance bound to this rule (one per rule, not shared).
+ */
+public record LimitConfig(int limit, long windowMs, RateLimitStrategy strategy) {}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitStrategy.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitStrategy.java
new file mode 100644
index 0000000..668f69b
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimitStrategy.java
@@ -0,0 +1,45 @@
+package dev.relism.ext.limiter;
+
+import dev.relism.ext.limiter.strategy.FixedWindowStrategy;
+import dev.relism.ext.limiter.strategy.TokenBucketStrategy;
+
+/**
+ * Enumeration of built-in rate-limit algorithms. Each constant is a factory
+ * for its corresponding {@link RateLimitStrategy} implementation.
+ *
+ * New algorithms can be added here without touching the rest of the extension.
+ * The enum value is referenced by {@link Limit#strategy()} so user code refers
+ * to the algorithm by name ({@code LimitStrategy.FIXED_WINDOW}) rather than
+ * instantiating strategy objects directly.
+ *
+ *
{@code
+ * @Limit(key = "ip", requests = 100, window = 1, strategy = LimitStrategy.TOKEN_BUCKET)
+ * public class SearchHandler extends RequestHandler { ... }
+ * }
+ */
+public enum LimitStrategy {
+
+ /**
+ * Fixed-window counter: resets to zero at each clock-aligned window boundary.
+ * Simple, minimal memory, but allows up to 2× the limit in bursts that straddle
+ * two windows.
+ */
+ FIXED_WINDOW {
+ @Override
+ public RateLimitStrategy create() { return new FixedWindowStrategy(); }
+ },
+
+ /**
+ * Token-bucket: tokens refill continuously. Smooth burst absorption — a client
+ * that was idle accumulates tokens and can fire a short burst, but sustained
+ * excess traffic is rejected. Preferred for API endpoints where occasional bursts
+ * are legitimate.
+ */
+ TOKEN_BUCKET {
+ @Override
+ public RateLimitStrategy create() { return new TokenBucketStrategy(); }
+ };
+
+ /** Creates a fresh, stateless {@link RateLimitStrategy} instance for this algorithm. */
+ public abstract RateLimitStrategy create();
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterConfig.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterConfig.java
new file mode 100644
index 0000000..c2cb1c5
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterConfig.java
@@ -0,0 +1,82 @@
+package dev.relism.ext.limiter;
+
+import dev.relism.exceptions.InitializationException;
+
+import java.net.InetSocketAddress;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Extension configuration: holds the named {@link KeyResolver} registry.
+ *
+ * Resolvers are registered during the config phase (before {@code install}).
+ * After {@link LimiterExtension#install} is called, the registry is consulted once per
+ * route/handler at boot to capture the resolver lambda directly into the middleware closure.
+ * There is no map lookup on the request hot-path.
+ *
+ *
The built-in {@code "ip"} resolver is always present and extracts the client IP from
+ * {@code X-Forwarded-For} (first address) or {@code X-Real-IP}. Override it with
+ * {@code registerResolver("ip", ...)} if needed.
+ *
+ *
{@code
+ * LimiterConfig conf = new LimiterConfig()
+ * .registerResolver("auth_user", req -> {
+ * // custom logic — e.g. extract sub from ClaimsHolder
+ * return ClaimsHolder.exists() ? ClaimsHolder.user().sub() : "anonymous";
+ * });
+ *
+ * app.install(new LimiterExtension(conf));
+ * }
+ */
+public final class LimiterConfig {
+
+ private final Map resolvers = new LinkedHashMap<>();
+
+ public LimiterConfig() {
+ // Built-in mandatory "ip" resolver.
+ // Resolution order (standard reverse-proxy chain):
+ // 1. X-Forwarded-For — first address (client behind one or more proxies)
+ // 2. X-Real-IP — single forwarded IP (nginx proxy_set_header X-Real-IP)
+ // 3. Socket address — direct connection, no proxy headers (zero alloc: the
+ // InetSocketAddress already exists from accept(); only
+ // getHostAddress() allocates a String, and only when reached)
+ resolvers.put("ip", req -> {
+ String xff = req.header("X-Forwarded-For");
+ if (xff != null) {
+ int comma = xff.indexOf(',');
+ return comma > 0 ? xff.substring(0, comma).strip() : xff.strip();
+ }
+ String xri = req.header("X-Real-IP");
+ if (xri != null) return xri.strip();
+ InetSocketAddress addr = req.remoteAddress();
+ return addr != null ? addr.getAddress().getHostAddress() : "unknown";
+ });
+ }
+
+ /**
+ * Registers (or replaces) a named key resolver. Returns {@code this} for fluent chaining.
+ *
+ * @param name identifier referenced by {@link Limit#key()} and {@link Guard#limit}
+ * @param resolver lambda that extracts the partition key from a request
+ */
+ public LimiterConfig registerResolver(String name, KeyResolver resolver) {
+ if (name == null || name.isBlank()) throw new IllegalArgumentException("Resolver name must not be blank");
+ if (resolver == null) throw new IllegalArgumentException("Resolver must not be null");
+ resolvers.put(name, resolver);
+ return this;
+ }
+
+ /**
+ * Returns the resolver for {@code name}.
+ *
+ * @throws InitializationException if no resolver with that name has been registered —
+ * checked at boot time so misconfigurations surface immediately.
+ */
+ KeyResolver requireResolver(String name) {
+ KeyResolver r = resolvers.get(name);
+ if (r == null) throw new InitializationException(
+ "Rate-limit resolver \"" + name + "\" is not registered. " +
+ "Call LimiterConfig.registerResolver(\"" + name + "\", req -> ...) before install.");
+ return r;
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterExtension.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterExtension.java
new file mode 100644
index 0000000..c025886
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/LimiterExtension.java
@@ -0,0 +1,130 @@
+package dev.relism.ext.limiter;
+
+import dev.relism.extension.FlashContext;
+import dev.relism.extension.FlashExtension;
+import dev.relism.extension.FlashRegistrar;
+import dev.relism.http.HttpStatus;
+import dev.relism.routing.Middleware;
+
+import java.util.List;
+
+/**
+ * Rate-limiting extension for Flash.
+ *
+ * On {@link #install}:
+ *
+ * - Creates a single {@link BucketStore} shared by all rules in this extension instance.
+ * - Provides a {@link Guard} in the {@link FlashContext} for manual use on lambda routes.
+ * - Registers an {@link dev.relism.extension.AnnotationProcessor} for {@link Limit}:
+ * reads the annotation once per handler class at boot, resolves the key lambda
+ * from the registry fail-fast, then returns a pre-compiled middleware
+ * that captures the lambda and config directly — zero map lookups at request time.
+ *
+ *
+ * Annotation-based (class handlers)
+ * {@code
+ * @Limit(requests = 100, window = 1) // 100 req/s per IP
+ * public class SearchHandler extends RequestHandler { ... }
+ *
+ * @Limit(key = "auth_user", requests = 20, window = 1,
+ * windowUnit = TimeUnit.MINUTES,
+ * strategy = LimitStrategy.TOKEN_BUCKET)
+ * public class ReportHandler extends RequestHandler { ... }
+ * }
+ *
+ * Lambda routes (via Guard)
+ * {@code
+ * LimiterConfig conf = new LimiterConfig()
+ * .registerResolver("auth_user", req -> ClaimsHolder.user().sub());
+ *
+ * app.install(new LimiterExtension(conf));
+ *
+ * Guard guard = app.ctx().require(Guard.class);
+ * app.get("/api/search", handler).with(guard.limit("ip", 50, 1, TimeUnit.SECONDS));
+ * }
+ *
+ * Installation order matters
+ * Install {@code LimiterExtension} before authentication extensions so that
+ * rate-limit checks short-circuit before expensive token validation on over-limit requests.
+ */
+public final class LimiterExtension implements FlashExtension {
+
+ private final LimiterConfig config;
+
+ /** Installs with default config (only the built-in {@code "ip"} resolver). */
+ public LimiterExtension() {
+ this(new LimiterConfig());
+ }
+
+ /** Installs with a custom {@link LimiterConfig} (custom resolvers, etc.). */
+ public LimiterExtension(LimiterConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public void install(FlashRegistrar app, FlashContext ctx) {
+ BucketStore store = new BucketStore();
+ Guard guard = new Guard(config, store);
+
+ ctx.provide(Guard.class, guard);
+ ctx.provide(LimiterConfig.class, config);
+
+ // Annotation processor: runs once per class-based handler at boot.
+ ctx.addAnnotationProcessor(handlerClass -> {
+ Limit ann = handlerClass.getAnnotation(Limit.class);
+ if (ann == null) return List.of();
+
+ // Fail-fast: if the key is unknown the server refuses to start.
+ KeyResolver resolver = config.requireResolver(ann.key());
+ LimitConfig cfg = new LimitConfig(
+ ann.requests(),
+ ann.windowUnit().toMillis(ann.window()),
+ ann.strategy().create()
+ );
+
+ return List.of(buildMiddleware(resolver, cfg, store));
+ });
+ }
+
+ // ── Package-private helper — shared with Guard ────────────────────────────
+
+ /**
+ * Builds the rate-limit {@link Middleware} from an already-resolved resolver lambda.
+ *
+ * Hot-path design:
+ *
+ * - {@code resolver} is captured directly in the closure — no registry lookup per request.
+ * - {@code resultBuf} is a per-{@link Middleware}-instance ThreadLocal {@code long[2]}.
+ * Allocated once per thread, reused forever — zero per-request allocation.
+ * - Header values ({@code String.valueOf(...)}) are the only unavoidable allocations;
+ * they are tiny and bounded.
+ *
+ */
+ static Middleware buildMiddleware(KeyResolver resolver, LimitConfig cfg, BucketStore store) {
+ // One result buffer per thread, per middleware instance.
+ // ThreadLocal is captured in the closure at boot time — not re-created per request.
+ ThreadLocal resultBuf = ThreadLocal.withInitial(() -> new long[2]);
+
+ return next -> (req, res) -> {
+ String key = resolver.resolve(req);
+ Bucket bucket = store.get(key);
+ long[] out = resultBuf.get();
+
+ boolean allowed = cfg.strategy().check(bucket, cfg, out);
+
+ // Always inject rate-limit headers — useful even on allowed requests.
+ res.header("X-RateLimit-Limit", String.valueOf(cfg.limit()));
+ res.header("X-RateLimit-Remaining", String.valueOf(out[0]));
+ res.header("X-RateLimit-Reset", String.valueOf(out[1]));
+
+ if (!allowed) {
+ long retryAfter = Math.max(1L, out[1] - System.currentTimeMillis() / 1000L);
+ res.status(HttpStatus.TOO_MANY_REQUESTS)
+ .header("Retry-After", String.valueOf(retryAfter));
+ return "Too Many Requests";
+ }
+
+ return next.handle(req, res);
+ };
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/RateLimitStrategy.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/RateLimitStrategy.java
new file mode 100644
index 0000000..3434f49
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/RateLimitStrategy.java
@@ -0,0 +1,34 @@
+package dev.relism.ext.limiter;
+
+/**
+ * Contract for a rate-limit algorithm. Implementations must be:
+ *
+ * - Lock-free — rely only on {@link java.util.concurrent.atomic.AtomicLong} CAS operations.
+ * - Stateless — all mutable state lives in the {@link Bucket}; the strategy itself
+ * holds no instance fields so the same object can be shared across threads and rules.
+ *
+ *
+ * Called on every request — must not allocate on the hot path.
+ *
+ * @see dev.relism.ext.limiter.strategy.FixedWindowStrategy
+ * @see dev.relism.ext.limiter.strategy.TokenBucketStrategy
+ */
+public interface RateLimitStrategy {
+
+ /**
+ * Checks whether this request is within the limit and updates the bucket atomically.
+ *
+ *
On return, {@code out} contains:
+ *
+ * - {@code out[0]} — remaining allowed requests in the current window (≥ 0).
+ * - {@code out[1]} — Unix epoch seconds at which the quota resets (for {@code X-RateLimit-Reset}
+ * and {@code Retry-After} headers).
+ *
+ *
+ * @param bucket per-key state carrier (pre-allocated, never null)
+ * @param cfg immutable rule configuration
+ * @param out caller-supplied two-element array; values are overwritten on every call
+ * @return {@code true} if the request is within the limit and should proceed
+ */
+ boolean check(Bucket bucket, LimitConfig cfg, long[] out);
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/FixedWindowStrategy.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/FixedWindowStrategy.java
new file mode 100644
index 0000000..179aa85
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/FixedWindowStrategy.java
@@ -0,0 +1,54 @@
+package dev.relism.ext.limiter.strategy;
+
+import dev.relism.ext.limiter.Bucket;
+import dev.relism.ext.limiter.LimitConfig;
+import dev.relism.ext.limiter.RateLimitStrategy;
+
+/**
+ * Fixed-window rate limit: allows up to {@link LimitConfig#limit()} requests per window of
+ * {@link LimitConfig#windowMs()} milliseconds. The window is aligned to clock time
+ * (e.g. 10:00:00 – 10:00:59 for a 60-second window), not sliding.
+ *
+ * Implementation
+ * The entire state fits in a single {@link java.util.concurrent.atomic.AtomicLong}
+ * ({@link Bucket#slot0}), packed as:
+ *
+ * high 32 bits = reduced epoch (currentTimeMs / windowMs) & 0xFFFFFFFFL
+ * low 32 bits = request count in the current window
+ *
+ * Each request performs a single CAS loop — no locks, no allocations.
+ * At a window boundary the CAS atomically resets the counter to 1.
+ *
+ * The reduced epoch wraps every {@code 2^32 × windowMs} milliseconds
+ * (~13,000 years for a 100 ms window) — collision-free in practice.
+ */
+public final class FixedWindowStrategy implements RateLimitStrategy {
+
+ @Override
+ public boolean check(Bucket bucket, LimitConfig cfg, long[] out) {
+ long now = System.currentTimeMillis();
+ long absEpoch = now / cfg.windowMs();
+ int epoch = (int)(absEpoch & 0xFFFFFFFFL); // reduced epoch, collision-safe
+
+ while (true) {
+ long packed = bucket.slot0.get();
+ int storedEpoch = (int)(packed >>> 32);
+ int count = (int)(packed & 0xFFFFFFFFL);
+
+ // Same window: increment; new window: reset to 1.
+ // Cap at limit+1 to guard against int overflow on extreme traffic.
+ int newCount = (storedEpoch == epoch)
+ ? Math.min(count + 1, cfg.limit() + 1)
+ : 1;
+
+ long newPacked = ((long) epoch << 32) | (newCount & 0xFFFFFFFFL);
+
+ if (bucket.slot0.compareAndSet(packed, newPacked)) {
+ out[0] = Math.max(0L, cfg.limit() - newCount);
+ out[1] = (absEpoch + 1) * cfg.windowMs() / 1000L;
+ return newCount <= cfg.limit();
+ }
+ // CAS lost — contention; re-read and retry.
+ }
+ }
+}
diff --git a/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/TokenBucketStrategy.java b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/TokenBucketStrategy.java
new file mode 100644
index 0000000..f77545a
--- /dev/null
+++ b/flash-extensions/flash-ext-limiter/src/main/java/dev/relism/ext/limiter/strategy/TokenBucketStrategy.java
@@ -0,0 +1,69 @@
+package dev.relism.ext.limiter.strategy;
+
+import dev.relism.ext.limiter.Bucket;
+import dev.relism.ext.limiter.LimitConfig;
+import dev.relism.ext.limiter.RateLimitStrategy;
+
+/**
+ * Token-bucket rate limit: tokens refill continuously at a rate of
+ * {@code limit / windowMs} tokens per millisecond, up to a maximum of {@code limit} tokens.
+ * Each request consumes one token. Burst traffic is absorbed until the bucket empties.
+ *
+ *
Implementation
+ *
+ * - {@link Bucket#slot0} — current token count scaled by {@value #SCALE}
+ * (allows sub-token precision without floating-point). Starts at 0; treated as
+ * {@code maxScaled} when {@link Bucket#slot1} is 0 (first call → bucket starts full).
+ * - {@link Bucket#slot1} — last-refill timestamp in ms. 0 = not yet initialised.
+ *
+ *
+ * Each request CAS-loops on {@code slot0}; {@code slot1} is updated best-effort after a
+ * successful CAS. The resulting inaccuracy is bounded by the nanoseconds between the CAS
+ * and the {@code set} — negligible and self-correcting for rate limiting purposes.
+ */
+public final class TokenBucketStrategy implements RateLimitStrategy {
+
+ /** Fixed-point scale factor. Stored tokens = actual tokens × SCALE. */
+ static final long SCALE = 1_000L;
+
+ @Override
+ public boolean check(Bucket bucket, LimitConfig cfg, long[] out) {
+ long now = System.currentTimeMillis();
+ long maxScaled = (long) cfg.limit() * SCALE;
+ // Refill rate: limit tokens per windowMs → (limit * SCALE) / windowMs scaled-tokens per ms.
+ // Minimum 1 to ensure progress even for very large windows.
+ long rfPerMs = Math.max(1L, maxScaled / cfg.windowMs());
+
+ while (true) {
+ long lastMs = bucket.slot1.get();
+ long rawTokens = bucket.slot0.get();
+
+ // When slot1 == 0 the bucket has never been used: treat as one full window elapsed
+ // so the bucket starts completely full.
+ long elapsed = (lastMs == 0L) ? cfg.windowMs() : Math.max(0L, now - lastMs);
+ long currentTokens = Math.min(maxScaled, rawTokens + elapsed * rfPerMs);
+
+ if (currentTokens < SCALE) {
+ // Not enough for one token — compute when the next token arrives.
+ long needed = SCALE - currentTokens;
+ long msToNext = (needed + rfPerMs - 1) / rfPerMs; // ceiling division
+ out[0] = 0L;
+ out[1] = (now + msToNext) / 1000L;
+ // Best-effort: advance the refill baseline so the next call gets a fresh elapsed.
+ bucket.slot0.compareAndSet(rawTokens, currentTokens);
+ bucket.slot1.compareAndSet(lastMs, now);
+ return false;
+ }
+
+ long newTokens = currentTokens - SCALE;
+ if (bucket.slot0.compareAndSet(rawTokens, newTokens)) {
+ // Consumed successfully. Update refill baseline best-effort.
+ bucket.slot1.set(now);
+ out[0] = newTokens / SCALE;
+ out[1] = now / 1000L;
+ return true;
+ }
+ // CAS lost — another thread consumed a token concurrently; re-read and retry.
+ }
+ }
+}
diff --git a/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcExtension.java b/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcExtension.java
index 45c7648..9ac0a66 100644
--- a/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcExtension.java
+++ b/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcExtension.java
@@ -1,6 +1,6 @@
package dev.relism.ext.oidc;
-import dev.relism.extension.ExtensionContext;
+import dev.relism.extension.FlashContext;
import dev.relism.extension.FlashExtension;
import dev.relism.extension.FlashRegistrar;
@@ -59,7 +59,7 @@ public class OidcExtension implements FlashExtension {
}
@Override
- public void install(FlashRegistrar app, ExtensionContext ctx) {
+ public void install(FlashRegistrar app, FlashContext ctx) {
// 1. Build the shared HttpClient (optionally with TLS verification disabled)
HttpClient http = buildHttpClient(config);
@@ -294,7 +294,7 @@ public class OidcExtension implements FlashExtension {
* If not present, the {@link NoClassDefFoundError} is caught at the call site.
*/
private static final class OpenApiIntegration {
- static void register(dev.relism.extension.ExtensionContext ctx,
+ static void register(dev.relism.extension.FlashContext ctx,
OidcConfig config, OidcProviderMetadata meta) {
ctx.find(dev.relism.ext.openapi.OpenApiSecurityRegistry.class)
.ifPresent(registry -> registry.add(new dev.relism.ext.openapi.OpenApiSecurityContributor() {
diff --git a/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcMiddleware.java b/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcMiddleware.java
index abcb4ab..58952ae 100644
--- a/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcMiddleware.java
+++ b/flash-extensions/flash-ext-oidc/src/main/java/dev/relism/ext/oidc/OidcMiddleware.java
@@ -13,7 +13,7 @@ import java.util.Map;
import java.util.Optional;
/**
- * Request-level OIDC middleware. Exposed in the {@link dev.relism.extension.ExtensionContext}
+ * Request-level OIDC middleware. Exposed in the {@link dev.relism.extension.FlashContext}
* for manual use on lambda routes; injected automatically for handlers annotated with
* {@link Authenticated} or {@link RolesAllowed}.
*
diff --git a/flash-extensions/flash-ext-openapi/README.md b/flash-extensions/flash-ext-openapi/README.md
index 54e903c..5994374 100644
--- a/flash-extensions/flash-ext-openapi/README.md
+++ b/flash-extensions/flash-ext-openapi/README.md
@@ -121,7 +121,7 @@ builder picks it up automatically — no coupling between extensions.
### How it works
-1. `OpenApiExtension` creates an `OpenApiSecurityRegistry` and exposes it in the `ExtensionContext`.
+1. `OpenApiExtension` creates an `OpenApiSecurityRegistry` and exposes it in the `FlashContext`.
2. `flash-ext-oidc` calls `ctx.find(OpenApiSecurityRegistry.class)` and registers its contributor.
3. At spec build time, `OpenApiBuilder` iterates contributors and injects `security` entries on each
operation whose handler class carries `@Authenticated` or `@RolesAllowed`.
diff --git a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiExtension.java b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiExtension.java
index 81fabf1..62bbaaf 100644
--- a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiExtension.java
+++ b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiExtension.java
@@ -2,7 +2,7 @@ package dev.relism.ext.openapi;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLMapper;
-import dev.relism.extension.ExtensionContext;
+import dev.relism.extension.FlashContext;
import dev.relism.extension.FlashExtension;
import dev.relism.extension.FlashRegistrar;
import dev.relism.http.ContentType;
@@ -61,7 +61,7 @@ public class OpenApiExtension implements FlashExtension {
}
@Override
- public void install(FlashRegistrar app, ExtensionContext ctx) {
+ public void install(FlashRegistrar app, FlashContext ctx) {
ObjectMapper jsonMapper = ctx.require(ObjectMapper.class);
YAMLMapper yamlMapper = new YAMLMapper();
diff --git a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityContributor.java b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityContributor.java
index e74c82a..6e7fe38 100644
--- a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityContributor.java
+++ b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityContributor.java
@@ -8,7 +8,7 @@ import java.util.Map;
*
*
Extensions that enforce authentication (e.g. {@code flash-ext-oidc}) implement
* this interface and register an instance into {@link OpenApiSecurityRegistry} via the
- * {@link dev.relism.extension.ExtensionContext}. {@link OpenApiExtension} picks it up
+ * {@link dev.relism.extension.FlashContext}. {@link OpenApiExtension} picks it up
* at spec-generation time — no coupling between the two extensions at install time.
*
*
Multi-tenant: multiple contributors may coexist. For handlers secured by
diff --git a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityRegistry.java b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityRegistry.java
index 777ede7..0ed8f0e 100644
--- a/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityRegistry.java
+++ b/flash-extensions/flash-ext-openapi/src/main/java/dev/relism/ext/openapi/OpenApiSecurityRegistry.java
@@ -7,7 +7,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
/**
* Mutable registry of {@link OpenApiSecurityContributor}s.
*
- *
Created and provided to the {@link dev.relism.extension.ExtensionContext} by
+ *
Created and provided to the {@link dev.relism.extension.FlashContext} by
* {@link OpenApiExtension} at install time. Other extensions (e.g. {@code flash-ext-oidc})
* retrieve it via {@code ctx.find(OpenApiSecurityRegistry.class)} and register their
* contributor — the OpenAPI extension then picks it up lazily at spec-generation time.
diff --git a/flash-extensions/flash-ext-routeviewer/routeviewer-ui/pnpm-lock.yaml b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/pnpm-lock.yaml
new file mode 100644
index 0000000..2554816
--- /dev/null
+++ b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/pnpm-lock.yaml
@@ -0,0 +1,1233 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ dependencies:
+ '@dagrejs/dagre':
+ specifier: ^1.1.4
+ version: 1.1.8
+ '@xyflow/react':
+ specifier: ^12.3.6
+ version: 12.10.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ html-to-image:
+ specifier: ^1.11.11
+ version: 1.11.13
+ react:
+ specifier: ^18.3.1
+ version: 18.3.1
+ react-dom:
+ specifier: ^18.3.1
+ version: 18.3.1(react@18.3.1)
+ devDependencies:
+ '@vitejs/plugin-react':
+ specifier: ^4.3.1
+ version: 4.7.0(vite@5.4.21)
+ vite:
+ specifier: ^5.4.11
+ version: 5.4.21
+
+packages:
+
+ '@babel/code-frame@7.29.0':
+ resolution: {integrity: sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/compat-data@7.29.0':
+ resolution: {integrity: sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/core@7.29.0':
+ resolution: {integrity: sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/generator@7.29.1':
+ resolution: {integrity: sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-compilation-targets@7.28.6':
+ resolution: {integrity: sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-globals@7.28.0':
+ resolution: {integrity: sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-module-imports@7.28.6':
+ resolution: {integrity: sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-module-transforms@7.28.6':
+ resolution: {integrity: sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0
+
+ '@babel/helper-plugin-utils@7.28.6':
+ resolution: {integrity: sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-string-parser@7.27.1':
+ resolution: {integrity: sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-validator-identifier@7.28.5':
+ resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-validator-option@7.27.1':
+ resolution: {integrity: sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helpers@7.29.2':
+ resolution: {integrity: sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/parser@7.29.2':
+ resolution: {integrity: sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==}
+ engines: {node: '>=6.0.0'}
+ hasBin: true
+
+ '@babel/plugin-transform-react-jsx-self@7.27.1':
+ resolution: {integrity: sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/plugin-transform-react-jsx-source@7.27.1':
+ resolution: {integrity: sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/template@7.28.6':
+ resolution: {integrity: sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/traverse@7.29.0':
+ resolution: {integrity: sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/types@7.29.0':
+ resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
+ engines: {node: '>=6.9.0'}
+
+ '@dagrejs/dagre@1.1.8':
+ resolution: {integrity: sha512-5SEDlndt4W/LaVzPYJW+bSmSEZc9EzTf8rJ20WCKvjS5EAZAN0b+x0Yww7VMT4R3Wootkg+X9bUfUxazYw6Blw==}
+
+ '@dagrejs/graphlib@2.2.4':
+ resolution: {integrity: sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==}
+ engines: {node: '>17.0.0'}
+
+ '@esbuild/aix-ppc64@0.21.5':
+ resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}
+ engines: {node: '>=12'}
+ cpu: [ppc64]
+ os: [aix]
+
+ '@esbuild/android-arm64@0.21.5':
+ resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [android]
+
+ '@esbuild/android-arm@0.21.5':
+ resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}
+ engines: {node: '>=12'}
+ cpu: [arm]
+ os: [android]
+
+ '@esbuild/android-x64@0.21.5':
+ resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [android]
+
+ '@esbuild/darwin-arm64@0.21.5':
+ resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@esbuild/darwin-x64@0.21.5':
+ resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@esbuild/freebsd-arm64@0.21.5':
+ resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [freebsd]
+
+ '@esbuild/freebsd-x64@0.21.5':
+ resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@esbuild/linux-arm64@0.21.5':
+ resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@esbuild/linux-arm@0.21.5':
+ resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}
+ engines: {node: '>=12'}
+ cpu: [arm]
+ os: [linux]
+
+ '@esbuild/linux-ia32@0.21.5':
+ resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [linux]
+
+ '@esbuild/linux-loong64@0.21.5':
+ resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}
+ engines: {node: '>=12'}
+ cpu: [loong64]
+ os: [linux]
+
+ '@esbuild/linux-mips64el@0.21.5':
+ resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}
+ engines: {node: '>=12'}
+ cpu: [mips64el]
+ os: [linux]
+
+ '@esbuild/linux-ppc64@0.21.5':
+ resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}
+ engines: {node: '>=12'}
+ cpu: [ppc64]
+ os: [linux]
+
+ '@esbuild/linux-riscv64@0.21.5':
+ resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}
+ engines: {node: '>=12'}
+ cpu: [riscv64]
+ os: [linux]
+
+ '@esbuild/linux-s390x@0.21.5':
+ resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}
+ engines: {node: '>=12'}
+ cpu: [s390x]
+ os: [linux]
+
+ '@esbuild/linux-x64@0.21.5':
+ resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [linux]
+
+ '@esbuild/netbsd-x64@0.21.5':
+ resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [netbsd]
+
+ '@esbuild/openbsd-x64@0.21.5':
+ resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [openbsd]
+
+ '@esbuild/sunos-x64@0.21.5':
+ resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [sunos]
+
+ '@esbuild/win32-arm64@0.21.5':
+ resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}
+ engines: {node: '>=12'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@esbuild/win32-ia32@0.21.5':
+ resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}
+ engines: {node: '>=12'}
+ cpu: [ia32]
+ os: [win32]
+
+ '@esbuild/win32-x64@0.21.5':
+ resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}
+ engines: {node: '>=12'}
+ cpu: [x64]
+ os: [win32]
+
+ '@jridgewell/gen-mapping@0.3.13':
+ resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
+
+ '@jridgewell/remapping@2.3.5':
+ resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==}
+
+ '@jridgewell/resolve-uri@3.1.2':
+ resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
+ engines: {node: '>=6.0.0'}
+
+ '@jridgewell/sourcemap-codec@1.5.5':
+ resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
+
+ '@jridgewell/trace-mapping@0.3.31':
+ resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
+
+ '@rolldown/pluginutils@1.0.0-beta.27':
+ resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==}
+
+ '@rollup/rollup-android-arm-eabi@4.60.0':
+ resolution: {integrity: sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A==}
+ cpu: [arm]
+ os: [android]
+
+ '@rollup/rollup-android-arm64@4.60.0':
+ resolution: {integrity: sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw==}
+ cpu: [arm64]
+ os: [android]
+
+ '@rollup/rollup-darwin-arm64@4.60.0':
+ resolution: {integrity: sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@rollup/rollup-darwin-x64@4.60.0':
+ resolution: {integrity: sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@rollup/rollup-freebsd-arm64@4.60.0':
+ resolution: {integrity: sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw==}
+ cpu: [arm64]
+ os: [freebsd]
+
+ '@rollup/rollup-freebsd-x64@4.60.0':
+ resolution: {integrity: sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA==}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@rollup/rollup-linux-arm-gnueabihf@4.60.0':
+ resolution: {integrity: sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g==}
+ cpu: [arm]
+ os: [linux]
+
+ '@rollup/rollup-linux-arm-musleabihf@4.60.0':
+ resolution: {integrity: sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ==}
+ cpu: [arm]
+ os: [linux]
+
+ '@rollup/rollup-linux-arm64-gnu@4.60.0':
+ resolution: {integrity: sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@rollup/rollup-linux-arm64-musl@4.60.0':
+ resolution: {integrity: sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ==}
+ cpu: [arm64]
+ os: [linux]
+
+ '@rollup/rollup-linux-loong64-gnu@4.60.0':
+ resolution: {integrity: sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw==}
+ cpu: [loong64]
+ os: [linux]
+
+ '@rollup/rollup-linux-loong64-musl@4.60.0':
+ resolution: {integrity: sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog==}
+ cpu: [loong64]
+ os: [linux]
+
+ '@rollup/rollup-linux-ppc64-gnu@4.60.0':
+ resolution: {integrity: sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ==}
+ cpu: [ppc64]
+ os: [linux]
+
+ '@rollup/rollup-linux-ppc64-musl@4.60.0':
+ resolution: {integrity: sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg==}
+ cpu: [ppc64]
+ os: [linux]
+
+ '@rollup/rollup-linux-riscv64-gnu@4.60.0':
+ resolution: {integrity: sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA==}
+ cpu: [riscv64]
+ os: [linux]
+
+ '@rollup/rollup-linux-riscv64-musl@4.60.0':
+ resolution: {integrity: sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ==}
+ cpu: [riscv64]
+ os: [linux]
+
+ '@rollup/rollup-linux-s390x-gnu@4.60.0':
+ resolution: {integrity: sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ==}
+ cpu: [s390x]
+ os: [linux]
+
+ '@rollup/rollup-linux-x64-gnu@4.60.0':
+ resolution: {integrity: sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg==}
+ cpu: [x64]
+ os: [linux]
+
+ '@rollup/rollup-linux-x64-musl@4.60.0':
+ resolution: {integrity: sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw==}
+ cpu: [x64]
+ os: [linux]
+
+ '@rollup/rollup-openbsd-x64@4.60.0':
+ resolution: {integrity: sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw==}
+ cpu: [x64]
+ os: [openbsd]
+
+ '@rollup/rollup-openharmony-arm64@4.60.0':
+ resolution: {integrity: sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA==}
+ cpu: [arm64]
+ os: [openharmony]
+
+ '@rollup/rollup-win32-arm64-msvc@4.60.0':
+ resolution: {integrity: sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@rollup/rollup-win32-ia32-msvc@4.60.0':
+ resolution: {integrity: sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w==}
+ cpu: [ia32]
+ os: [win32]
+
+ '@rollup/rollup-win32-x64-gnu@4.60.0':
+ resolution: {integrity: sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==}
+ cpu: [x64]
+ os: [win32]
+
+ '@rollup/rollup-win32-x64-msvc@4.60.0':
+ resolution: {integrity: sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==}
+ cpu: [x64]
+ os: [win32]
+
+ '@types/babel__core@7.20.5':
+ resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}
+
+ '@types/babel__generator@7.27.0':
+ resolution: {integrity: sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==}
+
+ '@types/babel__template@7.4.4':
+ resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==}
+
+ '@types/babel__traverse@7.28.0':
+ resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}
+
+ '@types/d3-color@3.1.3':
+ resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
+
+ '@types/d3-drag@3.0.7':
+ resolution: {integrity: sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==}
+
+ '@types/d3-interpolate@3.0.4':
+ resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==}
+
+ '@types/d3-selection@3.0.11':
+ resolution: {integrity: sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w==}
+
+ '@types/d3-transition@3.0.9':
+ resolution: {integrity: sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg==}
+
+ '@types/d3-zoom@3.0.8':
+ resolution: {integrity: sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==}
+
+ '@types/estree@1.0.8':
+ resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}
+
+ '@vitejs/plugin-react@4.7.0':
+ resolution: {integrity: sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+ peerDependencies:
+ vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
+
+ '@xyflow/react@12.10.1':
+ resolution: {integrity: sha512-5eSWtIK/+rkldOuFbOOz44CRgQRjtS9v5nufk77DV+XBnfCGL9HAQ8PG00o2ZYKqkEU/Ak6wrKC95Tu+2zuK3Q==}
+ peerDependencies:
+ react: '>=17'
+ react-dom: '>=17'
+
+ '@xyflow/system@0.0.75':
+ resolution: {integrity: sha512-iXs+AGFLi8w/VlAoc/iSxk+CxfT6o64Uw/k0CKASOPqjqz6E0rb5jFZgJtXGZCpfQI6OQpu5EnumP5fGxQheaQ==}
+
+ baseline-browser-mapping@2.10.11:
+ resolution: {integrity: sha512-DAKrHphkJyiGuau/cFieRYhcTFeK/lBuD++C7cZ6KZHbMhBrisoi+EvhQ5RZrIfV5qwsW8kgQ07JIC+MDJRAhg==}
+ engines: {node: '>=6.0.0'}
+ hasBin: true
+
+ browserslist@4.28.1:
+ resolution: {integrity: sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==}
+ engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
+ hasBin: true
+
+ caniuse-lite@1.0.30001781:
+ resolution: {integrity: sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==}
+
+ classcat@5.0.5:
+ resolution: {integrity: sha512-JhZUT7JFcQy/EzW605k/ktHtncoo9vnyW/2GspNYwFlN1C/WmjuV/xtS04e9SOkL2sTdw0VAZ2UGCcQ9lR6p6w==}
+
+ convert-source-map@2.0.0:
+ resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
+
+ d3-color@3.1.0:
+ resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
+ engines: {node: '>=12'}
+
+ d3-dispatch@3.0.1:
+ resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==}
+ engines: {node: '>=12'}
+
+ d3-drag@3.0.0:
+ resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==}
+ engines: {node: '>=12'}
+
+ d3-ease@3.0.1:
+ resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}
+ engines: {node: '>=12'}
+
+ d3-interpolate@3.0.1:
+ resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
+ engines: {node: '>=12'}
+
+ d3-selection@3.0.0:
+ resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==}
+ engines: {node: '>=12'}
+
+ d3-timer@3.0.1:
+ resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}
+ engines: {node: '>=12'}
+
+ d3-transition@3.0.1:
+ resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==}
+ engines: {node: '>=12'}
+ peerDependencies:
+ d3-selection: 2 - 3
+
+ d3-zoom@3.0.0:
+ resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==}
+ engines: {node: '>=12'}
+
+ debug@4.4.3:
+ resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
+ engines: {node: '>=6.0'}
+ peerDependencies:
+ supports-color: '*'
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+
+ electron-to-chromium@1.5.326:
+ resolution: {integrity: sha512-uRBlUfKKdsXMkiiOurgaybNC10tjrD+skXLEg7NHbm6h0uAoqj3xMb9uue5BfcSCXJ4mcyJMOucI6q55D7p6KQ==}
+
+ esbuild@0.21.5:
+ resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}
+ engines: {node: '>=12'}
+ hasBin: true
+
+ escalade@3.2.0:
+ resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
+ engines: {node: '>=6'}
+
+ fsevents@2.3.3:
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+
+ gensync@1.0.0-beta.2:
+ resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
+ engines: {node: '>=6.9.0'}
+
+ html-to-image@1.11.13:
+ resolution: {integrity: sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==}
+
+ js-tokens@4.0.0:
+ resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+
+ jsesc@3.1.0:
+ resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}
+ engines: {node: '>=6'}
+ hasBin: true
+
+ json5@2.2.3:
+ resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
+ engines: {node: '>=6'}
+ hasBin: true
+
+ loose-envify@1.4.0:
+ resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
+ hasBin: true
+
+ lru-cache@5.1.1:
+ resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
+
+ ms@2.1.3:
+ resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
+
+ nanoid@3.3.11:
+ resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
+ hasBin: true
+
+ node-releases@2.0.36:
+ resolution: {integrity: sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==}
+
+ picocolors@1.1.1:
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+
+ postcss@8.5.8:
+ resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==}
+ engines: {node: ^10 || ^12 || >=14}
+
+ react-dom@18.3.1:
+ resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
+ peerDependencies:
+ react: ^18.3.1
+
+ react-refresh@0.17.0:
+ resolution: {integrity: sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==}
+ engines: {node: '>=0.10.0'}
+
+ react@18.3.1:
+ resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
+ engines: {node: '>=0.10.0'}
+
+ rollup@4.60.0:
+ resolution: {integrity: sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==}
+ engines: {node: '>=18.0.0', npm: '>=8.0.0'}
+ hasBin: true
+
+ scheduler@0.23.2:
+ resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
+
+ semver@6.3.1:
+ resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
+ hasBin: true
+
+ source-map-js@1.2.1:
+ resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
+ engines: {node: '>=0.10.0'}
+
+ update-browserslist-db@1.2.3:
+ resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==}
+ hasBin: true
+ peerDependencies:
+ browserslist: '>= 4.21.0'
+
+ use-sync-external-store@1.6.0:
+ resolution: {integrity: sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
+ vite@5.4.21:
+ resolution: {integrity: sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ hasBin: true
+ peerDependencies:
+ '@types/node': ^18.0.0 || >=20.0.0
+ less: '*'
+ lightningcss: ^1.21.0
+ sass: '*'
+ sass-embedded: '*'
+ stylus: '*'
+ sugarss: '*'
+ terser: ^5.4.0
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+ less:
+ optional: true
+ lightningcss:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+
+ yallist@3.1.1:
+ resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
+
+ zustand@4.5.7:
+ resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==}
+ engines: {node: '>=12.7.0'}
+ peerDependencies:
+ '@types/react': '>=16.8'
+ immer: '>=9.0.6'
+ react: '>=16.8'
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ immer:
+ optional: true
+ react:
+ optional: true
+
+snapshots:
+
+ '@babel/code-frame@7.29.0':
+ dependencies:
+ '@babel/helper-validator-identifier': 7.28.5
+ js-tokens: 4.0.0
+ picocolors: 1.1.1
+
+ '@babel/compat-data@7.29.0': {}
+
+ '@babel/core@7.29.0':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/generator': 7.29.1
+ '@babel/helper-compilation-targets': 7.28.6
+ '@babel/helper-module-transforms': 7.28.6(@babel/core@7.29.0)
+ '@babel/helpers': 7.29.2
+ '@babel/parser': 7.29.2
+ '@babel/template': 7.28.6
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
+ '@jridgewell/remapping': 2.3.5
+ convert-source-map: 2.0.0
+ debug: 4.4.3
+ gensync: 1.0.0-beta.2
+ json5: 2.2.3
+ semver: 6.3.1
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/generator@7.29.1':
+ dependencies:
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+ '@jridgewell/gen-mapping': 0.3.13
+ '@jridgewell/trace-mapping': 0.3.31
+ jsesc: 3.1.0
+
+ '@babel/helper-compilation-targets@7.28.6':
+ dependencies:
+ '@babel/compat-data': 7.29.0
+ '@babel/helper-validator-option': 7.27.1
+ browserslist: 4.28.1
+ lru-cache: 5.1.1
+ semver: 6.3.1
+
+ '@babel/helper-globals@7.28.0': {}
+
+ '@babel/helper-module-imports@7.28.6':
+ dependencies:
+ '@babel/traverse': 7.29.0
+ '@babel/types': 7.29.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/helper-module-transforms@7.28.6(@babel/core@7.29.0)':
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-module-imports': 7.28.6
+ '@babel/helper-validator-identifier': 7.28.5
+ '@babel/traverse': 7.29.0
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/helper-plugin-utils@7.28.6': {}
+
+ '@babel/helper-string-parser@7.27.1': {}
+
+ '@babel/helper-validator-identifier@7.28.5': {}
+
+ '@babel/helper-validator-option@7.27.1': {}
+
+ '@babel/helpers@7.29.2':
+ dependencies:
+ '@babel/template': 7.28.6
+ '@babel/types': 7.29.0
+
+ '@babel/parser@7.29.2':
+ dependencies:
+ '@babel/types': 7.29.0
+
+ '@babel/plugin-transform-react-jsx-self@7.27.1(@babel/core@7.29.0)':
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-plugin-utils': 7.28.6
+
+ '@babel/plugin-transform-react-jsx-source@7.27.1(@babel/core@7.29.0)':
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/helper-plugin-utils': 7.28.6
+
+ '@babel/template@7.28.6':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+
+ '@babel/traverse@7.29.0':
+ dependencies:
+ '@babel/code-frame': 7.29.0
+ '@babel/generator': 7.29.1
+ '@babel/helper-globals': 7.28.0
+ '@babel/parser': 7.29.2
+ '@babel/template': 7.28.6
+ '@babel/types': 7.29.0
+ debug: 4.4.3
+ transitivePeerDependencies:
+ - supports-color
+
+ '@babel/types@7.29.0':
+ dependencies:
+ '@babel/helper-string-parser': 7.27.1
+ '@babel/helper-validator-identifier': 7.28.5
+
+ '@dagrejs/dagre@1.1.8':
+ dependencies:
+ '@dagrejs/graphlib': 2.2.4
+
+ '@dagrejs/graphlib@2.2.4': {}
+
+ '@esbuild/aix-ppc64@0.21.5':
+ optional: true
+
+ '@esbuild/android-arm64@0.21.5':
+ optional: true
+
+ '@esbuild/android-arm@0.21.5':
+ optional: true
+
+ '@esbuild/android-x64@0.21.5':
+ optional: true
+
+ '@esbuild/darwin-arm64@0.21.5':
+ optional: true
+
+ '@esbuild/darwin-x64@0.21.5':
+ optional: true
+
+ '@esbuild/freebsd-arm64@0.21.5':
+ optional: true
+
+ '@esbuild/freebsd-x64@0.21.5':
+ optional: true
+
+ '@esbuild/linux-arm64@0.21.5':
+ optional: true
+
+ '@esbuild/linux-arm@0.21.5':
+ optional: true
+
+ '@esbuild/linux-ia32@0.21.5':
+ optional: true
+
+ '@esbuild/linux-loong64@0.21.5':
+ optional: true
+
+ '@esbuild/linux-mips64el@0.21.5':
+ optional: true
+
+ '@esbuild/linux-ppc64@0.21.5':
+ optional: true
+
+ '@esbuild/linux-riscv64@0.21.5':
+ optional: true
+
+ '@esbuild/linux-s390x@0.21.5':
+ optional: true
+
+ '@esbuild/linux-x64@0.21.5':
+ optional: true
+
+ '@esbuild/netbsd-x64@0.21.5':
+ optional: true
+
+ '@esbuild/openbsd-x64@0.21.5':
+ optional: true
+
+ '@esbuild/sunos-x64@0.21.5':
+ optional: true
+
+ '@esbuild/win32-arm64@0.21.5':
+ optional: true
+
+ '@esbuild/win32-ia32@0.21.5':
+ optional: true
+
+ '@esbuild/win32-x64@0.21.5':
+ optional: true
+
+ '@jridgewell/gen-mapping@0.3.13':
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.5.5
+ '@jridgewell/trace-mapping': 0.3.31
+
+ '@jridgewell/remapping@2.3.5':
+ dependencies:
+ '@jridgewell/gen-mapping': 0.3.13
+ '@jridgewell/trace-mapping': 0.3.31
+
+ '@jridgewell/resolve-uri@3.1.2': {}
+
+ '@jridgewell/sourcemap-codec@1.5.5': {}
+
+ '@jridgewell/trace-mapping@0.3.31':
+ dependencies:
+ '@jridgewell/resolve-uri': 3.1.2
+ '@jridgewell/sourcemap-codec': 1.5.5
+
+ '@rolldown/pluginutils@1.0.0-beta.27': {}
+
+ '@rollup/rollup-android-arm-eabi@4.60.0':
+ optional: true
+
+ '@rollup/rollup-android-arm64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-darwin-arm64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-darwin-x64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-freebsd-arm64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-freebsd-x64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-arm-gnueabihf@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-arm-musleabihf@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-arm64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-arm64-musl@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-loong64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-loong64-musl@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-ppc64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-ppc64-musl@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-riscv64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-riscv64-musl@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-s390x-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-x64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-linux-x64-musl@4.60.0':
+ optional: true
+
+ '@rollup/rollup-openbsd-x64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-openharmony-arm64@4.60.0':
+ optional: true
+
+ '@rollup/rollup-win32-arm64-msvc@4.60.0':
+ optional: true
+
+ '@rollup/rollup-win32-ia32-msvc@4.60.0':
+ optional: true
+
+ '@rollup/rollup-win32-x64-gnu@4.60.0':
+ optional: true
+
+ '@rollup/rollup-win32-x64-msvc@4.60.0':
+ optional: true
+
+ '@types/babel__core@7.20.5':
+ dependencies:
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+ '@types/babel__generator': 7.27.0
+ '@types/babel__template': 7.4.4
+ '@types/babel__traverse': 7.28.0
+
+ '@types/babel__generator@7.27.0':
+ dependencies:
+ '@babel/types': 7.29.0
+
+ '@types/babel__template@7.4.4':
+ dependencies:
+ '@babel/parser': 7.29.2
+ '@babel/types': 7.29.0
+
+ '@types/babel__traverse@7.28.0':
+ dependencies:
+ '@babel/types': 7.29.0
+
+ '@types/d3-color@3.1.3': {}
+
+ '@types/d3-drag@3.0.7':
+ dependencies:
+ '@types/d3-selection': 3.0.11
+
+ '@types/d3-interpolate@3.0.4':
+ dependencies:
+ '@types/d3-color': 3.1.3
+
+ '@types/d3-selection@3.0.11': {}
+
+ '@types/d3-transition@3.0.9':
+ dependencies:
+ '@types/d3-selection': 3.0.11
+
+ '@types/d3-zoom@3.0.8':
+ dependencies:
+ '@types/d3-interpolate': 3.0.4
+ '@types/d3-selection': 3.0.11
+
+ '@types/estree@1.0.8': {}
+
+ '@vitejs/plugin-react@4.7.0(vite@5.4.21)':
+ dependencies:
+ '@babel/core': 7.29.0
+ '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.29.0)
+ '@babel/plugin-transform-react-jsx-source': 7.27.1(@babel/core@7.29.0)
+ '@rolldown/pluginutils': 1.0.0-beta.27
+ '@types/babel__core': 7.20.5
+ react-refresh: 0.17.0
+ vite: 5.4.21
+ transitivePeerDependencies:
+ - supports-color
+
+ '@xyflow/react@12.10.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
+ dependencies:
+ '@xyflow/system': 0.0.75
+ classcat: 5.0.5
+ react: 18.3.1
+ react-dom: 18.3.1(react@18.3.1)
+ zustand: 4.5.7(react@18.3.1)
+ transitivePeerDependencies:
+ - '@types/react'
+ - immer
+
+ '@xyflow/system@0.0.75':
+ dependencies:
+ '@types/d3-drag': 3.0.7
+ '@types/d3-interpolate': 3.0.4
+ '@types/d3-selection': 3.0.11
+ '@types/d3-transition': 3.0.9
+ '@types/d3-zoom': 3.0.8
+ d3-drag: 3.0.0
+ d3-interpolate: 3.0.1
+ d3-selection: 3.0.0
+ d3-zoom: 3.0.0
+
+ baseline-browser-mapping@2.10.11: {}
+
+ browserslist@4.28.1:
+ dependencies:
+ baseline-browser-mapping: 2.10.11
+ caniuse-lite: 1.0.30001781
+ electron-to-chromium: 1.5.326
+ node-releases: 2.0.36
+ update-browserslist-db: 1.2.3(browserslist@4.28.1)
+
+ caniuse-lite@1.0.30001781: {}
+
+ classcat@5.0.5: {}
+
+ convert-source-map@2.0.0: {}
+
+ d3-color@3.1.0: {}
+
+ d3-dispatch@3.0.1: {}
+
+ d3-drag@3.0.0:
+ dependencies:
+ d3-dispatch: 3.0.1
+ d3-selection: 3.0.0
+
+ d3-ease@3.0.1: {}
+
+ d3-interpolate@3.0.1:
+ dependencies:
+ d3-color: 3.1.0
+
+ d3-selection@3.0.0: {}
+
+ d3-timer@3.0.1: {}
+
+ d3-transition@3.0.1(d3-selection@3.0.0):
+ dependencies:
+ d3-color: 3.1.0
+ d3-dispatch: 3.0.1
+ d3-ease: 3.0.1
+ d3-interpolate: 3.0.1
+ d3-selection: 3.0.0
+ d3-timer: 3.0.1
+
+ d3-zoom@3.0.0:
+ dependencies:
+ d3-dispatch: 3.0.1
+ d3-drag: 3.0.0
+ d3-interpolate: 3.0.1
+ d3-selection: 3.0.0
+ d3-transition: 3.0.1(d3-selection@3.0.0)
+
+ debug@4.4.3:
+ dependencies:
+ ms: 2.1.3
+
+ electron-to-chromium@1.5.326: {}
+
+ esbuild@0.21.5:
+ optionalDependencies:
+ '@esbuild/aix-ppc64': 0.21.5
+ '@esbuild/android-arm': 0.21.5
+ '@esbuild/android-arm64': 0.21.5
+ '@esbuild/android-x64': 0.21.5
+ '@esbuild/darwin-arm64': 0.21.5
+ '@esbuild/darwin-x64': 0.21.5
+ '@esbuild/freebsd-arm64': 0.21.5
+ '@esbuild/freebsd-x64': 0.21.5
+ '@esbuild/linux-arm': 0.21.5
+ '@esbuild/linux-arm64': 0.21.5
+ '@esbuild/linux-ia32': 0.21.5
+ '@esbuild/linux-loong64': 0.21.5
+ '@esbuild/linux-mips64el': 0.21.5
+ '@esbuild/linux-ppc64': 0.21.5
+ '@esbuild/linux-riscv64': 0.21.5
+ '@esbuild/linux-s390x': 0.21.5
+ '@esbuild/linux-x64': 0.21.5
+ '@esbuild/netbsd-x64': 0.21.5
+ '@esbuild/openbsd-x64': 0.21.5
+ '@esbuild/sunos-x64': 0.21.5
+ '@esbuild/win32-arm64': 0.21.5
+ '@esbuild/win32-ia32': 0.21.5
+ '@esbuild/win32-x64': 0.21.5
+
+ escalade@3.2.0: {}
+
+ fsevents@2.3.3:
+ optional: true
+
+ gensync@1.0.0-beta.2: {}
+
+ html-to-image@1.11.13: {}
+
+ js-tokens@4.0.0: {}
+
+ jsesc@3.1.0: {}
+
+ json5@2.2.3: {}
+
+ loose-envify@1.4.0:
+ dependencies:
+ js-tokens: 4.0.0
+
+ lru-cache@5.1.1:
+ dependencies:
+ yallist: 3.1.1
+
+ ms@2.1.3: {}
+
+ nanoid@3.3.11: {}
+
+ node-releases@2.0.36: {}
+
+ picocolors@1.1.1: {}
+
+ postcss@8.5.8:
+ dependencies:
+ nanoid: 3.3.11
+ picocolors: 1.1.1
+ source-map-js: 1.2.1
+
+ react-dom@18.3.1(react@18.3.1):
+ dependencies:
+ loose-envify: 1.4.0
+ react: 18.3.1
+ scheduler: 0.23.2
+
+ react-refresh@0.17.0: {}
+
+ react@18.3.1:
+ dependencies:
+ loose-envify: 1.4.0
+
+ rollup@4.60.0:
+ dependencies:
+ '@types/estree': 1.0.8
+ optionalDependencies:
+ '@rollup/rollup-android-arm-eabi': 4.60.0
+ '@rollup/rollup-android-arm64': 4.60.0
+ '@rollup/rollup-darwin-arm64': 4.60.0
+ '@rollup/rollup-darwin-x64': 4.60.0
+ '@rollup/rollup-freebsd-arm64': 4.60.0
+ '@rollup/rollup-freebsd-x64': 4.60.0
+ '@rollup/rollup-linux-arm-gnueabihf': 4.60.0
+ '@rollup/rollup-linux-arm-musleabihf': 4.60.0
+ '@rollup/rollup-linux-arm64-gnu': 4.60.0
+ '@rollup/rollup-linux-arm64-musl': 4.60.0
+ '@rollup/rollup-linux-loong64-gnu': 4.60.0
+ '@rollup/rollup-linux-loong64-musl': 4.60.0
+ '@rollup/rollup-linux-ppc64-gnu': 4.60.0
+ '@rollup/rollup-linux-ppc64-musl': 4.60.0
+ '@rollup/rollup-linux-riscv64-gnu': 4.60.0
+ '@rollup/rollup-linux-riscv64-musl': 4.60.0
+ '@rollup/rollup-linux-s390x-gnu': 4.60.0
+ '@rollup/rollup-linux-x64-gnu': 4.60.0
+ '@rollup/rollup-linux-x64-musl': 4.60.0
+ '@rollup/rollup-openbsd-x64': 4.60.0
+ '@rollup/rollup-openharmony-arm64': 4.60.0
+ '@rollup/rollup-win32-arm64-msvc': 4.60.0
+ '@rollup/rollup-win32-ia32-msvc': 4.60.0
+ '@rollup/rollup-win32-x64-gnu': 4.60.0
+ '@rollup/rollup-win32-x64-msvc': 4.60.0
+ fsevents: 2.3.3
+
+ scheduler@0.23.2:
+ dependencies:
+ loose-envify: 1.4.0
+
+ semver@6.3.1: {}
+
+ source-map-js@1.2.1: {}
+
+ update-browserslist-db@1.2.3(browserslist@4.28.1):
+ dependencies:
+ browserslist: 4.28.1
+ escalade: 3.2.0
+ picocolors: 1.1.1
+
+ use-sync-external-store@1.6.0(react@18.3.1):
+ dependencies:
+ react: 18.3.1
+
+ vite@5.4.21:
+ dependencies:
+ esbuild: 0.21.5
+ postcss: 8.5.8
+ rollup: 4.60.0
+ optionalDependencies:
+ fsevents: 2.3.3
+
+ yallist@3.1.1: {}
+
+ zustand@4.5.7(react@18.3.1):
+ dependencies:
+ use-sync-external-store: 1.6.0(react@18.3.1)
+ optionalDependencies:
+ react: 18.3.1
diff --git a/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/layout.js b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/layout.js
index aa946ea..a68b323 100644
--- a/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/layout.js
+++ b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/layout.js
@@ -16,7 +16,7 @@ const ROOT_GAP = 48 // vertical gap between independent subtrees (different
const MARGIN_X = 60
const MARGIN_Y = 60
-const ABSTRACT_W = 160
+const ABSTRACT_W = 220
const ABSTRACT_H = 50
const CONCRETE_W = 260
const LAMBDA_W = 230
diff --git a/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/nodes/HandlerNode.jsx b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/nodes/HandlerNode.jsx
index 338c720..9402359 100644
--- a/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/nodes/HandlerNode.jsx
+++ b/flash-extensions/flash-ext-routeviewer/routeviewer-ui/src/nodes/HandlerNode.jsx
@@ -1,5 +1,11 @@
import { Handle, Position } from '@xyflow/react'
+// Invisible handles — React Flow needs them as edge anchor points,
+// but they must not appear as interactive dots in the read-only graph.
+const HANDLE_STYLE = { opacity: 0, width: 6, height: 6, pointerEvents: 'none', border: 'none', background: 'transparent' }
+const TARGET_HANDLE =
+const SOURCE_HANDLE =
+
const METHOD_COLORS = {
GET: { bg: '#0d4429', color: '#4ade80' },
POST: { bg: '#172554', color: '#60a5fa' },
@@ -10,15 +16,17 @@ const METHOD_COLORS = {
HEAD: { bg: '#1c1917', color: '#a8a29e' },
}
-// Handles for LR layout: parent flows in from the LEFT, children exit to the RIGHT
-const TARGET_HANDLE =
-const SOURCE_HANDLE =
+// Shared truncation style — applied to any single-line text that can overflow.
+const TRUNCATE = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+}
/**
* Unified handler node — three modes: ABSTRACT, CONCRETE, LAMBDA.
- * Handles are Left (in) / Right (out) for Left-to-Right DAG layout.
+ * No connection handles: the graph is a read-only visualisation.
+ * Text is clamped to the node width and truncated with an ellipsis.
*/
export default function HandlerNode({ data, selected }) {
@@ -30,16 +38,17 @@ export default function HandlerNode({ data, selected }) {
border: selected ? '2px solid #60a5fa' : '1px solid #ef4444',
borderRadius: 8,
padding: '8px 14px',
- width: 160,
- fontFamily: 'system-ui, sans-serif',
+ width: 220,
+ overflow: 'hidden',
boxSizing: 'border-box',
+ fontFamily: 'system-ui, sans-serif',
}}>
{TARGET_HANDLE}
{SOURCE_HANDLE}
ABSTRACT
-
@@ -48,9 +57,9 @@ export default function HandlerNode({ data, selected }) {
// ── LAMBDA ────────────────────────────────────────────────────────────
if (data.isLambda) {
- const method = data.method || 'GET'
- const path = data.path || '/'
- const m = METHOD_COLORS[method] || METHOD_COLORS.OPTIONS
+ const method = data.method || 'GET'
+ const path = data.path || '/'
+ const m = METHOD_COLORS[method] || METHOD_COLORS.OPTIONS
const pathHtml = path.replace(/\{([^}]+)\}/g, '{$1}')
return (
@@ -60,15 +69,16 @@ export default function HandlerNode({ data, selected }) {
borderRadius: 8,
padding: '10px 12px',
width: 230,
- fontFamily: 'system-ui, sans-serif',
+ overflow: 'hidden',
boxSizing: 'border-box',
+ fontFamily: 'system-ui, sans-serif',
}}>
{TARGET_HANDLE}
{SOURCE_HANDLE}
LAMBDA
-
+
@@ -88,6 +98,7 @@ export default function HandlerNode({ data, selected }) {
background: '#1f1a0e', color: '#f6ad55',
fontSize: 8, fontWeight: 600, padding: '1px 4px',
borderRadius: 2, fontFamily: 'monospace',
+ ...TRUNCATE, maxWidth: '100%',
}}>{mw}
))}
@@ -104,18 +115,18 @@ export default function HandlerNode({ data, selected }) {
borderRadius: 8,
padding: '10px 12px',
width: 260,
- fontFamily: 'system-ui, sans-serif',
+ overflow: 'hidden',
boxSizing: 'border-box',
+ fontFamily: 'system-ui, sans-serif',
}}>
{TARGET_HANDLE}
{SOURCE_HANDLE}
-
{/* Header */}
HANDLER
-
@@ -125,7 +136,7 @@ export default function HandlerNode({ data, selected }) {
{/* Routes */}
0 ? 8 : 0 }}>
{data.routes?.map((route, i) => {
- const m = METHOD_COLORS[route.method] || METHOD_COLORS.OPTIONS
+ const m = METHOD_COLORS[route.method] || METHOD_COLORS.OPTIONS
const pathHtml = (route.path || '/').replace(
/\{([^}]+)\}/g,
'
{$1}'
@@ -134,6 +145,7 @@ export default function HandlerNode({ data, selected }) {
@@ -159,6 +171,7 @@ export default function HandlerNode({ data, selected }) {
background: '#1f1a0e', color: '#f6ad55',
fontSize: 8, fontWeight: 600, padding: '1px 4px',
borderRadius: 2, fontFamily: 'monospace',
+ ...TRUNCATE, maxWidth: '100%',
}}>{mw}
))}
diff --git a/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/RouteViewerExtension.java b/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/RouteViewerExtension.java
index 8675c4b..60ad14a 100644
--- a/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/RouteViewerExtension.java
+++ b/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/RouteViewerExtension.java
@@ -1,7 +1,7 @@
package dev.relism.ext.routeviewer;
import dev.relism.ext.routeviewer.model.RouteGraph;
-import dev.relism.extension.ExtensionContext;
+import dev.relism.extension.FlashContext;
import dev.relism.extension.FlashExtension;
import dev.relism.extension.FlashRegistrar;
import dev.relism.http.ContentType;
@@ -36,7 +36,7 @@ import dev.relism.http.ContentType;
* }
*
*
All route metadata is collected once at boot time via
- * {@link ExtensionContext#addRouteListener}. Zero overhead on the request hot-path.
+ * {@link FlashContext#addRouteListener}. Zero overhead on the request hot-path.
*/
public class RouteViewerExtension implements FlashExtension {
@@ -55,7 +55,7 @@ public class RouteViewerExtension implements FlashExtension {
public RouteViewerExtension(String path) { this.path = path; }
@Override
- public void install(FlashRegistrar app, ExtensionContext ctx) {
+ public void install(FlashRegistrar app, FlashContext ctx) {
RouteViewerHandler shell = new RouteViewerHandler();
RouteViewerDataHandler data = new RouteViewerDataHandler(graph);
diff --git a/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/model/RouteRecord.java b/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/model/RouteRecord.java
index 34b6691..f0cdaf0 100644
--- a/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/model/RouteRecord.java
+++ b/flash-extensions/flash-ext-routeviewer/src/main/java/dev/relism/ext/routeviewer/model/RouteRecord.java
@@ -47,6 +47,11 @@ public record RouteRecord(
/**
* Walks the superclass chain, stopping before {@code RequestHandler}.
* {@code RequestHandler} is the universal root — showing it adds no information.
+ *
+ *
Names are produced by {@link #displayName(Class)} so that static inner classes
+ * appear as {@code OuterClass.InnerClass} (e.g. {@code PostHandlers.List}) rather
+ * than the ambiguous simple name ({@code List}). This guarantees globally unique
+ * display labels in the React Flow graph regardless of inner-class naming collisions.
*/
private static List buildAbstractionChain(Class> cls) {
if (cls == null) return List.of();
@@ -54,12 +59,31 @@ public record RouteRecord(
Class> c = cls;
while (c != null && !c.equals(Object.class)) {
if (ROOT_HANDLER.equals(c.getSimpleName())) break;
- chain.add(c.getSimpleName());
+ chain.add(displayName(c));
c = c.getSuperclass();
}
return List.copyOf(chain);
}
+ /**
+ * Returns a human-readable, globally unique display name for a handler class.
+ *
+ *
+ * - Top-level class {@code HtmlHandler} → {@code "HtmlHandler"}
+ * - Static inner class {@code PostHandlers$List} → {@code "PostHandlers.List"}
+ * - Deeply nested {@code A$B$C} → {@code "A.B.C"}
+ *
+ *
+ * Strategy: take {@code c.getName()} (binary name with {@code $} separators),
+ * strip the package prefix, then replace {@code $} with {@code .}.
+ */
+ private static String displayName(Class> c) {
+ String binary = c.getName(); // e.g. dev.relism.bench.handler.api.PostHandlers$List
+ int lastDot = binary.lastIndexOf('.');
+ String local = lastDot >= 0 ? binary.substring(lastDot + 1) : binary; // PostHandlers$List
+ return local.replace('$', '.'); // PostHandlers.List
+ }
+
private static List buildPointcuts(Class> cls) {
if (cls == null) return List.of();
List pointcuts = new ArrayList<>();
diff --git a/flash-extensions/flash-ext-routeviewer/src/main/resources/routeviewer/app.js b/flash-extensions/flash-ext-routeviewer/src/main/resources/routeviewer/app.js
index 5910655..312f0a7 100644
--- a/flash-extensions/flash-ext-routeviewer/src/main/resources/routeviewer/app.js
+++ b/flash-extensions/flash-ext-routeviewer/src/main/resources/routeviewer/app.js
@@ -1,4 +1,4 @@
-(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Dd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fd={exports:{}},_s={},Od={exports:{}},te={};/**
+(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Od(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fd={exports:{}},ks={},jd={exports:{}},te={};/**
* @license React
* react.production.min.js
*
@@ -6,7 +6,7 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var Ro=Symbol.for("react.element"),ry=Symbol.for("react.portal"),oy=Symbol.for("react.fragment"),iy=Symbol.for("react.strict_mode"),sy=Symbol.for("react.profiler"),ly=Symbol.for("react.provider"),uy=Symbol.for("react.context"),ay=Symbol.for("react.forward_ref"),cy=Symbol.for("react.suspense"),fy=Symbol.for("react.memo"),dy=Symbol.for("react.lazy"),mc=Symbol.iterator;function hy(e){return e===null||typeof e!="object"?null:(e=mc&&e[mc]||e["@@iterator"],typeof e=="function"?e:null)}var jd={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Hd=Object.assign,Vd={};function Mr(e,t,n){this.props=e,this.context=t,this.refs=Vd,this.updater=n||jd}Mr.prototype.isReactComponent={};Mr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Mr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function bd(){}bd.prototype=Mr.prototype;function Gu(e,t,n){this.props=e,this.context=t,this.refs=Vd,this.updater=n||jd}var Ku=Gu.prototype=new bd;Ku.constructor=Gu;Hd(Ku,Mr.prototype);Ku.isPureReactComponent=!0;var yc=Array.isArray,Bd=Object.prototype.hasOwnProperty,Zu={current:null},Wd={key:!0,ref:!0,__self:!0,__source:!0};function Ud(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Bd.call(t,r)&&!Wd.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1>>1,F=k[O];if(0>>1;Oo(U,T))Yo(Q,U)?(k[O]=Q,k[Y]=T,O=Y):(k[O]=U,k[V]=T,O=V);else if(Yo(Q,T))k[O]=Q,k[Y]=T,O=Y;else break e}}return S}function o(k,S){var T=k.sortIndex-S.sortIndex;return T!==0?T:k.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],a=[],d=1,c=null,f=3,m=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(k){for(var S=n(a);S!==null;){if(S.callback===null)r(a);else if(S.startTime<=k)r(a),S.sortIndex=S.expirationTime,t(u,S);else break;S=n(a)}}function v(k){if(w=!1,p(k),!y)if(n(u)!==null)y=!0,I(E);else{var S=n(a);S!==null&&D(v,S.startTime-k)}}function E(k,S){y=!1,w&&(w=!1,h(P),P=-1),m=!0;var T=f;try{for(p(S),c=n(u);c!==null&&(!(c.expirationTime>S)||k&&!z());){var O=c.callback;if(typeof O=="function"){c.callback=null,f=c.priorityLevel;var F=O(c.expirationTime<=S);S=e.unstable_now(),typeof F=="function"?c.callback=F:c===n(u)&&r(u),p(S)}else r(u);c=n(u)}if(c!==null)var W=!0;else{var V=n(a);V!==null&&D(v,V.startTime-S),W=!1}return W}finally{c=null,f=T,m=!1}}var _=!1,N=null,P=-1,L=5,j=-1;function z(){return!(e.unstable_now()-jk||125O?(k.sortIndex=T,t(a,k),n(u)===null&&k===n(a)&&(w?(h(P),P=-1):w=!0,D(v,T-O))):(k.sortIndex=F,t(u,k),y||m||(y=!0,I(E))),k},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(k){var S=f;return function(){var T=f;f=S;try{return k.apply(this,arguments)}finally{f=T}}}})(Kd);Gd.exports=Kd;var Cy=Gd.exports;/**
+ */(function(e){function t(k,S){var T=k.length;k.push(S);e:for(;0>>1,O=k[F];if(0>>1;Fo(U,T))Yo(Q,U)?(k[F]=Q,k[Y]=T,F=Y):(k[F]=U,k[V]=T,F=V);else if(Yo(Q,T))k[F]=Q,k[Y]=T,F=Y;else break e}}return S}function o(k,S){var T=k.sortIndex-S.sortIndex;return T!==0?T:k.id-S.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],a=[],d=1,c=null,f=3,m=!1,y=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(k){for(var S=n(a);S!==null;){if(S.callback===null)r(a);else if(S.startTime<=k)r(a),S.sortIndex=S.expirationTime,t(u,S);else break;S=n(a)}}function v(k){if(w=!1,p(k),!y)if(n(u)!==null)y=!0,I(E);else{var S=n(a);S!==null&&D(v,S.startTime-k)}}function E(k,S){y=!1,w&&(w=!1,h(P),P=-1),m=!0;var T=f;try{for(p(S),c=n(u);c!==null&&(!(c.expirationTime>S)||k&&!z());){var F=c.callback;if(typeof F=="function"){c.callback=null,f=c.priorityLevel;var O=F(c.expirationTime<=S);S=e.unstable_now(),typeof O=="function"?c.callback=O:c===n(u)&&r(u),p(S)}else r(u);c=n(u)}if(c!==null)var W=!0;else{var V=n(a);V!==null&&D(v,V.startTime-S),W=!1}return W}finally{c=null,f=T,m=!1}}var _=!1,N=null,P=-1,L=5,j=-1;function z(){return!(e.unstable_now()-jk||125F?(k.sortIndex=T,t(a,k),n(u)===null&&k===n(a)&&(w?(h(P),P=-1):w=!0,D(v,T-F))):(k.sortIndex=O,t(u,k),y||m||(y=!0,I(E))),k},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(k){var S=f;return function(){var T=f;f=S;try{return k.apply(this,arguments)}finally{f=T}}}})(Zd);Kd.exports=Zd;var My=Kd.exports;/**
* @license React
* react-dom.production.min.js
*
@@ -30,14 +30,14 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var Ny=$,Ge=Cy;function b(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bl=Object.prototype.hasOwnProperty,My=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,wc={},xc={};function Py(e){return bl.call(xc,e)?!0:bl.call(wc,e)?!1:My.test(e)?xc[e]=!0:(wc[e]=!0,!1)}function Ty(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Iy(e,t,n,r){if(t===null||typeof t>"u"||Ty(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function De(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new De(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new De(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new De(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new De(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Me[e]=new De(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new De(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Me[e]=new De(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Me[e]=new De(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Me[e]=new De(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ju=/[\-:]([a-z])/g;function ea(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ju,ea);Me[t]=new De(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ju,ea);Me[t]=new De(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ju,ea);Me[t]=new De(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new De(e,1,!1,e.toLowerCase(),null,!1,!1)});Me.xlinkHref=new De("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Me[e]=new De(e,1,!1,e.toLowerCase(),null,!0,!0)});function ta(e,t,n,r){var o=Me.hasOwnProperty(t)?Me[t]:null;(o!==null?o.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bl=Object.prototype.hasOwnProperty,Ty=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,xc={},Sc={};function Iy(e){return Bl.call(Sc,e)?!0:Bl.call(xc,e)?!1:Ty.test(e)?Sc[e]=!0:(xc[e]=!0,!1)}function zy(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Ly(e,t,n,r){if(t===null||typeof t>"u"||zy(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function De(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Me[e]=new De(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Me[t]=new De(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Me[e]=new De(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Me[e]=new De(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Me[e]=new De(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Me[e]=new De(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Me[e]=new De(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Me[e]=new De(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Me[e]=new De(e,5,!1,e.toLowerCase(),null,!1,!1)});var ea=/[\-:]([a-z])/g;function ta(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ea,ta);Me[t]=new De(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ea,ta);Me[t]=new De(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ea,ta);Me[t]=new De(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Me[e]=new De(e,1,!1,e.toLowerCase(),null,!1,!1)});Me.xlinkHref=new De("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Me[e]=new De(e,1,!1,e.toLowerCase(),null,!0,!0)});function na(e,t,n,r){var o=Me.hasOwnProperty(t)?Me[t]:null;(o!==null?o.type!==0:r||!(2l||o[s]!==i[l]){var u=`
-`+o[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{il=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wr(e):""}function zy(e){switch(e.tag){case 5:return Wr(e.type);case 16:return Wr("Lazy");case 13:return Wr("Suspense");case 19:return Wr("SuspenseList");case 0:case 2:case 15:return e=sl(e.type,!1),e;case 11:return e=sl(e.type.render,!1),e;case 1:return e=sl(e.type,!0),e;default:return""}}function Yl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Bn:return"Fragment";case bn:return"Portal";case Bl:return"Profiler";case na:return"StrictMode";case Wl:return"Suspense";case Ul:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Jd:return(e.displayName||"Context")+".Consumer";case qd:return(e._context.displayName||"Context")+".Provider";case ra:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case oa:return t=e.displayName||null,t!==null?t:Yl(e.type)||"Memo";case Ut:t=e._payload,e=e._init;try{return Yl(e(t))}catch{}}return null}function Ly(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yl(t);case 8:return t===na?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function an(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function th(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ay(e){var t=th(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ko(e){e._valueTracker||(e._valueTracker=Ay(e))}function nh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=th(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Xl(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ec(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=an(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function rh(e,t){t=t.checked,t!=null&&ta(e,"checked",t,!1)}function Ql(e,t){rh(e,t);var n=an(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Gl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Gl(e,t.type,an(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _c(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Gl(e,t,n){(t!=="number"||Hi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ur=Array.isArray;function nr(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Zo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function uo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ry=["Webkit","ms","Moz","O"];Object.keys(Kr).forEach(function(e){Ry.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kr[t]=Kr[e]})});function lh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Kr.hasOwnProperty(e)&&Kr[e]?(""+t).trim():t+"px"}function uh(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=lh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var $y=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ql(e,t){if(t){if($y[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(b(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(b(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(b(61))}if(t.style!=null&&typeof t.style!="object")throw Error(b(62))}}function Jl(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var eu=null;function ia(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tu=null,rr=null,or=null;function Nc(e){if(e=Fo(e)){if(typeof tu!="function")throw Error(b(280));var t=e.stateNode;t&&(t=Ps(t),tu(e.stateNode,e.type,t))}}function ah(e){rr?or?or.push(e):or=[e]:rr=e}function ch(){if(rr){var e=rr,t=or;if(or=rr=null,Nc(e),t)for(e=0;e>>=0,e===0?32:31-(Yy(e)/Xy|0)|0}var qo=64,Jo=4194304;function Yr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=Yr(l):(i&=s,i!==0&&(r=Yr(i)))}else s=n&~o,s!==0?r=Yr(s):i!==0&&(r=Yr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function $o(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ht(t),e[t]=n}function Zy(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=qr),$c=" ",Dc=!1;function Ih(e,t){switch(e){case"keyup":return Cv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wn=!1;function Mv(e,t){switch(e){case"compositionend":return zh(t);case"keypress":return t.which!==32?null:(Dc=!0,$c);case"textInput":return e=t.data,e===$c&&Dc?null:e;default:return null}}function Pv(e,t){if(Wn)return e==="compositionend"||!ha&&Ih(e,t)?(e=Ph(),Ni=ca=Kt=null,Wn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hc(n)}}function $h(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$h(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dh(){for(var e=window,t=Hi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Hi(e.document)}return t}function pa(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Fv(e){var t=Dh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&$h(n.ownerDocument.documentElement,n)){if(r!==null&&pa(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Vc(n,i);var s=Vc(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Un=null,lu=null,eo=null,uu=!1;function bc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;uu||Un==null||Un!==Hi(r)||(r=Un,"selectionStart"in r&&pa(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),eo&&go(eo,r)||(eo=r,r=Xi(lu,"onSelect"),0Qn||(e.current=pu[Qn],pu[Qn]=null,Qn--)}function le(e,t){Qn++,pu[Qn]=e.current,e.current=t}var cn={},Le=dn(cn),He=dn(!1),Nn=cn;function fr(e,t){var n=e.type.contextTypes;if(!n)return cn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ve(e){return e=e.childContextTypes,e!=null}function Gi(){ce(He),ce(Le)}function Gc(e,t,n){if(Le.current!==cn)throw Error(b(168));le(Le,t),le(He,n)}function Uh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(b(108,Ly(e)||"Unknown",o));return me({},n,r)}function Ki(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cn,Nn=Le.current,le(Le,e),le(He,He.current),!0}function Kc(e,t,n){var r=e.stateNode;if(!r)throw Error(b(169));n?(e=Uh(e,t,Nn),r.__reactInternalMemoizedMergedChildContext=e,ce(He),ce(Le),le(Le,e)):ce(He),le(He,n)}var Tt=null,Ts=!1,xl=!1;function Yh(e){Tt===null?Tt=[e]:Tt.push(e)}function Gv(e){Ts=!0,Yh(e)}function hn(){if(!xl&&Tt!==null){xl=!0;var e=0,t=se;try{var n=Tt;for(se=1;e>=s,o-=s,It=1<<32-ht(t)+o|n<P?(L=N,N=null):L=N.sibling;var j=f(h,N,p[P],v);if(j===null){N===null&&(N=L);break}e&&N&&j.alternate===null&&t(h,N),g=i(j,g,P),_===null?E=j:_.sibling=j,_=j,N=L}if(P===p.length)return n(h,N),fe&&gn(h,P),E;if(N===null){for(;PP?(L=N,N=null):L=N.sibling;var z=f(h,N,j.value,v);if(z===null){N===null&&(N=L);break}e&&N&&z.alternate===null&&t(h,N),g=i(z,g,P),_===null?E=z:_.sibling=z,_=z,N=L}if(j.done)return n(h,N),fe&&gn(h,P),E;if(N===null){for(;!j.done;P++,j=p.next())j=c(h,j.value,v),j!==null&&(g=i(j,g,P),_===null?E=j:_.sibling=j,_=j);return fe&&gn(h,P),E}for(N=r(h,N);!j.done;P++,j=p.next())j=m(N,h,P,j.value,v),j!==null&&(e&&j.alternate!==null&&N.delete(j.key===null?P:j.key),g=i(j,g,P),_===null?E=j:_.sibling=j,_=j);return e&&N.forEach(function(R){return t(h,R)}),fe&&gn(h,P),E}function x(h,g,p,v){if(typeof p=="object"&&p!==null&&p.type===Bn&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Go:e:{for(var E=p.key,_=g;_!==null;){if(_.key===E){if(E=p.type,E===Bn){if(_.tag===7){n(h,_.sibling),g=o(_,p.props.children),g.return=h,h=g;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ut&&Jc(E)===_.type){n(h,_.sibling),g=o(_,p.props),g.ref=jr(h,_,p),g.return=h,h=g;break e}n(h,_);break}else t(h,_);_=_.sibling}p.type===Bn?(g=_n(p.props.children,h.mode,v,p.key),g.return=h,h=g):(v=Ri(p.type,p.key,p.props,null,h.mode,v),v.ref=jr(h,g,p),v.return=h,h=v)}return s(h);case bn:e:{for(_=p.key;g!==null;){if(g.key===_)if(g.tag===4&&g.stateNode.containerInfo===p.containerInfo&&g.stateNode.implementation===p.implementation){n(h,g.sibling),g=o(g,p.children||[]),g.return=h,h=g;break e}else{n(h,g);break}else t(h,g);g=g.sibling}g=Pl(p,h.mode,v),g.return=h,h=g}return s(h);case Ut:return _=p._init,x(h,g,_(p._payload),v)}if(Ur(p))return y(h,g,p,v);if(Rr(p))return w(h,g,p,v);si(h,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,g!==null&&g.tag===6?(n(h,g.sibling),g=o(g,p),g.return=h,h=g):(n(h,g),g=Ml(p,h.mode,v),g.return=h,h=g),s(h)):n(h,g)}return x}var hr=Kh(!0),Zh=Kh(!1),Ji=dn(null),es=null,Zn=null,va=null;function wa(){va=Zn=es=null}function xa(e){var t=Ji.current;ce(Ji),e._currentValue=t}function yu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function sr(e,t){es=e,va=Zn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Oe=!0),e.firstContext=null)}function rt(e){var t=e._currentValue;if(va!==e)if(e={context:e,memoizedValue:t,next:null},Zn===null){if(es===null)throw Error(b(308));Zn=e,es.dependencies={lanes:0,firstContext:e}}else Zn=Zn.next=e;return t}var wn=null;function Sa(e){wn===null?wn=[e]:wn.push(e)}function qh(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Sa(t)):(n.next=o.next,o.next=n),t.interleaved=n,Dt(e,r)}function Dt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Yt=!1;function Ea(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jh(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function At(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function nn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Dt(e,n)}return o=r.interleaved,o===null?(t.next=t,Sa(r)):(t.next=o.next,o.next=t),r.interleaved=t,Dt(e,n)}function Pi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,la(e,n)}}function ef(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ts(e,t,n,r){var o=e.updateQueue;Yt=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var u=l,a=u.next;u.next=null,s===null?i=a:s.next=a,s=u;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=a:l.next=a,d.lastBaseUpdate=u))}if(i!==null){var c=o.baseState;s=0,d=a=u=null,l=i;do{var f=l.lane,m=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,w=l;switch(f=t,m=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){c=y.call(m,c,f);break e}c=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,f=typeof y=="function"?y.call(m,c,f):y,f==null)break e;c=me({},c,f);break e;case 2:Yt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(a=d=m,u=c):d=d.next=m,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(u=c),o.baseState=u,o.firstBaseUpdate=a,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Tn|=s,e.lanes=s,e.memoizedState=c}}function tf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=El.transition;El.transition={};try{e(!1),t()}finally{se=n,El.transition=r}}function mp(){return ot().memoizedState}function Jv(e,t,n){var r=on(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},yp(e))vp(t,n);else if(n=qh(e,t,n,r),n!==null){var o=Re();pt(n,e,r,o),wp(n,t,r)}}function ew(e,t,n){var r=on(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(yp(e))vp(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,gt(l,s)){var u=t.interleaved;u===null?(o.next=o,Sa(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=qh(e,t,o,r),n!==null&&(o=Re(),pt(n,e,r,o),wp(n,t,r))}}function yp(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function vp(e,t){to=rs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,la(e,n)}}var os={readContext:rt,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},tw={readContext:rt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:rf,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ii(4194308,4,fp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ii(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ii(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Jv.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:nf,useDebugValue:Ia,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=nf(!1),t=e[0];return e=qv.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ge,o=vt();if(fe){if(n===void 0)throw Error(b(407));n=n()}else{if(n=t(),ke===null)throw Error(b(349));Pn&30||rp(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,rf(ip.bind(null,r,i,e),[e]),r.flags|=2048,_o(9,op.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=vt(),t=ke.identifierPrefix;if(fe){var n=zt,r=It;n=(r&~(1<<32-ht(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=So++,0")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{sl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ur(e):""}function Ay(e){switch(e.tag){case 5:return Ur(e.type);case 16:return Ur("Lazy");case 13:return Ur("Suspense");case 19:return Ur("SuspenseList");case 0:case 2:case 15:return e=ll(e.type,!1),e;case 11:return e=ll(e.type.render,!1),e;case 1:return e=ll(e.type,!0),e;default:return""}}function Xl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Wn:return"Fragment";case Bn:return"Portal";case Wl:return"Profiler";case ra:return"StrictMode";case Ul:return"Suspense";case Yl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case eh:return(e.displayName||"Context")+".Consumer";case Jd:return(e._context.displayName||"Context")+".Provider";case oa:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ia:return t=e.displayName||null,t!==null?t:Xl(e.type)||"Memo";case Ut:t=e._payload,e=e._init;try{return Xl(e(t))}catch{}}return null}function Ry(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xl(t);case 8:return t===ra?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function an(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $y(e){var t=nh(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Zo(e){e._valueTracker||(e._valueTracker=$y(e))}function rh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=nh(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ql(e,t){var n=t.checked;return me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _c(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=an(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function oh(e,t){t=t.checked,t!=null&&na(e,"checked",t,!1)}function Gl(e,t){oh(e,t);var n=an(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Kl(e,t.type,n):t.hasOwnProperty("defaultValue")&&Kl(e,t.type,an(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function kc(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Kl(e,t,n){(t!=="number"||Vi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Yr=Array.isArray;function rr(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=qo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ao(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Zr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dy=["Webkit","ms","Moz","O"];Object.keys(Zr).forEach(function(e){Dy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zr[t]=Zr[e]})});function uh(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Zr.hasOwnProperty(e)&&Zr[e]?(""+t).trim():t+"px"}function ah(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=uh(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Oy=me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Jl(e,t){if(t){if(Oy[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(b(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(b(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(b(61))}if(t.style!=null&&typeof t.style!="object")throw Error(b(62))}}function eu(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var tu=null;function sa(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nu=null,or=null,ir=null;function Mc(e){if(e=Fo(e)){if(typeof nu!="function")throw Error(b(280));var t=e.stateNode;t&&(t=Ts(t),nu(e.stateNode,e.type,t))}}function ch(e){or?ir?ir.push(e):ir=[e]:or=e}function fh(){if(or){var e=or,t=ir;if(ir=or=null,Mc(e),t)for(e=0;e>>=0,e===0?32:31-(Qy(e)/Gy|0)|0}var Jo=64,ei=4194304;function Xr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ui(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=Xr(l):(i&=s,i!==0&&(r=Xr(i)))}else s=n&~o,s!==0?r=Xr(s):i!==0&&(r=Xr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Do(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ht(t),e[t]=n}function Jy(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Jr),Dc=" ",Oc=!1;function zh(e,t){switch(e){case"keyup":return Mv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function Tv(e,t){switch(e){case"compositionend":return Lh(t);case"keypress":return t.which!==32?null:(Oc=!0,Dc);case"textInput":return e=t.data,e===Dc&&Oc?null:e;default:return null}}function Iv(e,t){if(Un)return e==="compositionend"||!pa&&zh(e,t)?(e=Th(),Mi=fa=Kt=null,Un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Vc(n)}}function Dh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Oh(){for(var e=window,t=Vi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vi(e.document)}return t}function ga(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function jv(e){var t=Oh(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Dh(n.ownerDocument.documentElement,n)){if(r!==null&&ga(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=bc(n,i);var s=bc(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Yn=null,uu=null,to=null,au=!1;function Bc(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;au||Yn==null||Yn!==Vi(r)||(r=Yn,"selectionStart"in r&&ga(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),to&&mo(to,r)||(to=r,r=Qi(uu,"onSelect"),0Gn||(e.current=gu[Gn],gu[Gn]=null,Gn--)}function le(e,t){Gn++,gu[Gn]=e.current,e.current=t}var cn={},Le=dn(cn),He=dn(!1),Nn=cn;function dr(e,t){var n=e.type.contextTypes;if(!n)return cn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ve(e){return e=e.childContextTypes,e!=null}function Ki(){ce(He),ce(Le)}function Kc(e,t,n){if(Le.current!==cn)throw Error(b(168));le(Le,t),le(He,n)}function Yh(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(b(108,Ry(e)||"Unknown",o));return me({},n,r)}function Zi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cn,Nn=Le.current,le(Le,e),le(He,He.current),!0}function Zc(e,t,n){var r=e.stateNode;if(!r)throw Error(b(169));n?(e=Yh(e,t,Nn),r.__reactInternalMemoizedMergedChildContext=e,ce(He),ce(Le),le(Le,e)):ce(He),le(He,n)}var Tt=null,Is=!1,Sl=!1;function Xh(e){Tt===null?Tt=[e]:Tt.push(e)}function Zv(e){Is=!0,Xh(e)}function hn(){if(!Sl&&Tt!==null){Sl=!0;var e=0,t=se;try{var n=Tt;for(se=1;e>=s,o-=s,It=1<<32-ht(t)+o|n<P?(L=N,N=null):L=N.sibling;var j=f(h,N,p[P],v);if(j===null){N===null&&(N=L);break}e&&N&&j.alternate===null&&t(h,N),g=i(j,g,P),_===null?E=j:_.sibling=j,_=j,N=L}if(P===p.length)return n(h,N),fe&&gn(h,P),E;if(N===null){for(;PP?(L=N,N=null):L=N.sibling;var z=f(h,N,j.value,v);if(z===null){N===null&&(N=L);break}e&&N&&z.alternate===null&&t(h,N),g=i(z,g,P),_===null?E=z:_.sibling=z,_=z,N=L}if(j.done)return n(h,N),fe&&gn(h,P),E;if(N===null){for(;!j.done;P++,j=p.next())j=c(h,j.value,v),j!==null&&(g=i(j,g,P),_===null?E=j:_.sibling=j,_=j);return fe&&gn(h,P),E}for(N=r(h,N);!j.done;P++,j=p.next())j=m(N,h,P,j.value,v),j!==null&&(e&&j.alternate!==null&&N.delete(j.key===null?P:j.key),g=i(j,g,P),_===null?E=j:_.sibling=j,_=j);return e&&N.forEach(function(R){return t(h,R)}),fe&&gn(h,P),E}function x(h,g,p,v){if(typeof p=="object"&&p!==null&&p.type===Wn&&p.key===null&&(p=p.props.children),typeof p=="object"&&p!==null){switch(p.$$typeof){case Ko:e:{for(var E=p.key,_=g;_!==null;){if(_.key===E){if(E=p.type,E===Wn){if(_.tag===7){n(h,_.sibling),g=o(_,p.props.children),g.return=h,h=g;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Ut&&ef(E)===_.type){n(h,_.sibling),g=o(_,p.props),g.ref=Hr(h,_,p),g.return=h,h=g;break e}n(h,_);break}else t(h,_);_=_.sibling}p.type===Wn?(g=_n(p.props.children,h.mode,v,p.key),g.return=h,h=g):(v=$i(p.type,p.key,p.props,null,h.mode,v),v.ref=Hr(h,g,p),v.return=h,h=v)}return s(h);case Bn:e:{for(_=p.key;g!==null;){if(g.key===_)if(g.tag===4&&g.stateNode.containerInfo===p.containerInfo&&g.stateNode.implementation===p.implementation){n(h,g.sibling),g=o(g,p.children||[]),g.return=h,h=g;break e}else{n(h,g);break}else t(h,g);g=g.sibling}g=Tl(p,h.mode,v),g.return=h,h=g}return s(h);case Ut:return _=p._init,x(h,g,_(p._payload),v)}if(Yr(p))return y(h,g,p,v);if($r(p))return w(h,g,p,v);li(h,p)}return typeof p=="string"&&p!==""||typeof p=="number"?(p=""+p,g!==null&&g.tag===6?(n(h,g.sibling),g=o(g,p),g.return=h,h=g):(n(h,g),g=Pl(p,h.mode,v),g.return=h,h=g),s(h)):n(h,g)}return x}var pr=Zh(!0),qh=Zh(!1),es=dn(null),ts=null,qn=null,wa=null;function xa(){wa=qn=ts=null}function Sa(e){var t=es.current;ce(es),e._currentValue=t}function vu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function lr(e,t){ts=e,wa=qn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fe=!0),e.firstContext=null)}function rt(e){var t=e._currentValue;if(wa!==e)if(e={context:e,memoizedValue:t,next:null},qn===null){if(ts===null)throw Error(b(308));qn=e,ts.dependencies={lanes:0,firstContext:e}}else qn=qn.next=e;return t}var wn=null;function Ea(e){wn===null?wn=[e]:wn.push(e)}function Jh(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ea(t)):(n.next=o.next,o.next=n),t.interleaved=n,Dt(e,r)}function Dt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Yt=!1;function _a(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ep(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function At(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function nn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Dt(e,n)}return o=r.interleaved,o===null?(t.next=t,Ea(r)):(t.next=o.next,o.next=t),r.interleaved=t,Dt(e,n)}function Ti(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}function tf(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ns(e,t,n,r){var o=e.updateQueue;Yt=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var u=l,a=u.next;u.next=null,s===null?i=a:s.next=a,s=u;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=a:l.next=a,d.lastBaseUpdate=u))}if(i!==null){var c=o.baseState;s=0,d=a=u=null,l=i;do{var f=l.lane,m=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,w=l;switch(f=t,m=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){c=y.call(m,c,f);break e}c=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,f=typeof y=="function"?y.call(m,c,f):y,f==null)break e;c=me({},c,f);break e;case 2:Yt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(a=d=m,u=c):d=d.next=m,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;f=l,l=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(u=c),o.baseState=u,o.firstBaseUpdate=a,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Tn|=s,e.lanes=s,e.memoizedState=c}}function nf(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=_l.transition;_l.transition={};try{e(!1),t()}finally{se=n,_l.transition=r}}function yp(){return ot().memoizedState}function tw(e,t,n){var r=on(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vp(e))wp(t,n);else if(n=Jh(e,t,n,r),n!==null){var o=Re();pt(n,e,r,o),xp(n,t,r)}}function nw(e,t,n){var r=on(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vp(e))wp(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,gt(l,s)){var u=t.interleaved;u===null?(o.next=o,Ea(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Jh(e,t,o,r),n!==null&&(o=Re(),pt(n,e,r,o),xp(n,t,r))}}function vp(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function wp(e,t){no=os=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xp(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ua(e,n)}}var is={readContext:rt,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},rw={readContext:rt,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:of,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,zi(4194308,4,dp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zi(4194308,4,e,t)},useInsertionEffect:function(e,t){return zi(4,2,e,t)},useMemo:function(e,t){var n=vt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=tw.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:rf,useDebugValue:za,useDeferredValue:function(e){return vt().memoizedState=e},useTransition:function(){var e=rf(!1),t=e[0];return e=ew.bind(null,e[1]),vt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ge,o=vt();if(fe){if(n===void 0)throw Error(b(407));n=n()}else{if(n=t(),ke===null)throw Error(b(349));Pn&30||op(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,of(sp.bind(null,r,i,e),[e]),r.flags|=2048,ko(9,ip.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=vt(),t=ke.identifierPrefix;if(fe){var n=zt,r=It;n=(r&~(1<<32-ht(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Eo++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[xt]=t,e[vo]=r,Tp(e,t,!1,!1),t.stateNode=e;e:{switch(s=Jl(n,r),n){case"dialog":ae("cancel",e),ae("close",e),o=r;break;case"iframe":case"object":case"embed":ae("load",e),o=r;break;case"video":case"audio":for(o=0;omr&&(t.flags|=128,r=!0,Hr(i,!1),t.lanes=4194304)}else{if(!r)if(e=ns(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Hr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!fe)return Ie(t),null}else 2*ve()-i.renderingStartTime>mr&&n!==1073741824&&(t.flags|=128,r=!0,Hr(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ve(),t.sibling=null,n=pe.current,le(pe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Da(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ue&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(b(156,t.tag))}function aw(e,t){switch(ma(t),t.tag){case 1:return Ve(t.type)&&Gi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pr(),ce(He),ce(Le),Ca(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ka(t),null;case 13:if(ce(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(b(340));dr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(pe),null;case 4:return pr(),null;case 10:return xa(t.type._context),null;case 22:case 23:return Da(),null;case 24:return null;default:return null}}var ui=!1,ze=!1,cw=typeof WeakSet=="function"?WeakSet:Set,X=null;function qn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function Nu(e,t,n){try{n()}catch(r){ye(e,t,r)}}var gf=!1;function fw(e,t){if(au=Ui,e=Dh(),pa(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,a=0,d=0,c=e,f=null;t:for(;;){for(var m;c!==n||o!==0&&c.nodeType!==3||(l=s+o),c!==i||r!==0&&c.nodeType!==3||(u=s+r),c.nodeType===3&&(s+=c.nodeValue.length),(m=c.firstChild)!==null;)f=c,c=m;for(;;){if(c===e)break t;if(f===n&&++a===o&&(l=s),f===i&&++d===r&&(u=s),(m=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=m}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(cu={focusedElem:e,selectionRange:n},Ui=!1,X=t;X!==null;)if(t=X,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,x=y.memoizedState,h=t.stateNode,g=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:st(t.type,w),x);h.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(b(163))}}catch(v){ye(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return y=gf,gf=!1,y}function no(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Nu(t,n,i)}o=o.next}while(o!==r)}}function Ls(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Mu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Lp(e){var t=e.alternate;t!==null&&(e.alternate=null,Lp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xt],delete t[vo],delete t[hu],delete t[Xv],delete t[Qv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ap(e){return e.tag===5||e.tag===3||e.tag===4}function mf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ap(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Pu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qi));else if(r!==4&&(e=e.child,e!==null))for(Pu(e,t,n),e=e.sibling;e!==null;)Pu(e,t,n),e=e.sibling}function Tu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}var Ce=null,lt=!1;function bt(e,t,n){for(n=n.child;n!==null;)Rp(e,t,n),n=n.sibling}function Rp(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(ks,n)}catch{}switch(n.tag){case 5:ze||qn(n,t);case 6:var r=Ce,o=lt;Ce=null,bt(e,t,n),Ce=r,lt=o,Ce!==null&&(lt?(e=Ce,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ce.removeChild(n.stateNode));break;case 18:Ce!==null&&(lt?(e=Ce,n=n.stateNode,e.nodeType===8?wl(e.parentNode,n):e.nodeType===1&&wl(e,n),ho(e)):wl(Ce,n.stateNode));break;case 4:r=Ce,o=lt,Ce=n.stateNode.containerInfo,lt=!0,bt(e,t,n),Ce=r,lt=o;break;case 0:case 11:case 14:case 15:if(!ze&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Nu(n,t,s),o=o.next}while(o!==r)}bt(e,t,n);break;case 1:if(!ze&&(qn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ye(n,t,l)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(ze=(r=ze)||n.memoizedState!==null,bt(e,t,n),ze=r):bt(e,t,n);break;default:bt(e,t,n)}}function yf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new cw),t.forEach(function(r){var o=xw.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hw(r/1960))-r,10e?16:e,Zt===null)var r=!1;else{if(e=Zt,Zt=null,ls=0,re&6)throw Error(b(331));var o=re;for(re|=4,X=e.current;X!==null;){var i=X,s=i.child;if(X.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uve()-Ra?En(e,0):Aa|=n),be(e,t)}function bp(e,t){t===0&&(e.mode&1?(t=Jo,Jo<<=1,!(Jo&130023424)&&(Jo=4194304)):t=1);var n=Re();e=Dt(e,t),e!==null&&($o(e,t,n),be(e,n))}function ww(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bp(e,n)}function xw(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(b(314))}r!==null&&r.delete(t),bp(e,n)}var Bp;Bp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)Oe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Oe=!1,lw(e,t,n);Oe=!!(e.flags&131072)}else Oe=!1,fe&&t.flags&1048576&&Xh(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zi(e,t),e=t.pendingProps;var o=fr(t,Le.current);sr(t,n),o=Ma(null,t,r,e,o,n);var i=Pa();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ve(r)?(i=!0,Ki(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ea(t),o.updater=zs,t.stateNode=o,o._reactInternals=t,wu(t,r,e,n),t=Eu(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&ga(t),Ae(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zi(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Ew(r),e=st(r,e),o){case 0:t=Su(null,t,r,e,n);break e;case 1:t=df(null,t,r,e,n);break e;case 11:t=cf(null,t,r,e,n);break e;case 14:t=ff(null,t,r,st(r.type,e),n);break e}throw Error(b(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Su(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),df(e,t,r,o,n);case 3:e:{if(Np(t),e===null)throw Error(b(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Jh(e,t),ts(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=gr(Error(b(423)),t),t=hf(e,t,r,n,o);break e}else if(r!==o){o=gr(Error(b(424)),t),t=hf(e,t,r,n,o);break e}else for(Xe=tn(t.stateNode.containerInfo.firstChild),Qe=t,fe=!0,at=null,n=Zh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(dr(),r===o){t=Ft(e,t,n);break e}Ae(e,t,r,n)}t=t.child}return t;case 5:return ep(t),e===null&&mu(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,fu(r,o)?s=null:i!==null&&fu(r,i)&&(t.flags|=32),Cp(e,t),Ae(e,t,s,n),t.child;case 6:return e===null&&mu(t),null;case 13:return Mp(e,t,n);case 4:return _a(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hr(t,null,r,n):Ae(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),cf(e,t,r,o,n);case 7:return Ae(e,t,t.pendingProps,n),t.child;case 8:return Ae(e,t,t.pendingProps.children,n),t.child;case 12:return Ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,le(Ji,r._currentValue),r._currentValue=s,i!==null)if(gt(i.value,s)){if(i.children===o.children&&!He.current){t=Ft(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=At(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var d=a.pending;d===null?u.next=u:(u.next=d.next,d.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),yu(i.return,n,t),l.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(b(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),yu(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Ae(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,sr(t,n),o=rt(o),r=r(o),t.flags|=1,Ae(e,t,r,n),t.child;case 14:return r=t.type,o=st(r,t.pendingProps),o=st(r.type,o),ff(e,t,r,o,n);case 15:return _p(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),zi(e,t),t.tag=1,Ve(r)?(e=!0,Ki(t)):e=!1,sr(t,n),xp(t,r,o),wu(t,r,o,n),Eu(null,t,r,!0,e,n);case 19:return Pp(e,t,n);case 22:return kp(e,t,n)}throw Error(b(156,t.tag))};function Wp(e,t){return yh(e,t)}function Sw(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tt(e,t,n,r){return new Sw(e,t,n,r)}function Oa(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ew(e){if(typeof e=="function")return Oa(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ra)return 11;if(e===oa)return 14}return 2}function sn(e,t){var n=e.alternate;return n===null?(n=tt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ri(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Oa(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Bn:return _n(n.children,o,i,t);case na:s=8,o|=8;break;case Bl:return e=tt(12,n,t,o|2),e.elementType=Bl,e.lanes=i,e;case Wl:return e=tt(13,n,t,o),e.elementType=Wl,e.lanes=i,e;case Ul:return e=tt(19,n,t,o),e.elementType=Ul,e.lanes=i,e;case eh:return Rs(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qd:s=10;break e;case Jd:s=9;break e;case ra:s=11;break e;case oa:s=14;break e;case Ut:s=16,r=null;break e}throw Error(b(130,e==null?e:typeof e,""))}return t=tt(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function _n(e,t,n,r){return e=tt(7,e,r,t),e.lanes=n,e}function Rs(e,t,n,r){return e=tt(22,e,r,t),e.elementType=eh,e.lanes=n,e.stateNode={isHidden:!1},e}function Ml(e,t,n){return e=tt(6,e,null,t),e.lanes=n,e}function Pl(e,t,n){return t=tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function _w(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ul(0),this.expirationTimes=ul(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ul(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ja(e,t,n,r,o,i,s,l,u){return e=new _w(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=tt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ea(i),e}function kw(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qp)}catch(e){console.error(e)}}Qp(),Qd.exports=Ze;var Tw=Qd.exports,Gp,Cf=Tw;Gp=Cf.createRoot,Cf.hydrateRoot;function xe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function js(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}$i.prototype=js.prototype={constructor:$i,on:function(e,t){var n=this._,r=zw(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(o),r=0,o,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Mf.hasOwnProperty(t)?{space:Mf[t],local:e}:e}function Aw(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ru&&t.documentElement.namespaceURI===Ru?t.createElement(e):t.createElementNS(n,e)}}function Rw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Kp(e){var t=Hs(e);return(t.local?Rw:Aw)(t)}function $w(){}function Ba(e){return e==null?$w:function(){return this.querySelector(e)}}function Dw(e){typeof e!="function"&&(e=Ba(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=p&&(p=g+1);!(E=x[p])&&++p=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function lx(e){e||(e=ux);function t(c,f){return c&&f?e(c.__data__,f.__data__):!c-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function ax(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function cx(){return Array.from(this)}function fx(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ex:typeof t=="function"?kx:_x)(e,t,n??"")):yr(this.node(),e)}function yr(e,t){return e.style.getPropertyValue(t)||tg(e).getComputedStyle(e,null).getPropertyValue(t)}function Nx(e){return function(){delete this[e]}}function Mx(e,t){return function(){this[e]=t}}function Px(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Tx(e,t){return arguments.length>1?this.each((t==null?Nx:typeof t=="function"?Px:Mx)(e,t)):this.node()[e]}function ng(e){return e.trim().split(/^|\s+/)}function Wa(e){return e.classList||new rg(e)}function rg(e){this._node=e,this._names=ng(e.getAttribute("class")||"")}rg.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function og(e,t){for(var n=Wa(e),r=-1,o=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function r1(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n()=>e;function $u(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:l,dx:u,dy:a,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:a,enumerable:!0,configurable:!0},_:{value:d}})}$u.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function h1(e){return!e.ctrlKey&&!e.button}function p1(){return this.parentNode}function g1(e,t){return t??{x:e.x,y:e.y}}function m1(){return navigator.maxTouchPoints||"ontouchstart"in this}function cg(){var e=h1,t=p1,n=g1,r=m1,o={},i=js("start","drag","end"),s=0,l,u,a,d,c=0;function f(v){v.on("mousedown.drag",m).filter(r).on("touchstart.drag",x).on("touchmove.drag",h,d1).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(v,E){if(!(d||!e.call(this,v,E))){var _=p(this,t.call(this,v,E),v,E,"mouse");_&&(Ye(v.view).on("mousemove.drag",y,Co).on("mouseup.drag",w,Co),ug(v.view),Tl(v),a=!1,l=v.clientX,u=v.clientY,_("start",v))}}function y(v){if(ur(v),!a){var E=v.clientX-l,_=v.clientY-u;a=E*E+_*_>c}o.mouse("drag",v)}function w(v){Ye(v.view).on("mousemove.drag mouseup.drag",null),ag(v.view,a),ur(v),o.mouse("end",v)}function x(v,E){if(e.call(this,v,E)){var _=v.changedTouches,N=t.call(this,v,E),P=_.length,L,j;for(L=0;L>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?di(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?di(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=v1.exec(e))?new je(t[1],t[2],t[3],1):(t=w1.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=x1.exec(e))?di(t[1],t[2],t[3],t[4]):(t=S1.exec(e))?di(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=E1.exec(e))?Rf(t[1],t[2]/100,t[3]/100,1):(t=_1.exec(e))?Rf(t[1],t[2]/100,t[3]/100,t[4]):Pf.hasOwnProperty(e)?zf(Pf[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function zf(e){return new je(e>>16&255,e>>8&255,e&255,1)}function di(e,t,n,r){return r<=0&&(e=t=n=NaN),new je(e,t,n,r)}function N1(e){return e instanceof Ho||(e=zn(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function Du(e,t,n,r){return arguments.length===1?N1(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ua(je,Du,fg(Ho,{brighter(e){return e=e==null?fs:Math.pow(fs,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(kn(this.r),kn(this.g),kn(this.b),ds(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:Lf,formatHex:Lf,formatHex8:M1,formatRgb:Af,toString:Af}));function Lf(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}`}function M1(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}${Sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Af(){const e=ds(this.opacity);return`${e===1?"rgb(":"rgba("}${kn(this.r)}, ${kn(this.g)}, ${kn(this.b)}${e===1?")":`, ${e})`}`}function ds(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sn(e){return e=kn(e),(e<16?"0":"")+e.toString(16)}function Rf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ct(e,t,n,r)}function dg(e){if(e instanceof ct)return new ct(e.h,e.s,e.l,e.opacity);if(e instanceof Ho||(e=zn(e)),!e)return new ct;if(e instanceof ct)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,l=i-o,u=(i+o)/2;return l?(t===i?s=(n-r)/l+(n0&&u<1?0:s,new ct(s,l,u,e.opacity)}function P1(e,t,n,r){return arguments.length===1?dg(e):new ct(e,t,n,r??1)}function ct(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ua(ct,P1,fg(Ho,{brighter(e){return e=e==null?fs:Math.pow(fs,e),new ct(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?No:Math.pow(No,e),new ct(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new je(Il(e>=240?e-240:e+120,o,r),Il(e,o,r),Il(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ct($f(this.h),hi(this.s),hi(this.l),ds(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(){const e=ds(this.opacity);return`${e===1?"hsl(":"hsla("}${$f(this.h)}, ${hi(this.s)*100}%, ${hi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function $f(e){return e=(e||0)%360,e<0?e+360:e}function hi(e){return Math.max(0,Math.min(1,e||0))}function Il(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ya=e=>()=>e;function T1(e,t){return function(n){return e+n*t}}function I1(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function z1(e){return(e=+e)==1?hg:function(t,n){return n-t?I1(t,n,e):Ya(isNaN(t)?n:t)}}function hg(e,t){var n=t-e;return n?T1(e,n):Ya(isNaN(e)?t:e)}const hs=function e(t){var n=z1(t);function r(o,i){var s=n((o=Du(o)).r,(i=Du(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),a=hg(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=l(d),o.b=u(d),o.opacity=a(d),o+""}}return r.gamma=e,r}(1);function L1(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;on&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(r=r[0])===(o=o[0])?l[s]?l[s]+=o:l[++s]=o:(l[++s]=null,u.push({i:s,x:wt(r,o)})),n=zl.lastIndex;return n180?d+=360:d-a>180&&(a+=360),f.push({i:c.push(o(c)+"rotate(",null,r)-2,x:wt(a,d)})):d&&c.push(o(c)+"rotate("+d+r)}function l(a,d,c,f){a!==d?f.push({i:c.push(o(c)+"skewX(",null,r)-2,x:wt(a,d)}):d&&c.push(o(c)+"skewX("+d+r)}function u(a,d,c,f,m,y){if(a!==c||d!==f){var w=m.push(o(m)+"scale(",null,",",null,")");y.push({i:w-4,x:wt(a,c)},{i:w-2,x:wt(d,f)})}else(c!==1||f!==1)&&m.push(o(m)+"scale("+c+","+f+")")}return function(a,d){var c=[],f=[];return a=e(a),d=e(d),i(a.translateX,a.translateY,d.translateX,d.translateY,c,f),s(a.rotate,d.rotate,c,f),l(a.skewX,d.skewX,c,f),u(a.scaleX,a.scaleY,d.scaleX,d.scaleY,c,f),a=d=null,function(m){for(var y=-1,w=f.length,x;++y=0&&e._call.call(void 0,t),e=e._next;--vr}function Of(){Ln=(gs=Po.now())+Vs,vr=Qr=0;try{X1()}finally{vr=0,G1(),Ln=0}}function Q1(){var e=Po.now(),t=e-gs;t>yg&&(Vs-=t,gs=e)}function G1(){for(var e,t=ps,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ps=n);Gr=e,ju(r)}function ju(e){if(!vr){Qr&&(Qr=clearTimeout(Qr));var t=e-Ln;t>24?(e<1/0&&(Qr=setTimeout(Of,e-Po.now()-Vs)),br&&(br=clearInterval(br))):(br||(gs=Po.now(),br=setInterval(Q1,yg)),vr=1,vg(Of))}}function jf(e,t,n){var r=new ms;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var K1=js("start","end","cancel","interrupt"),Z1=[],xg=0,Hf=1,Hu=2,Fi=3,Vf=4,Vu=5,Oi=6;function bs(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;q1(e,n,{name:t,index:r,group:o,on:K1,tween:Z1,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:xg})}function Qa(e,t){var n=mt(e,t);if(n.state>xg)throw new Error("too late; already scheduled");return n}function Ct(e,t){var n=mt(e,t);if(n.state>Fi)throw new Error("too late; already running");return n}function mt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function q1(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=wg(i,0,n.time);function i(a){n.state=Hf,n.timer.restart(s,n.delay,n.time),n.delay<=a&&s(a-n.delay)}function s(a){var d,c,f,m;if(n.state!==Hf)return u();for(d in r)if(m=r[d],m.name===n.name){if(m.state===Fi)return jf(s);m.state===Vf?(m.state=Oi,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[d]):+dHu&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function PS(e,t,n){var r,o,i=MS(t)?Qa:Ct;return function(){var s=i(this,e),l=s.on;l!==r&&(o=(r=l).copy()).on(t,n),s.on=o}}function TS(e,t){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(e):this.each(PS(n,e,t))}function IS(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function zS(){return this.on("end.remove",IS(this._id))}function LS(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ba(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s()=>e;function rE(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Lt(e,t,n){this.k=e,this.x=t,this.y=n}Lt.prototype={constructor:Lt,scale:function(e){return e===1?this:new Lt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Bs=new Lt(1,0,0);kg.prototype=Lt.prototype;function kg(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bs;return e.__zoom}function Ll(e){e.stopImmediatePropagation()}function Br(e){e.preventDefault(),e.stopImmediatePropagation()}function oE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function iE(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function bf(){return this.__zoom||Bs}function sE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lE(){return navigator.maxTouchPoints||"ontouchstart"in this}function uE(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Cg(){var e=oE,t=iE,n=uE,r=sE,o=lE,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Di,a=js("start","zoom","end"),d,c,f,m=500,y=150,w=0,x=10;function h(C){C.property("__zoom",bf).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}h.transform=function(C,A,I,D){var k=C.selection?C.selection():C;k.property("__zoom",bf),C!==k?E(C,A,I,D):k.interrupt().each(function(){_(this,arguments).event(D).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},h.scaleBy=function(C,A,I,D){h.scaleTo(C,function(){var k=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return k*S},I,D)},h.scaleTo=function(C,A,I,D){h.transform(C,function(){var k=t.apply(this,arguments),S=this.__zoom,T=I==null?v(k):typeof I=="function"?I.apply(this,arguments):I,O=S.invert(T),F=typeof A=="function"?A.apply(this,arguments):A;return n(p(g(S,F),T,O),k,s)},I,D)},h.translateBy=function(C,A,I,D){h.transform(C,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),s)},null,D)},h.translateTo=function(C,A,I,D,k){h.transform(C,function(){var S=t.apply(this,arguments),T=this.__zoom,O=D==null?v(S):typeof D=="function"?D.apply(this,arguments):D;return n(Bs.translate(O[0],O[1]).scale(T.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof I=="function"?-I.apply(this,arguments):-I),S,s)},D,k)};function g(C,A){return A=Math.max(i[0],Math.min(i[1],A)),A===C.k?C:new Lt(A,C.x,C.y)}function p(C,A,I){var D=A[0]-I[0]*C.k,k=A[1]-I[1]*C.k;return D===C.x&&k===C.y?C:new Lt(C.k,D,k)}function v(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function E(C,A,I,D){C.on("start.zoom",function(){_(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(D).end()}).tween("zoom",function(){var k=this,S=arguments,T=_(k,S).event(D),O=t.apply(k,S),F=I==null?v(O):typeof I=="function"?I.apply(k,S):I,W=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),V=k.__zoom,U=typeof A=="function"?A.apply(k,S):A,Y=u(V.invert(F).concat(W/V.k),U.invert(F).concat(W/U.k));return function(Q){if(Q===1)Q=U;else{var B=Y(Q),K=W/B[2];Q=new Lt(K,F[0]-B[0]*K,F[1]-B[1]*K)}T.zoom(null,Q)}})}function _(C,A,I){return!I&&C.__zooming||new N(C,A)}function N(C,A){this.that=C,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,A),this.taps=0}N.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,A){return this.mouse&&C!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var A=Ye(this.that).datum();a.call(C,this.that,new rE(C,{sourceEvent:this.sourceEvent,target:h,transform:this.that.__zoom,dispatch:a}),A)}};function P(C,...A){if(!e.apply(this,arguments))return;var I=_(this,A).event(C),D=this.__zoom,k=Math.max(i[0],Math.min(i[1],D.k*Math.pow(2,r.apply(this,arguments)))),S=ut(C);if(I.wheel)(I.mouse[0][0]!==S[0]||I.mouse[0][1]!==S[1])&&(I.mouse[1]=D.invert(I.mouse[0]=S)),clearTimeout(I.wheel);else{if(D.k===k)return;I.mouse=[S,D.invert(S)],ji(this),I.start()}Br(C),I.wheel=setTimeout(T,y),I.zoom("mouse",n(p(g(D,k),I.mouse[0],I.mouse[1]),I.extent,s));function T(){I.wheel=null,I.end()}}function L(C,...A){if(f||!e.apply(this,arguments))return;var I=C.currentTarget,D=_(this,A,!0).event(C),k=Ye(C.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",W,!0),S=ut(C,I),T=C.clientX,O=C.clientY;ug(C.view),Ll(C),D.mouse=[S,this.__zoom.invert(S)],ji(this),D.start();function F(V){if(Br(V),!D.moved){var U=V.clientX-T,Y=V.clientY-O;D.moved=U*U+Y*Y>w}D.event(V).zoom("mouse",n(p(D.that.__zoom,D.mouse[0]=ut(V,I),D.mouse[1]),D.extent,s))}function W(V){k.on("mousemove.zoom mouseup.zoom",null),ag(V.view,D.moved),Br(V),D.event(V).end()}}function j(C,...A){if(e.apply(this,arguments)){var I=this.__zoom,D=ut(C.changedTouches?C.changedTouches[0]:C,this),k=I.invert(D),S=I.k*(C.shiftKey?.5:2),T=n(p(g(I,S),D,k),t.apply(this,A),s);Br(C),l>0?Ye(this).transition().duration(l).call(E,T,D,C):Ye(this).call(h.transform,T,D,C)}}function z(C,...A){if(e.apply(this,arguments)){var I=C.touches,D=I.length,k=_(this,A,C.changedTouches.length===D).event(C),S,T,O,F;for(Ll(C),T=0;T"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},To=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ng=["Enter"," ","Escape"],Mg={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var wr;(function(e){e.Strict="strict",e.Loose="loose"})(wr||(wr={}));var Cn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cn||(Cn={}));var Io;(function(e){e.Partial="partial",e.Full="full"})(Io||(Io={}));const Pg={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Gt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Gt||(Gt={}));var xr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(xr||(xr={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Bf={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Tg(e){return e===null?null:e?"valid":"invalid"}const Ig=e=>"id"in e&&"source"in e&&"target"in e,aE=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ka=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Vo=(e,t=[0,0])=>{const{width:n,height:r}=Ht(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},zg=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):Ka(o)?o:t.nodeLookup.get(o.id));const l=s?ys(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ws(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Us(n)},bo=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Ws(n,ys(o)),r=!0)}),r?Us(n):{x:0,y:0,width:0,height:0}},Za=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const l={...Wo(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const a of e.values()){const{measured:d,selectable:c=!0,hidden:f=!1}=a;if(s&&!c||f)continue;const m=d.width??a.width??a.initialWidth??null,y=d.height??a.height??a.initialHeight??null,w=zo(l,Er(a)),x=(m??0)*(y??0),h=i&&w>0;(!a.internals.handleBounds||h||w>=x||a.dragging)&&u.push(a)}return u},cE=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function fE(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function dE({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const l=fE(e,s),u=bo(l),a=Ys(u,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(a,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Lg({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),l=s.parentId?n.get(s.parentId):void 0,{x:u,y:a}=l?l.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let c=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!l)i==null||i("005",kt.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(c=[[u,a],[u+m,a+y]])}else l&&_r(s.extent)&&(c=[[s.extent[0][0]+u,s.extent[0][1]+a],[s.extent[1][0]+u,s.extent[1][1]+a]]);const f=_r(c)?An(t,c,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",kt.error015())),{position:{x:f.x-u+(s.measured.width??0)*d[0],y:f.y-a+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function hE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const m=i.has(f.id),y=!m&&f.parentId&&s.find(w=>w.id===f.parentId);(m||y)&&s.push(f)}const l=new Set(t.map(f=>f.id)),u=r.filter(f=>f.deletable!==!1),d=cE(s,u);for(const f of u)l.has(f.id)&&!d.find(y=>y.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const c=await o({nodes:s,edges:d});return typeof c=="boolean"?c?{edges:d,nodes:s}:{edges:[],nodes:[]}:c}const Sr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),An=(e={x:0,y:0},t,n)=>({x:Sr(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Sr(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Ag(e,t,n){const{width:r,height:o}=Ht(n),{x:i,y:s}=n.internals.positionAbsolute;return An(e,[[i,s],[i+r,s+o]],t)}const Wf=(e,t,n)=>en?-Sr(Math.abs(e-n),1,t)/t:0,Rg=(e,t,n=15,r=40)=>{const o=Wf(e.x,r,t.width-r)*n,i=Wf(e.y,r,t.height-r)*n;return[o,i]},Ws=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),bu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Us=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Er=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Ka(e)?e.internals.positionAbsolute:Vo(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},ys=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Ka(e)?e.internals.positionAbsolute:Vo(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},$g=(e,t)=>Us(Ws(bu(e),bu(t))),zo=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Uf=e=>ft(e.width)&&ft(e.height)&&ft(e.x)&&ft(e.y),ft=e=>!isNaN(e)&&isFinite(e),pE=(e,t)=>{},Bo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Wo=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Bo(l,s):l},vs=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function jn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function gE(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=jn(e,n),o=jn(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=jn(e.top??e.y??0,n),o=jn(e.bottom??e.y??0,n),i=jn(e.left??e.x??0,t),s=jn(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function mE(e,t,n,r,o,i){const{x:s,y:l}=vs(e,[t,n,r]),{x:u,y:a}=vs({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-u,c=i-a;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(c)}}const Ys=(e,t,n,r,o,i)=>{const s=gE(i,t,n),l=(t-s.x)/e.width,u=(n-s.y)/e.height,a=Math.min(l,u),d=Sr(a,r,o),c=e.x+e.width/2,f=e.y+e.height/2,m=t/2-c*d,y=n/2-f*d,w=mE(e,m,y,d,t,n),x={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:m-x.left+x.right,y:y-x.top+x.bottom,zoom:d}},Lo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function _r(e){return e!=null&&e!=="parent"}function Ht(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Dg(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Fg(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const l=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function Yf(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function yE(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function vE(e){return{...Mg,...e||{}}}function so(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=dt(e),l=Wo({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:u,y:a}=n?Bo(l,t):l;return{xSnapped:u,ySnapped:a,...l}}const qa=e=>({width:e.offsetWidth,height:e.offsetHeight}),Og=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},wE=["INPUT","SELECT","TEXTAREA"];function jg(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:wE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Hg=e=>"clientX"in e,dt=(e,t)=>{var i,s;const n=Hg(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Xf=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const l=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...qa(s)}})};function Vg({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:l}){const u=e*.125+o*.375+s*.375+n*.125,a=t*.125+i*.375+l*.375+r*.125,d=Math.abs(u-e),c=Math.abs(a-t);return[u,a,d,c]}function mi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Qf({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case G.Left:return[t-mi(t-r,i),n];case G.Right:return[t+mi(r-t,i),n];case G.Top:return[t,n-mi(n-o,i)];case G.Bottom:return[t,n+mi(o-n,i)]}}function bg({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[l,u]=Qf({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[a,d]=Qf({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[c,f,m,y]=Vg({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:a,targetControlY:d});return[`M${e},${t} C${l},${u} ${a},${d} ${r},${o}`,c,f,m,y]}function Bg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n0}const EE=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,_E=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),kE=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||EE;let o;return Ig(e)?o={...e}:o={...e,id:r(e)},_E(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Wg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,l]=Bg({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,l]}const Gf={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},CE=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function NE({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const l=Gf[t],u=Gf[r],a={x:e.x+l.x*i,y:e.y+l.y*i},d={x:n.x+u.x*i,y:n.y+u.y*i},c=CE({source:a,sourcePosition:t,target:d}),f=c.x!==0?"x":"y",m=c[f];let y=[],w,x;const h={x:0,y:0},g={x:0,y:0},[,,p,v]=Bg({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*u[f]===-1){f==="x"?(w=o.x??a.x+(d.x-a.x)*s,x=o.y??(a.y+d.y)/2):(w=o.x??(a.x+d.x)/2,x=o.y??a.y+(d.y-a.y)*s);const _=[{x:w,y:a.y},{x:w,y:d.y}],N=[{x:a.x,y:x},{x:d.x,y:x}];l[f]===m?y=f==="x"?_:N:y=f==="x"?N:_}else{const _=[{x:a.x,y:d.y}],N=[{x:d.x,y:a.y}];if(f==="x"?y=l.x===m?N:_:y=l.y===m?_:N,t===r){const R=Math.abs(e[f]-n[f]);if(R<=i){const H=Math.min(i-1,i-R);l[f]===m?h[f]=(a[f]>e[f]?-1:1)*H:g[f]=(d[f]>n[f]?-1:1)*H}}if(t!==r){const R=f==="x"?"y":"x",H=l[f]===u[R],C=a[R]>d[R],A=a[R]=z?(w=(P.x+L.x)/2,x=y[0].y):(w=y[0].x,x=(P.y+L.y)/2)}return[[e,{x:a.x+h.x,y:a.y+h.y},...y,{x:d.x+g.x,y:d.y+g.y},n],w,x,p,v]}function ME(e,t,n,r){const o=Math.min(Kf(e,t)/2,Kf(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const a=e.x{let v="";return p>0&&pn.id===t):e[0])||null}function Wu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function TE(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,l)=>([l.markerStart||r,l.markerEnd||o].forEach(u=>{if(u&&typeof u=="object"){const a=Wu(u,t);i.has(a)||(s.push({id:a,color:u.color||n,...u}),i.add(a))}}),s),[]).sort((s,l)=>s.id.localeCompare(l.id))}const Ug=1e3,IE=10,Ja={nodeOrigin:[0,0],nodeExtent:To,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},zE={...Ja,checkEquality:!0};function ec(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function LE(e,t,n){const r=ec(Ja,n);for(const o of e.values())if(o.parentId)nc(o,e,t,r);else{const i=Vo(o,r.nodeOrigin),s=_r(o.extent)?o.extent:r.nodeExtent,l=An(i,s,Ht(o));o.internals.positionAbsolute=l}}function AE(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function tc(e){return e==="manual"}function Uu(e,t,n,r={}){var a,d;const o=ec(zE,r),i={i:0},s=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!tc(o.zIndexMode)?Ug:0;let u=e.length>0;t.clear(),n.clear();for(const c of e){let f=s.get(c.id);if(o.checkEquality&&c===(f==null?void 0:f.internals.userNode))t.set(c.id,f);else{const m=Vo(c,o.nodeOrigin),y=_r(c.extent)?c.extent:o.nodeExtent,w=An(m,y,Ht(c));f={...o.defaults,...c,measured:{width:(a=c.measured)==null?void 0:a.width,height:(d=c.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:AE(c,f),z:Yg(c,l,o.zIndexMode),userNode:c}},t.set(c.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(u=!1),c.parentId&&nc(f,t,n,r,i)}return u}function RE(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function nc(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:l,zIndexMode:u}=ec(Ja,r),a=e.parentId,d=t.get(a);if(!d){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}RE(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&u==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*IE),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const c=i&&!tc(u)?Ug:0,{x:f,y:m,z:y}=$E(e,d,s,l,c,u),{positionAbsolute:w}=e.internals,x=f!==w.x||m!==w.y;(x||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:m}:w,z:y}})}function Yg(e,t,n){const r=ft(e.zIndex)?e.zIndex:0;return tc(n)?r:r+(e.selected?t:0)}function $E(e,t,n,r,o,i){const{x:s,y:l}=t.internals.positionAbsolute,u=Ht(e),a=Vo(e,n),d=_r(e.extent)?An(a,e.extent,u):a;let c=An({x:s+d.x,y:l+d.y},r,u);e.extent==="parent"&&(c=Ag(c,u,t));const f=Yg(e,o,i),m=t.internals.z??0;return{x:c.x,y:c.y,z:m>=f?m+1:f}}function rc(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const a=((s=i.get(l.parentId))==null?void 0:s.expandedRect)??Er(u),d=$g(a,l.rect);i.set(l.parentId,{expandedRect:d,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},a)=>{var p;const d=u.internals.positionAbsolute,c=Ht(u),f=u.origin??r,m=l.x0||y>0||h||g)&&(o.push({id:a,type:"position",position:{x:u.position.x-m+h,y:u.position.y-y+g}}),(p=n.get(a))==null||p.forEach(v=>{e.some(E=>E.id===v.id)||o.push({id:v.id,type:"position",position:{x:v.position.x+m,y:v.position.y+y}})})),(c.width0){const m=rc(f,t,n,o);a.push(...m)}return{changes:a,updatedInternals:u}}async function FE({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),l=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(l)}function ed(e,t,n,r,o,i){let s=o;const l=r.get(s)||new Map;r.set(s,l.set(n,t)),s=`${o}-${e}`;const u=r.get(s)||new Map;if(r.set(s,u.set(n,t)),i){s=`${o}-${e}-${i}`;const a=r.get(s)||new Map;r.set(s,a.set(n,t))}}function Xg(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:l=null}=r,u={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:l},a=`${o}-${s}--${i}-${l}`,d=`${i}-${l}--${o}-${s}`;ed("source",u,d,e,o,s),ed("target",u,a,e,i,l),t.set(r.id,r)}}function Qg(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Qg(n,t):!1}function td(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function OE(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Qg(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const l=e.get(i);l&&o.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function Al({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,l,u;const o=[];for(const[a,d]of t){const c=(s=n.get(a))==null?void 0:s.internals.userNode;c&&o.push({...c,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:o[0],o]}function jE({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Bo(i,t);return{x:s.x-i.x,y:s.y-i.y}}function HE({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,l=new Map,u=!1,a={x:0,y:0},d=null,c=!1,f=null,m=!1,y=!1,w=null;function x({noDragClassName:g,handleSelector:p,domNode:v,isSelectable:E,nodeId:_,nodeClickDistance:N=0}){f=Ye(v);function P({x:R,y:H}){const{nodeLookup:C,nodeExtent:A,snapGrid:I,snapToGrid:D,nodeOrigin:k,onNodeDrag:S,onSelectionDrag:T,onError:O,updateNodePositions:F}=t();i={x:R,y:H};let W=!1;const V=l.size>1,U=V&&A?bu(bo(l)):null,Y=V&&D?jE({dragItems:l,snapGrid:I,x:R,y:H}):null;for(const[Q,B]of l){if(!C.has(Q))continue;let K={x:R-B.distance.x,y:H-B.distance.y};D&&(K=Y?{x:Math.round(K.x+Y.x),y:Math.round(K.y+Y.y)}:Bo(K,I));let ee=null;if(V&&A&&!B.extent&&U){const{positionAbsolute:Z}=B.internals,ie=Z.x-U.x+A[0][0],ue=Z.x+B.measured.width-U.x2+A[1][0],oe=Z.y-U.y+A[0][1],Pe=Z.y+B.measured.height-U.y2+A[1][1];ee=[[ie,oe],[ue,Pe]]}const{position:J,positionAbsolute:q}=Lg({nodeId:Q,nextPosition:K,nodeLookup:C,nodeExtent:ee||A,nodeOrigin:k,onError:O});W=W||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=q}if(y=y||W,!!W&&(F(l,!0),w&&(r||S||!_&&T))){const[Q,B]=Al({nodeId:_,dragItems:l,nodeLookup:C});r==null||r(w,l,Q,B),S==null||S(w,Q,B),_||T==null||T(w,B)}}async function L(){if(!d)return;const{transform:R,panBy:H,autoPanSpeed:C,autoPanOnNodeDrag:A}=t();if(!A){u=!1,cancelAnimationFrame(s);return}const[I,D]=Rg(a,d,C);(I!==0||D!==0)&&(i.x=(i.x??0)-I/R[2],i.y=(i.y??0)-D/R[2],await H({x:I,y:D})&&P(i)),s=requestAnimationFrame(L)}function j(R){var V;const{nodeLookup:H,multiSelectionActive:C,nodesDraggable:A,transform:I,snapGrid:D,snapToGrid:k,selectNodesOnDrag:S,onNodeDragStart:T,onSelectionDragStart:O,unselectNodesAndEdges:F}=t();c=!0,(!S||!E)&&!C&&_&&((V=H.get(_))!=null&&V.selected||F()),E&&S&&_&&(e==null||e(_));const W=so(R.sourceEvent,{transform:I,snapGrid:D,snapToGrid:k,containerBounds:d});if(i=W,l=OE(H,A,W,_),l.size>0&&(n||T||!_&&O)){const[U,Y]=Al({nodeId:_,dragItems:l,nodeLookup:H});n==null||n(R.sourceEvent,l,U,Y),T==null||T(R.sourceEvent,U,Y),_||O==null||O(R.sourceEvent,Y)}}const z=cg().clickDistance(N).on("start",R=>{const{domNode:H,nodeDragThreshold:C,transform:A,snapGrid:I,snapToGrid:D}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,m=!1,y=!1,w=R.sourceEvent,C===0&&j(R),i=so(R.sourceEvent,{transform:A,snapGrid:I,snapToGrid:D,containerBounds:d}),a=dt(R.sourceEvent,d)}).on("drag",R=>{const{autoPanOnNodeDrag:H,transform:C,snapGrid:A,snapToGrid:I,nodeDragThreshold:D,nodeLookup:k}=t(),S=so(R.sourceEvent,{transform:C,snapGrid:A,snapToGrid:I,containerBounds:d});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!k.has(_))&&(m=!0),!m){if(!u&&H&&c&&(u=!0,L()),!c){const T=dt(R.sourceEvent,d),O=T.x-a.x,F=T.y-a.y;Math.sqrt(O*O+F*F)>D&&j(R)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&l&&c&&(a=dt(R.sourceEvent,d),P(S))}}).on("end",R=>{if(!(!c||m)&&(u=!1,c=!1,cancelAnimationFrame(s),l.size>0)){const{nodeLookup:H,updateNodePositions:C,onNodeDragStop:A,onSelectionDragStop:I}=t();if(y&&(C(l,!1),y=!1),o||A||!_&&I){const[D,k]=Al({nodeId:_,dragItems:l,nodeLookup:H,dragging:!1});o==null||o(R.sourceEvent,l,D,k),A==null||A(R.sourceEvent,D,k),_||I==null||I(R.sourceEvent,k)}}}).filter(R=>{const H=R.target;return!R.button&&(!g||!td(H,`.${g}`,v))&&(!p||td(H,p,v))});f.call(z)}function h(){f==null||f.on(".drag",null)}return{update:x,destroy:h}}function VE(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())zo(o,Er(i))>0&&r.push(i);return r}const bE=250;function BE(e,t,n,r){var l,u;let o=[],i=1/0;const s=VE(e,n,t+bE);for(const a of s){const d=[...((l=a.internals.handleBounds)==null?void 0:l.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of d){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:f,y:m}=Rn(a,c,c.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(m-e.y,2));y>t||(y1){const a=r.type==="source"?"target":"source";return o.find(d=>d.type===a)??o[0]}return o[0]}function Gg(e,t,n,r,o,i=!1){var a,d,c;const s=r.get(e);if(!s)return null;const l=o==="strict"?(a=s.internals.handleBounds)==null?void 0:a[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((c=s.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Rn(s,u,u.position,!0)}:u}function Kg(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function WE(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Zg=()=>!0;function UE(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:l,nodeLookup:u,lib:a,autoPanOnConnect:d,flowId:c,panBy:f,cancelConnection:m,onConnectStart:y,onConnect:w,onConnectEnd:x,isValidConnection:h=Zg,onReconnectEnd:g,updateConnection:p,getTransform:v,getFromHandle:E,autoPanSpeed:_,dragThreshold:N=1,handleDomNode:P}){const L=Og(e.target);let j=0,z;const{x:R,y:H}=dt(e),C=Kg(i,P),A=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!A||!C)return;const D=Gg(o,C,r,u,t);if(!D)return;let k=dt(e,A),S=!1,T=null,O=!1,F=null;function W(){if(!d||!A)return;const[J,q]=Rg(k,A,_);f({x:J,y:q}),j=requestAnimationFrame(W)}const V={...D,nodeId:o,type:C,position:D.position},U=u.get(o);let Q={inProgress:!0,isValid:null,from:Rn(U,V,G.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:U,to:k,toHandle:null,toPosition:Bf[V.position],toNode:null,pointer:k};function B(){I=!0,p(Q),y==null||y(e,{nodeId:o,handleId:r,handleType:C})}N===0&&B();function K(J){if(!I){const{x:Pe,y:Vt}=dt(J),Nt=Pe-R,pn=Vt-H;if(!(Nt*Nt+pn*pn>N*N))return;B()}if(!E()||!V){ee(J);return}const q=v();k=dt(J,A),z=BE(Wo(k,q,!1,[1,1]),n,u,V),S||(W(),S=!0);const Z=qg(J,{handle:z,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:h,doc:L,lib:a,flowId:c,nodeLookup:u});F=Z.handleDomNode,T=Z.connection,O=WE(!!z,Z.isValid);const ie=u.get(o),ue=ie?Rn(ie,V,G.Left,!0):Q.from,oe={...Q,from:ue,isValid:O,to:Z.toHandle&&O?vs({x:Z.toHandle.x,y:Z.toHandle.y},q):k,toHandle:Z.toHandle,toPosition:O&&Z.toHandle?Z.toHandle.position:Bf[V.position],toNode:Z.toHandle?u.get(Z.toHandle.nodeId):null,pointer:k};p(oe),Q=oe}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(I){(z||F)&&T&&O&&(w==null||w(T));const{inProgress:q,...Z}=Q,ie={...Z,toPosition:Q.toHandle?Q.toPosition:null};x==null||x(J,ie),i&&(g==null||g(J,ie))}m(),cancelAnimationFrame(j),S=!1,O=!1,T=null,F=null,L.removeEventListener("mousemove",K),L.removeEventListener("mouseup",ee),L.removeEventListener("touchmove",K),L.removeEventListener("touchend",ee)}}L.addEventListener("mousemove",K),L.addEventListener("mouseup",ee),L.addEventListener("touchmove",K),L.addEventListener("touchend",ee)}function qg(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:l,flowId:u,isValidConnection:a=Zg,nodeLookup:d}){const c=i==="target",f=t?s.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=dt(e),w=s.elementFromPoint(m,y),x=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:f,h={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const g=Kg(void 0,x),p=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),E=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!p||!g)return h;const N={source:c?p:r,sourceHandle:c?v:o,target:c?r:p,targetHandle:c?o:v};h.connection=N;const L=E&&_&&(n===wr.Strict?c&&g==="source"||!c&&g==="target":p!==r||v!==o);h.isValid=L&&a(N),h.toHandle=Gg(p,g,v,d,n,!0)}return h}const Yu={onPointerDown:UE,isValid:qg};function YE({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Ye(e);function i({translateExtent:l,width:u,height:a,zoomStep:d=1,pannable:c=!0,zoomable:f=!0,inversePan:m=!1}){const y=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),E=p.sourceEvent.ctrlKey&&Lo()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,N=v[2]*Math.pow(2,_*E);t.scaleTo(N)};let w=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},h=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const E=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[E[0]-w[0],E[1]-w[1]];w=E;const N=r()*Math.max(v[2],Math.log(v[2]))*(m?-1:1),P={x:v[0]-_[0]*N,y:v[1]-_[1]*N},L=[[0,0],[u,a]];t.setViewportConstrained({x:P.x,y:P.y,zoom:v[2]},L,l)},g=Cg().on("start",x).on("zoom",c?h:null).on("zoom.wheel",f?y:null);o.call(g,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Xs=e=>({x:e.x,y:e.y,zoom:e.k}),Rl=({x:e,y:t,zoom:n})=>Bs.translate(e,t).scale(n),er=(e,t)=>e.target.closest(`.${t}`),Jg=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),XE=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$l=(e,t=0,n=XE,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},em=e=>{const t=e.ctrlKey&&Lo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function QE({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:a}){return d=>{if(er(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=ut(d),h=em(d),g=c*Math.pow(2,h);r.scaleTo(n,g,x,d);return}const f=d.deltaMode===1?20:1;let m=o===Cn.Vertical?0:d.deltaX*f,y=o===Cn.Horizontal?0:d.deltaY*f;!Lo()&&d.shiftKey&&o!==Cn.Vertical&&(m=d.deltaY*f,y=0),r.translateBy(n,-(m/c)*i,-(y/c)*i,{internal:!0});const w=Xs(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(d,w),e.panScrollTimeout=setTimeout(()=>{a==null||a(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,w))}}function GE({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,l=er(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),s||l)return null;r.preventDefault(),n.call(this,r,o)}}function KE({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Xs(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function ZE({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,l;e.usedRightMouseButton=!!(n&&Jg(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((l=i.sourceEvent)!=null&&l.internal)&&(o==null||o(i.sourceEvent,Xs(i.transform)))}}function qE({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var l;if(!((l=s.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&Jg(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=Xs(s.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,u)},n?150:0)}}}function JE({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:l,noPanClassName:u,lib:a,connectionInProgress:d}){return c=>{var x;const f=e||t,m=n&&c.ctrlKey,y=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(er(c,`${a}-flow__node`)||er(c,`${a}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!y||er(c,l)&&y||er(c,u)&&(!y||o&&y&&!e)||!n&&c.ctrlKey&&y)return!1;if(!n&&c.type==="touchstart"&&((x=c.touches)==null?void 0:x.length)>1)return c.preventDefault(),!1;if(!f&&!o&&!m&&y||!r&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(r)&&!r.includes(c.button)&&c.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||y)&&w}}function e_({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:u}){const a={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),c=Cg().scaleExtent([t,n]).translateExtent(r),f=Ye(e).call(c);g({x:o.x,y:o.y,zoom:Sr(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const m=f.on("wheel.zoom"),y=f.on("dblclick.zoom");c.wheelDelta(em);function w(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?io:Di).transform($l(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function x({noWheelClassName:z,noPanClassName:R,onPaneContextMenu:H,userSelectionActive:C,panOnScroll:A,panOnDrag:I,panOnScrollMode:D,panOnScrollSpeed:k,preventScrolling:S,zoomOnPinch:T,zoomOnScroll:O,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:V,onTransformChange:U,connectionInProgress:Y,paneClickDistance:Q,selectionOnDrag:B}){C&&!a.isZoomingOrPanning&&h();const K=A&&!W&&!C;c.clickDistance(B?1/0:!ft(Q)||Q<0?0:Q);const ee=K?QE({zoomPanValues:a,noWheelClassName:z,d3Selection:f,d3Zoom:c,panOnScrollMode:D,panOnScrollSpeed:k,zoomOnPinch:T,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:l}):GE({noWheelClassName:z,preventScrolling:S,d3ZoomHandler:m});if(f.on("wheel.zoom",ee,{passive:!1}),!C){const q=KE({zoomPanValues:a,onDraggingChange:u,onPanZoomStart:s});c.on("start",q);const Z=ZE({zoomPanValues:a,panOnDrag:I,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:U});c.on("zoom",Z);const ie=qE({zoomPanValues:a,panOnDrag:I,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:l,onDraggingChange:u});c.on("end",ie)}const J=JE({zoomActivationKeyPressed:W,panOnDrag:I,zoomOnScroll:O,panOnScroll:A,zoomOnDoubleClick:F,zoomOnPinch:T,userSelectionActive:C,noPanClassName:R,noWheelClassName:z,lib:V,connectionInProgress:Y});c.filter(J),F?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function h(){c.on("zoom",null)}async function g(z,R,H){const C=Rl(z),A=c==null?void 0:c.constrain()(C,R,H);return A&&await w(A),new Promise(I=>I(A))}async function p(z,R){const H=Rl(z);return await w(H,R),new Promise(C=>C(H))}function v(z){if(f){const R=Rl(z),H=f.property("__zoom");(H.k!==z.zoom||H.x!==z.x||H.y!==z.y)&&(c==null||c.transform(f,R,null,{sync:!0}))}}function E(){const z=f?kg(f.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function _(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?io:Di).scaleTo($l(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function N(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?io:Di).scaleBy($l(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function P(z){c==null||c.scaleExtent(z)}function L(z){c==null||c.translateExtent(z)}function j(z){const R=!ft(z)||z<0?0:z;c==null||c.clickDistance(R)}return{update:x,destroy:h,setViewport:p,setViewportConstrained:g,getViewport:E,scaleTo:_,scaleBy:N,setScaleExtent:P,setTranslateExtent:L,syncViewport:v,setClickDistance:j}}var kr;(function(e){e.Line="line",e.Handle="handle"})(kr||(kr={}));function t_({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,l=n-r,u=[s>0?1:s<0?-1:0,l>0?1:l<0?-1:0];return s&&o&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function nd(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Bt(e,t){return Math.max(0,t-e)}function Wt(e,t){return Math.max(0,e-t)}function yi(e,t,n){return Math.max(0,t-e,e-n)}function rd(e,t){return e?!t:t}function n_(e,t,n,r,o,i,s,l){let{affectsX:u,affectsY:a}=t;const{isHorizontal:d,isVertical:c}=t,f=d&&c,{xSnapped:m,ySnapped:y}=n,{minWidth:w,maxWidth:x,minHeight:h,maxHeight:g}=r,{x:p,y:v,width:E,height:_,aspectRatio:N}=e;let P=Math.floor(d?m-e.pointerX:0),L=Math.floor(c?y-e.pointerY:0);const j=E+(u?-P:P),z=_+(a?-L:L),R=-i[0]*E,H=-i[1]*_;let C=yi(j,w,x),A=yi(z,h,g);if(s){let k=0,S=0;u&&P<0?k=Bt(p+P+R,s[0][0]):!u&&P>0&&(k=Wt(p+j+R,s[1][0])),a&&L<0?S=Bt(v+L+H,s[0][1]):!a&&L>0&&(S=Wt(v+z+H,s[1][1])),C=Math.max(C,k),A=Math.max(A,S)}if(l){let k=0,S=0;u&&P>0?k=Wt(p+P,l[0][0]):!u&&P<0&&(k=Bt(p+j,l[1][0])),a&&L>0?S=Wt(v+L,l[0][1]):!a&&L<0&&(S=Bt(v+z,l[1][1])),C=Math.max(C,k),A=Math.max(A,S)}if(o){if(d){const k=yi(j/N,h,g)*N;if(C=Math.max(C,k),s){let S=0;!u&&!a||u&&!a&&f?S=Wt(v+H+j/N,s[1][1])*N:S=Bt(v+H+(u?P:-P)/N,s[0][1])*N,C=Math.max(C,S)}if(l){let S=0;!u&&!a||u&&!a&&f?S=Bt(v+j/N,l[1][1])*N:S=Wt(v+(u?P:-P)/N,l[0][1])*N,C=Math.max(C,S)}}if(c){const k=yi(z*N,w,x)/N;if(A=Math.max(A,k),s){let S=0;!u&&!a||a&&!u&&f?S=Wt(p+z*N+R,s[1][0])/N:S=Bt(p+(a?L:-L)*N+R,s[0][0])/N,A=Math.max(A,S)}if(l){let S=0;!u&&!a||a&&!u&&f?S=Bt(p+z*N,l[1][0])/N:S=Wt(p+(a?L:-L)*N,l[0][0])/N,A=Math.max(A,S)}}}L=L+(L<0?A:-A),P=P+(P<0?C:-C),o&&(f?j>z*N?L=(rd(u,a)?-P:P)/N:P=(rd(u,a)?-L:L)*N:d?(L=P/N,a=u):(P=L*N,u=a));const I=u?p+P:p,D=a?v+L:v;return{width:E+(u?-P:P),height:_+(a?-L:L),x:i[0]*P*(u?-1:1)+I,y:i[1]*L*(a?-1:1)+D}}const tm={width:0,height:0,x:0,y:0},r_={...tm,pointerX:0,pointerY:0,aspectRatio:1};function o_(e){return[[0,0],[e.measured.width,e.measured.height]]}function i_(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,l=n[0]*i,u=n[1]*s;return[[r-l,o-u],[r+i-l,o+s-u]]}function s_({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Ye(e);let s={controlDirection:nd("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:a,boundaries:d,keepAspectRatio:c,resizeDirection:f,onResizeStart:m,onResize:y,onResizeEnd:w,shouldResize:x}){let h={...tm},g={...r_};s={boundaries:d,resizeDirection:f,keepAspectRatio:c,controlDirection:nd(a)};let p,v=null,E=[],_,N,P,L=!1;const j=cg().on("start",z=>{const{nodeLookup:R,transform:H,snapGrid:C,snapToGrid:A,nodeOrigin:I,paneDomNode:D}=n();if(p=R.get(t),!p)return;v=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:k,ySnapped:S}=so(z.sourceEvent,{transform:H,snapGrid:C,snapToGrid:A,containerBounds:v});h={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},g={...h,pointerX:k,pointerY:S,aspectRatio:h.width/h.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=R.get(p.parentId),N=_&&p.extent==="parent"?o_(_):void 0),E=[],P=void 0;for(const[T,O]of R)if(O.parentId===t&&(E.push({id:T,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const F=i_(O,p,O.origin??I);P?P=[[Math.min(F[0][0],P[0][0]),Math.min(F[0][1],P[0][1])],[Math.max(F[1][0],P[1][0]),Math.max(F[1][1],P[1][1])]]:P=F}m==null||m(z,{...h})}).on("drag",z=>{const{transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A}=n(),I=so(z.sourceEvent,{transform:R,snapGrid:H,snapToGrid:C,containerBounds:v}),D=[];if(!p)return;const{x:k,y:S,width:T,height:O}=h,F={},W=p.origin??A,{width:V,height:U,x:Y,y:Q}=n_(g,s.controlDirection,I,s.boundaries,s.keepAspectRatio,W,N,P),B=V!==T,K=U!==O,ee=Y!==k&&B,J=Q!==S&&K;if(!ee&&!J&&!B&&!K)return;if((ee||J||W[0]===1||W[1]===1)&&(F.x=ee?Y:h.x,F.y=J?Q:h.y,h.x=F.x,h.y=F.y,E.length>0)){const ue=Y-k,oe=Q-S;for(const Pe of E)Pe.position={x:Pe.position.x-ue+W[0]*(V-T),y:Pe.position.y-oe+W[1]*(U-O)},D.push(Pe)}if((B||K)&&(F.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?V:h.width,F.height=K&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:h.height,h.width=F.width,h.height=F.height),_&&p.expandParent){const ue=W[0]*(F.width??0);F.x&&F.x{L&&(w==null||w(z,{...h}),o==null||o({...h}),L=!1)});i.call(j)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var nm={exports:{}},rm={},om={exports:{}},im={};/**
+`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Nl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Su(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var sw=typeof WeakMap=="function"?WeakMap:Map;function Ep(e,t,n){n=At(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ls||(ls=!0,zu=r),Su(e,t)},n}function _p(e,t,n){n=At(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Su(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Su(e,t),typeof r!="function"&&(rn===null?rn=new Set([this]):rn.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function uf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new sw;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=xw.bind(null,e,t,n),t.then(e,e))}function af(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function cf(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=At(-1,1),t.tag=2,nn(n,t,1))),n.lanes|=1),e)}var lw=jt.ReactCurrentOwner,Fe=!1;function Ae(e,t,n,r){t.child=e===null?qh(t,null,n,r):pr(t,e.child,n,r)}function ff(e,t,n,r,o){n=n.render;var i=t.ref;return lr(t,o),r=Pa(e,t,n,r,i,o),n=Ta(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ot(e,t,o)):(fe&&n&&ma(t),t.flags|=1,Ae(e,t,r,o),t.child)}function df(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!ja(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,kp(e,t,i,r,o)):(e=$i(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:mo,n(s,r)&&e.ref===t.ref)return Ot(e,t,o)}return t.flags|=1,e=sn(i,r),e.ref=t.ref,e.return=t,t.child=e}function kp(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(mo(i,r)&&e.ref===t.ref)if(Fe=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Fe=!0);else return t.lanes=e.lanes,Ot(e,t,o)}return Eu(e,t,n,r,o)}function Cp(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},le(er,Ue),Ue|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,le(er,Ue),Ue|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,le(er,Ue),Ue|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,le(er,Ue),Ue|=r;return Ae(e,t,o,n),t.child}function Np(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Eu(e,t,n,r,o){var i=Ve(n)?Nn:Le.current;return i=dr(t,i),lr(t,o),n=Pa(e,t,n,r,i,o),r=Ta(),e!==null&&!Fe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ot(e,t,o)):(fe&&r&&ma(t),t.flags|=1,Ae(e,t,n,o),t.child)}function hf(e,t,n,r,o){if(Ve(n)){var i=!0;Zi(t)}else i=!1;if(lr(t,o),t.stateNode===null)Li(e,t),Sp(t,n,r),xu(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var u=s.context,a=n.contextType;typeof a=="object"&&a!==null?a=rt(a):(a=Ve(n)?Nn:Le.current,a=dr(t,a));var d=n.getDerivedStateFromProps,c=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";c||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||u!==a)&&lf(t,s,r,a),Yt=!1;var f=t.memoizedState;s.state=f,ns(t,r,s,o),u=t.memoizedState,l!==r||f!==u||He.current||Yt?(typeof d=="function"&&(wu(t,n,d,r),u=t.memoizedState),(l=Yt||sf(t,n,l,r,f,u,a))?(c||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),s.props=r,s.state=u,s.context=a,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,ep(e,t),l=t.memoizedProps,a=t.type===t.elementType?l:st(t.type,l),s.props=a,c=t.pendingProps,f=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=rt(u):(u=Ve(n)?Nn:Le.current,u=dr(t,u));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==c||f!==u)&&lf(t,s,r,u),Yt=!1,f=t.memoizedState,s.state=f,ns(t,r,s,o);var y=t.memoizedState;l!==c||f!==y||He.current||Yt?(typeof m=="function"&&(wu(t,n,m,r),y=t.memoizedState),(a=Yt||sf(t,n,a,r,f,y,u)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,y,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,y,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),s.props=r,s.state=y,s.context=u,r=a):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return _u(e,t,n,r,i,o)}function _u(e,t,n,r,o,i){Np(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Zc(t,n,!1),Ot(e,t,i);r=t.stateNode,lw.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=pr(t,e.child,null,i),t.child=pr(t,null,l,i)):Ae(e,t,l,i),t.memoizedState=r.state,o&&Zc(t,n,!0),t.child}function Mp(e){var t=e.stateNode;t.pendingContext?Kc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Kc(e,t.context,!1),ka(e,t.containerInfo)}function pf(e,t,n,r,o){return hr(),va(o),t.flags|=256,Ae(e,t,n,r),t.child}var ku={dehydrated:null,treeContext:null,retryLane:0};function Cu(e){return{baseLanes:e,cachePool:null,transitions:null}}function Pp(e,t,n){var r=t.pendingProps,o=pe.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),le(pe,o&1),e===null)return yu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=$s(s,r,0,null),e=_n(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Cu(n),t.memoizedState=ku,e):La(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return uw(e,t,s,r,l,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,l=o.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=sn(o,u),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=sn(l,i):(i=_n(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Cu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=ku,r}return i=e.child,e=i.sibling,r=sn(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function La(e,t){return t=$s({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ui(e,t,n,r){return r!==null&&va(r),pr(t,e.child,null,n),e=La(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function uw(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Nl(Error(b(422))),ui(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=$s({mode:"visible",children:r.children},o,0,null),i=_n(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&pr(t,e.child,null,s),t.child.memoizedState=Cu(s),t.memoizedState=ku,i);if(!(t.mode&1))return ui(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(b(419)),r=Nl(i,r,void 0),ui(e,t,s,r)}if(l=(s&e.childLanes)!==0,Fe||l){if(r=ke,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Dt(e,o),pt(r,e,o,-1))}return Fa(),r=Nl(Error(b(421))),ui(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Sw.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Xe=tn(o.nextSibling),Qe=t,fe=!0,at=null,e!==null&&(Je[et++]=It,Je[et++]=zt,Je[et++]=Mn,It=e.id,zt=e.overflow,Mn=t),t=La(t,r.children),t.flags|=4096,t)}function gf(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),vu(e.return,t,n)}function Ml(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function Tp(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ae(e,t,r.children,n),r=pe.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gf(e,n,t);else if(e.tag===19)gf(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(le(pe,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&rs(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Ml(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&rs(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Ml(t,!0,n,null,i);break;case"together":Ml(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Li(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ot(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Tn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(b(153));if(t.child!==null){for(e=t.child,n=sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function aw(e,t,n){switch(t.tag){case 3:Mp(t),hr();break;case 5:tp(t);break;case 1:Ve(t.type)&&Zi(t);break;case 4:ka(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;le(es,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(le(pe,pe.current&1),t.flags|=128,null):n&t.child.childLanes?Pp(e,t,n):(le(pe,pe.current&1),e=Ot(e,t,n),e!==null?e.sibling:null);le(pe,pe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Tp(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),le(pe,pe.current),r)break;return null;case 22:case 23:return t.lanes=0,Cp(e,t,n)}return Ot(e,t,n)}var Ip,Nu,zp,Lp;Ip=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Nu=function(){};zp=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,xn(Et.current);var i=null;switch(n){case"input":o=Ql(e,o),r=Ql(e,r),i=[];break;case"select":o=me({},o,{value:void 0}),r=me({},r,{value:void 0}),i=[];break;case"textarea":o=Zl(e,o),r=Zl(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Gi)}Jl(n,r);var s;n=null;for(a in o)if(!r.hasOwnProperty(a)&&o.hasOwnProperty(a)&&o[a]!=null)if(a==="style"){var l=o[a];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else a!=="dangerouslySetInnerHTML"&&a!=="children"&&a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(uo.hasOwnProperty(a)?i||(i=[]):(i=i||[]).push(a,null));for(a in r){var u=r[a];if(l=o!=null?o[a]:void 0,r.hasOwnProperty(a)&&u!==l&&(u!=null||l!=null))if(a==="style")if(l){for(s in l)!l.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&l[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(i||(i=[]),i.push(a,n)),n=u;else a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(i=i||[]).push(a,u)):a==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(a,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&(uo.hasOwnProperty(a)?(u!=null&&a==="onScroll"&&ae("scroll",e),i||l===u||(i=[])):(i=i||[]).push(a,u))}n&&(i=i||[]).push("style",n);var a=i;(t.updateQueue=a)&&(t.flags|=4)}};Lp=function(e,t,n,r){n!==r&&(t.flags|=4)};function Vr(e,t){if(!fe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function cw(e,t,n){var r=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ve(t.type)&&Ki(),Ie(t),null;case 3:return r=t.stateNode,gr(),ce(He),ce(Le),Na(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(si(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,at!==null&&(Ru(at),at=null))),Nu(e,t),Ie(t),null;case 5:Ca(t);var o=xn(So.current);if(n=t.type,e!==null&&t.stateNode!=null)zp(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(b(166));return Ie(t),null}if(e=xn(Et.current),si(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[xt]=t,r[wo]=i,e=(t.mode&1)!==0,n){case"dialog":ae("cancel",r),ae("close",r);break;case"iframe":case"object":case"embed":ae("load",r);break;case"video":case"audio":for(o=0;o<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[xt]=t,e[wo]=r,Ip(e,t,!1,!1),t.stateNode=e;e:{switch(s=eu(n,r),n){case"dialog":ae("cancel",e),ae("close",e),o=r;break;case"iframe":case"object":case"embed":ae("load",e),o=r;break;case"video":case"audio":for(o=0;oyr&&(t.flags|=128,r=!0,Vr(i,!1),t.lanes=4194304)}else{if(!r)if(e=rs(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Vr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!fe)return Ie(t),null}else 2*ve()-i.renderingStartTime>yr&&n!==1073741824&&(t.flags|=128,r=!0,Vr(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ve(),t.sibling=null,n=pe.current,le(pe,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Oa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ue&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(b(156,t.tag))}function fw(e,t){switch(ya(t),t.tag){case 1:return Ve(t.type)&&Ki(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gr(),ce(He),ce(Le),Na(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ca(t),null;case 13:if(ce(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(b(340));hr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(pe),null;case 4:return gr(),null;case 10:return Sa(t.type._context),null;case 22:case 23:return Oa(),null;case 24:return null;default:return null}}var ai=!1,ze=!1,dw=typeof WeakSet=="function"?WeakSet:Set,X=null;function Jn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function Mu(e,t,n){try{n()}catch(r){ye(e,t,r)}}var mf=!1;function hw(e,t){if(cu=Yi,e=Oh(),ga(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,a=0,d=0,c=e,f=null;t:for(;;){for(var m;c!==n||o!==0&&c.nodeType!==3||(l=s+o),c!==i||r!==0&&c.nodeType!==3||(u=s+r),c.nodeType===3&&(s+=c.nodeValue.length),(m=c.firstChild)!==null;)f=c,c=m;for(;;){if(c===e)break t;if(f===n&&++a===o&&(l=s),f===i&&++d===r&&(u=s),(m=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=m}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(fu={focusedElem:e,selectionRange:n},Yi=!1,X=t;X!==null;)if(t=X,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,x=y.memoizedState,h=t.stateNode,g=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:st(t.type,w),x);h.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var p=t.stateNode.containerInfo;p.nodeType===1?p.textContent="":p.nodeType===9&&p.documentElement&&p.removeChild(p.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(b(163))}}catch(v){ye(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return y=mf,mf=!1,y}function ro(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Mu(t,n,i)}o=o.next}while(o!==r)}}function As(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Pu(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ap(e){var t=e.alternate;t!==null&&(e.alternate=null,Ap(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[xt],delete t[wo],delete t[pu],delete t[Gv],delete t[Kv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Rp(e){return e.tag===5||e.tag===3||e.tag===4}function yf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Gi));else if(r!==4&&(e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}function Iu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Iu(e,t,n),e=e.sibling;e!==null;)Iu(e,t,n),e=e.sibling}var Ce=null,lt=!1;function bt(e,t,n){for(n=n.child;n!==null;)$p(e,t,n),n=n.sibling}function $p(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(Cs,n)}catch{}switch(n.tag){case 5:ze||Jn(n,t);case 6:var r=Ce,o=lt;Ce=null,bt(e,t,n),Ce=r,lt=o,Ce!==null&&(lt?(e=Ce,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ce.removeChild(n.stateNode));break;case 18:Ce!==null&&(lt?(e=Ce,n=n.stateNode,e.nodeType===8?xl(e.parentNode,n):e.nodeType===1&&xl(e,n),po(e)):xl(Ce,n.stateNode));break;case 4:r=Ce,o=lt,Ce=n.stateNode.containerInfo,lt=!0,bt(e,t,n),Ce=r,lt=o;break;case 0:case 11:case 14:case 15:if(!ze&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Mu(n,t,s),o=o.next}while(o!==r)}bt(e,t,n);break;case 1:if(!ze&&(Jn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ye(n,t,l)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(ze=(r=ze)||n.memoizedState!==null,bt(e,t,n),ze=r):bt(e,t,n);break;default:bt(e,t,n)}}function vf(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dw),t.forEach(function(r){var o=Ew.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function it(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gw(r/1960))-r,10e?16:e,Zt===null)var r=!1;else{if(e=Zt,Zt=null,us=0,re&6)throw Error(b(331));var o=re;for(re|=4,X=e.current;X!==null;){var i=X,s=i.child;if(X.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uve()-$a?En(e,0):Ra|=n),be(e,t)}function Bp(e,t){t===0&&(e.mode&1?(t=ei,ei<<=1,!(ei&130023424)&&(ei=4194304)):t=1);var n=Re();e=Dt(e,t),e!==null&&(Do(e,t,n),be(e,n))}function Sw(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bp(e,n)}function Ew(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(b(314))}r!==null&&r.delete(t),Bp(e,n)}var Wp;Wp=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)Fe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fe=!1,aw(e,t,n);Fe=!!(e.flags&131072)}else Fe=!1,fe&&t.flags&1048576&&Qh(t,Ji,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Li(e,t),e=t.pendingProps;var o=dr(t,Le.current);lr(t,n),o=Pa(null,t,r,e,o,n);var i=Ta();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ve(r)?(i=!0,Zi(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,_a(t),o.updater=Ls,t.stateNode=o,o._reactInternals=t,xu(t,r,e,n),t=_u(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&ma(t),Ae(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Li(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=kw(r),e=st(r,e),o){case 0:t=Eu(null,t,r,e,n);break e;case 1:t=hf(null,t,r,e,n);break e;case 11:t=ff(null,t,r,e,n);break e;case 14:t=df(null,t,r,st(r.type,e),n);break e}throw Error(b(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Eu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),hf(e,t,r,o,n);case 3:e:{if(Mp(t),e===null)throw Error(b(387));r=t.pendingProps,i=t.memoizedState,o=i.element,ep(e,t),ns(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=mr(Error(b(423)),t),t=pf(e,t,r,n,o);break e}else if(r!==o){o=mr(Error(b(424)),t),t=pf(e,t,r,n,o);break e}else for(Xe=tn(t.stateNode.containerInfo.firstChild),Qe=t,fe=!0,at=null,n=qh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(hr(),r===o){t=Ot(e,t,n);break e}Ae(e,t,r,n)}t=t.child}return t;case 5:return tp(t),e===null&&yu(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,du(r,o)?s=null:i!==null&&du(r,i)&&(t.flags|=32),Np(e,t),Ae(e,t,s,n),t.child;case 6:return e===null&&yu(t),null;case 13:return Pp(e,t,n);case 4:return ka(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=pr(t,null,r,n):Ae(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),ff(e,t,r,o,n);case 7:return Ae(e,t,t.pendingProps,n),t.child;case 8:return Ae(e,t,t.pendingProps.children,n),t.child;case 12:return Ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,le(es,r._currentValue),r._currentValue=s,i!==null)if(gt(i.value,s)){if(i.children===o.children&&!He.current){t=Ot(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=At(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var d=a.pending;d===null?u.next=u:(u.next=d.next,d.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),vu(i.return,n,t),l.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(b(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),vu(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Ae(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,lr(t,n),o=rt(o),r=r(o),t.flags|=1,Ae(e,t,r,n),t.child;case 14:return r=t.type,o=st(r,t.pendingProps),o=st(r.type,o),df(e,t,r,o,n);case 15:return kp(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:st(r,o),Li(e,t),t.tag=1,Ve(r)?(e=!0,Zi(t)):e=!1,lr(t,n),Sp(t,r,o),xu(t,r,o,n),_u(null,t,r,!0,e,n);case 19:return Tp(e,t,n);case 22:return Cp(e,t,n)}throw Error(b(156,t.tag))};function Up(e,t){return vh(e,t)}function _w(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tt(e,t,n,r){return new _w(e,t,n,r)}function ja(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kw(e){if(typeof e=="function")return ja(e)?1:0;if(e!=null){if(e=e.$$typeof,e===oa)return 11;if(e===ia)return 14}return 2}function sn(e,t){var n=e.alternate;return n===null?(n=tt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function $i(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")ja(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Wn:return _n(n.children,o,i,t);case ra:s=8,o|=8;break;case Wl:return e=tt(12,n,t,o|2),e.elementType=Wl,e.lanes=i,e;case Ul:return e=tt(13,n,t,o),e.elementType=Ul,e.lanes=i,e;case Yl:return e=tt(19,n,t,o),e.elementType=Yl,e.lanes=i,e;case th:return $s(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Jd:s=10;break e;case eh:s=9;break e;case oa:s=11;break e;case ia:s=14;break e;case Ut:s=16,r=null;break e}throw Error(b(130,e==null?e:typeof e,""))}return t=tt(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function _n(e,t,n,r){return e=tt(7,e,r,t),e.lanes=n,e}function $s(e,t,n,r){return e=tt(22,e,r,t),e.elementType=th,e.lanes=n,e.stateNode={isHidden:!1},e}function Pl(e,t,n){return e=tt(6,e,null,t),e.lanes=n,e}function Tl(e,t,n){return t=tt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cw(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=al(0),this.expirationTimes=al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=al(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Ha(e,t,n,r,o,i,s,l,u){return e=new Cw(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=tt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_a(i),e}function Nw(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Gp)}catch(e){console.error(e)}}Gp(),Gd.exports=Ze;var zw=Gd.exports,Kp,Nf=zw;Kp=Nf.createRoot,Nf.hydrateRoot;function xe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function Hs(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Di.prototype=Hs.prototype={constructor:Di,on:function(e,t){var n=this._,r=Aw(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(o),r=0,o,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Pf.hasOwnProperty(t)?{space:Pf[t],local:e}:e}function $w(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$u&&t.documentElement.namespaceURI===$u?t.createElement(e):t.createElementNS(n,e)}}function Dw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zp(e){var t=Vs(e);return(t.local?Dw:$w)(t)}function Ow(){}function Wa(e){return e==null?Ow:function(){return this.querySelector(e)}}function Fw(e){typeof e!="function"&&(e=Wa(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=p&&(p=g+1);!(E=x[p])&&++p=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ax(e){e||(e=cx);function t(c,f){return c&&f?e(c.__data__,f.__data__):!c-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function fx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dx(){return Array.from(this)}function hx(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?kx:typeof t=="function"?Nx:Cx)(e,t,n??"")):vr(this.node(),e)}function vr(e,t){return e.style.getPropertyValue(t)||ng(e).getComputedStyle(e,null).getPropertyValue(t)}function Px(e){return function(){delete this[e]}}function Tx(e,t){return function(){this[e]=t}}function Ix(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zx(e,t){return arguments.length>1?this.each((t==null?Px:typeof t=="function"?Ix:Tx)(e,t)):this.node()[e]}function rg(e){return e.trim().split(/^|\s+/)}function Ua(e){return e.classList||new og(e)}function og(e){this._node=e,this._names=rg(e.getAttribute("class")||"")}og.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ig(e,t){for(var n=Ua(e),r=-1,o=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function i1(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n()=>e;function Du(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:l,dx:u,dy:a,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:a,enumerable:!0,configurable:!0},_:{value:d}})}Du.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function g1(e){return!e.ctrlKey&&!e.button}function m1(){return this.parentNode}function y1(e,t){return t??{x:e.x,y:e.y}}function v1(){return navigator.maxTouchPoints||"ontouchstart"in this}function fg(){var e=g1,t=m1,n=y1,r=v1,o={},i=Hs("start","drag","end"),s=0,l,u,a,d,c=0;function f(v){v.on("mousedown.drag",m).filter(r).on("touchstart.drag",x).on("touchmove.drag",h,p1).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(v,E){if(!(d||!e.call(this,v,E))){var _=p(this,t.call(this,v,E),v,E,"mouse");_&&(Ye(v.view).on("mousemove.drag",y,No).on("mouseup.drag",w,No),ag(v.view),Il(v),a=!1,l=v.clientX,u=v.clientY,_("start",v))}}function y(v){if(ar(v),!a){var E=v.clientX-l,_=v.clientY-u;a=E*E+_*_>c}o.mouse("drag",v)}function w(v){Ye(v.view).on("mousemove.drag mouseup.drag",null),cg(v.view,a),ar(v),o.mouse("end",v)}function x(v,E){if(e.call(this,v,E)){var _=v.changedTouches,N=t.call(this,v,E),P=_.length,L,j;for(L=0;L>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?hi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?hi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=x1.exec(e))?new je(t[1],t[2],t[3],1):(t=S1.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=E1.exec(e))?hi(t[1],t[2],t[3],t[4]):(t=_1.exec(e))?hi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=k1.exec(e))?$f(t[1],t[2]/100,t[3]/100,1):(t=C1.exec(e))?$f(t[1],t[2]/100,t[3]/100,t[4]):Tf.hasOwnProperty(e)?Lf(Tf[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function Lf(e){return new je(e>>16&255,e>>8&255,e&255,1)}function hi(e,t,n,r){return r<=0&&(e=t=n=NaN),new je(e,t,n,r)}function P1(e){return e instanceof Vo||(e=zn(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function Ou(e,t,n,r){return arguments.length===1?P1(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ya(je,Ou,dg(Vo,{brighter(e){return e=e==null?ds:Math.pow(ds,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mo:Math.pow(Mo,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(kn(this.r),kn(this.g),kn(this.b),hs(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:Af,formatHex:Af,formatHex8:T1,formatRgb:Rf,toString:Rf}));function Af(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}`}function T1(){return`#${Sn(this.r)}${Sn(this.g)}${Sn(this.b)}${Sn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rf(){const e=hs(this.opacity);return`${e===1?"rgb(":"rgba("}${kn(this.r)}, ${kn(this.g)}, ${kn(this.b)}${e===1?")":`, ${e})`}`}function hs(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function kn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sn(e){return e=kn(e),(e<16?"0":"")+e.toString(16)}function $f(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ct(e,t,n,r)}function hg(e){if(e instanceof ct)return new ct(e.h,e.s,e.l,e.opacity);if(e instanceof Vo||(e=zn(e)),!e)return new ct;if(e instanceof ct)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,l=i-o,u=(i+o)/2;return l?(t===i?s=(n-r)/l+(n0&&u<1?0:s,new ct(s,l,u,e.opacity)}function I1(e,t,n,r){return arguments.length===1?hg(e):new ct(e,t,n,r??1)}function ct(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ya(ct,I1,dg(Vo,{brighter(e){return e=e==null?ds:Math.pow(ds,e),new ct(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mo:Math.pow(Mo,e),new ct(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new je(zl(e>=240?e-240:e+120,o,r),zl(e,o,r),zl(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ct(Df(this.h),pi(this.s),pi(this.l),hs(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(){const e=hs(this.opacity);return`${e===1?"hsl(":"hsla("}${Df(this.h)}, ${pi(this.s)*100}%, ${pi(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Df(e){return e=(e||0)%360,e<0?e+360:e}function pi(e){return Math.max(0,Math.min(1,e||0))}function zl(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Xa=e=>()=>e;function z1(e,t){return function(n){return e+n*t}}function L1(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function A1(e){return(e=+e)==1?pg:function(t,n){return n-t?L1(t,n,e):Xa(isNaN(t)?n:t)}}function pg(e,t){var n=t-e;return n?z1(e,n):Xa(isNaN(e)?t:e)}const ps=function e(t){var n=A1(t);function r(o,i){var s=n((o=Ou(o)).r,(i=Ou(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),a=pg(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=l(d),o.b=u(d),o.opacity=a(d),o+""}}return r.gamma=e,r}(1);function R1(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;on&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(r=r[0])===(o=o[0])?l[s]?l[s]+=o:l[++s]=o:(l[++s]=null,u.push({i:s,x:wt(r,o)})),n=Ll.lastIndex;return n180?d+=360:d-a>180&&(a+=360),f.push({i:c.push(o(c)+"rotate(",null,r)-2,x:wt(a,d)})):d&&c.push(o(c)+"rotate("+d+r)}function l(a,d,c,f){a!==d?f.push({i:c.push(o(c)+"skewX(",null,r)-2,x:wt(a,d)}):d&&c.push(o(c)+"skewX("+d+r)}function u(a,d,c,f,m,y){if(a!==c||d!==f){var w=m.push(o(m)+"scale(",null,",",null,")");y.push({i:w-4,x:wt(a,c)},{i:w-2,x:wt(d,f)})}else(c!==1||f!==1)&&m.push(o(m)+"scale("+c+","+f+")")}return function(a,d){var c=[],f=[];return a=e(a),d=e(d),i(a.translateX,a.translateY,d.translateX,d.translateY,c,f),s(a.rotate,d.rotate,c,f),l(a.skewX,d.skewX,c,f),u(a.scaleX,a.scaleY,d.scaleX,d.scaleY,c,f),a=d=null,function(m){for(var y=-1,w=f.length,x;++y=0&&e._call.call(void 0,t),e=e._next;--wr}function jf(){Ln=(ms=To.now())+bs,wr=Gr=0;try{G1()}finally{wr=0,Z1(),Ln=0}}function K1(){var e=To.now(),t=e-ms;t>vg&&(bs-=t,ms=e)}function Z1(){for(var e,t=gs,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:gs=n);Kr=e,Hu(r)}function Hu(e){if(!wr){Gr&&(Gr=clearTimeout(Gr));var t=e-Ln;t>24?(e<1/0&&(Gr=setTimeout(jf,e-To.now()-bs)),Br&&(Br=clearInterval(Br))):(Br||(ms=To.now(),Br=setInterval(K1,vg)),wr=1,wg(jf))}}function Hf(e,t,n){var r=new ys;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var q1=Hs("start","end","cancel","interrupt"),J1=[],Sg=0,Vf=1,Vu=2,Fi=3,bf=4,bu=5,ji=6;function Bs(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;eS(e,n,{name:t,index:r,group:o,on:q1,tween:J1,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Sg})}function Ga(e,t){var n=mt(e,t);if(n.state>Sg)throw new Error("too late; already scheduled");return n}function Ct(e,t){var n=mt(e,t);if(n.state>Fi)throw new Error("too late; already running");return n}function mt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function eS(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=xg(i,0,n.time);function i(a){n.state=Vf,n.timer.restart(s,n.delay,n.time),n.delay<=a&&s(a-n.delay)}function s(a){var d,c,f,m;if(n.state!==Vf)return u();for(d in r)if(m=r[d],m.name===n.name){if(m.state===Fi)return Hf(s);m.state===bf?(m.state=ji,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[d]):+dVu&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function IS(e,t,n){var r,o,i=TS(t)?Ga:Ct;return function(){var s=i(this,e),l=s.on;l!==r&&(o=(r=l).copy()).on(t,n),s.on=o}}function zS(e,t){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(e):this.each(IS(n,e,t))}function LS(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function AS(){return this.on("end.remove",LS(this._id))}function RS(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wa(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s()=>e;function iE(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Lt(e,t,n){this.k=e,this.x=t,this.y=n}Lt.prototype={constructor:Lt,scale:function(e){return e===1?this:new Lt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ws=new Lt(1,0,0);Cg.prototype=Lt.prototype;function Cg(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ws;return e.__zoom}function Al(e){e.stopImmediatePropagation()}function Wr(e){e.preventDefault(),e.stopImmediatePropagation()}function sE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lE(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Bf(){return this.__zoom||Ws}function uE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function aE(){return navigator.maxTouchPoints||"ontouchstart"in this}function cE(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ng(){var e=sE,t=lE,n=cE,r=uE,o=aE,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Oi,a=Hs("start","zoom","end"),d,c,f,m=500,y=150,w=0,x=10;function h(C){C.property("__zoom",Bf).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}h.transform=function(C,A,I,D){var k=C.selection?C.selection():C;k.property("__zoom",Bf),C!==k?E(C,A,I,D):k.interrupt().each(function(){_(this,arguments).event(D).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},h.scaleBy=function(C,A,I,D){h.scaleTo(C,function(){var k=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return k*S},I,D)},h.scaleTo=function(C,A,I,D){h.transform(C,function(){var k=t.apply(this,arguments),S=this.__zoom,T=I==null?v(k):typeof I=="function"?I.apply(this,arguments):I,F=S.invert(T),O=typeof A=="function"?A.apply(this,arguments):A;return n(p(g(S,O),T,F),k,s)},I,D)},h.translateBy=function(C,A,I,D){h.transform(C,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),s)},null,D)},h.translateTo=function(C,A,I,D,k){h.transform(C,function(){var S=t.apply(this,arguments),T=this.__zoom,F=D==null?v(S):typeof D=="function"?D.apply(this,arguments):D;return n(Ws.translate(F[0],F[1]).scale(T.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof I=="function"?-I.apply(this,arguments):-I),S,s)},D,k)};function g(C,A){return A=Math.max(i[0],Math.min(i[1],A)),A===C.k?C:new Lt(A,C.x,C.y)}function p(C,A,I){var D=A[0]-I[0]*C.k,k=A[1]-I[1]*C.k;return D===C.x&&k===C.y?C:new Lt(C.k,D,k)}function v(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function E(C,A,I,D){C.on("start.zoom",function(){_(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(D).end()}).tween("zoom",function(){var k=this,S=arguments,T=_(k,S).event(D),F=t.apply(k,S),O=I==null?v(F):typeof I=="function"?I.apply(k,S):I,W=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),V=k.__zoom,U=typeof A=="function"?A.apply(k,S):A,Y=u(V.invert(O).concat(W/V.k),U.invert(O).concat(W/U.k));return function(Q){if(Q===1)Q=U;else{var B=Y(Q),K=W/B[2];Q=new Lt(K,O[0]-B[0]*K,O[1]-B[1]*K)}T.zoom(null,Q)}})}function _(C,A,I){return!I&&C.__zooming||new N(C,A)}function N(C,A){this.that=C,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,A),this.taps=0}N.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,A){return this.mouse&&C!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var A=Ye(this.that).datum();a.call(C,this.that,new iE(C,{sourceEvent:this.sourceEvent,target:h,transform:this.that.__zoom,dispatch:a}),A)}};function P(C,...A){if(!e.apply(this,arguments))return;var I=_(this,A).event(C),D=this.__zoom,k=Math.max(i[0],Math.min(i[1],D.k*Math.pow(2,r.apply(this,arguments)))),S=ut(C);if(I.wheel)(I.mouse[0][0]!==S[0]||I.mouse[0][1]!==S[1])&&(I.mouse[1]=D.invert(I.mouse[0]=S)),clearTimeout(I.wheel);else{if(D.k===k)return;I.mouse=[S,D.invert(S)],Hi(this),I.start()}Wr(C),I.wheel=setTimeout(T,y),I.zoom("mouse",n(p(g(D,k),I.mouse[0],I.mouse[1]),I.extent,s));function T(){I.wheel=null,I.end()}}function L(C,...A){if(f||!e.apply(this,arguments))return;var I=C.currentTarget,D=_(this,A,!0).event(C),k=Ye(C.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",W,!0),S=ut(C,I),T=C.clientX,F=C.clientY;ag(C.view),Al(C),D.mouse=[S,this.__zoom.invert(S)],Hi(this),D.start();function O(V){if(Wr(V),!D.moved){var U=V.clientX-T,Y=V.clientY-F;D.moved=U*U+Y*Y>w}D.event(V).zoom("mouse",n(p(D.that.__zoom,D.mouse[0]=ut(V,I),D.mouse[1]),D.extent,s))}function W(V){k.on("mousemove.zoom mouseup.zoom",null),cg(V.view,D.moved),Wr(V),D.event(V).end()}}function j(C,...A){if(e.apply(this,arguments)){var I=this.__zoom,D=ut(C.changedTouches?C.changedTouches[0]:C,this),k=I.invert(D),S=I.k*(C.shiftKey?.5:2),T=n(p(g(I,S),D,k),t.apply(this,A),s);Wr(C),l>0?Ye(this).transition().duration(l).call(E,T,D,C):Ye(this).call(h.transform,T,D,C)}}function z(C,...A){if(e.apply(this,arguments)){var I=C.touches,D=I.length,k=_(this,A,C.changedTouches.length===D).event(C),S,T,F,O;for(Al(C),T=0;T"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Io=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Mg=["Enter"," ","Escape"],Pg={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var xr;(function(e){e.Strict="strict",e.Loose="loose"})(xr||(xr={}));var Cn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cn||(Cn={}));var zo;(function(e){e.Partial="partial",e.Full="full"})(zo||(zo={}));const Tg={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Gt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Gt||(Gt={}));var Sr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Sr||(Sr={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Wf={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Ig(e){return e===null?null:e?"valid":"invalid"}const zg=e=>"id"in e&&"source"in e&&"target"in e,fE=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Za=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bo=(e,t=[0,0])=>{const{width:n,height:r}=Ht(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Lg=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):Za(o)?o:t.nodeLookup.get(o.id));const l=s?vs(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Us(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ys(n)},Bo=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Us(n,vs(o)),r=!0)}),r?Ys(n):{x:0,y:0,width:0,height:0}},qa=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const l={...Uo(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const a of e.values()){const{measured:d,selectable:c=!0,hidden:f=!1}=a;if(s&&!c||f)continue;const m=d.width??a.width??a.initialWidth??null,y=d.height??a.height??a.initialHeight??null,w=Lo(l,_r(a)),x=(m??0)*(y??0),h=i&&w>0;(!a.internals.handleBounds||h||w>=x||a.dragging)&&u.push(a)}return u},dE=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function hE(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function pE({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const l=hE(e,s),u=Bo(l),a=Xs(u,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(a,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Ag({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),l=s.parentId?n.get(s.parentId):void 0,{x:u,y:a}=l?l.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let c=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!l)i==null||i("005",kt.error005());else{const m=l.measured.width,y=l.measured.height;m&&y&&(c=[[u,a],[u+m,a+y]])}else l&&kr(s.extent)&&(c=[[s.extent[0][0]+u,s.extent[0][1]+a],[s.extent[1][0]+u,s.extent[1][1]+a]]);const f=kr(c)?An(t,c,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",kt.error015())),{position:{x:f.x-u+(s.measured.width??0)*d[0],y:f.y-a+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function gE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const m=i.has(f.id),y=!m&&f.parentId&&s.find(w=>w.id===f.parentId);(m||y)&&s.push(f)}const l=new Set(t.map(f=>f.id)),u=r.filter(f=>f.deletable!==!1),d=dE(s,u);for(const f of u)l.has(f.id)&&!d.find(y=>y.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const c=await o({nodes:s,edges:d});return typeof c=="boolean"?c?{edges:d,nodes:s}:{edges:[],nodes:[]}:c}const Er=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),An=(e={x:0,y:0},t,n)=>({x:Er(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Er(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Rg(e,t,n){const{width:r,height:o}=Ht(n),{x:i,y:s}=n.internals.positionAbsolute;return An(e,[[i,s],[i+r,s+o]],t)}const Uf=(e,t,n)=>en?-Er(Math.abs(e-n),1,t)/t:0,$g=(e,t,n=15,r=40)=>{const o=Uf(e.x,r,t.width-r)*n,i=Uf(e.y,r,t.height-r)*n;return[o,i]},Us=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Bu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ys=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_r=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Za(e)?e.internals.positionAbsolute:bo(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},vs=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Za(e)?e.internals.positionAbsolute:bo(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Dg=(e,t)=>Ys(Us(Bu(e),Bu(t))),Lo=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Yf=e=>ft(e.width)&&ft(e.height)&&ft(e.x)&&ft(e.y),ft=e=>!isNaN(e)&&isFinite(e),mE=(e,t)=>{},Wo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Uo=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Wo(l,s):l},ws=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function jn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function yE(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=jn(e,n),o=jn(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=jn(e.top??e.y??0,n),o=jn(e.bottom??e.y??0,n),i=jn(e.left??e.x??0,t),s=jn(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vE(e,t,n,r,o,i){const{x:s,y:l}=ws(e,[t,n,r]),{x:u,y:a}=ws({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-u,c=i-a;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(c)}}const Xs=(e,t,n,r,o,i)=>{const s=yE(i,t,n),l=(t-s.x)/e.width,u=(n-s.y)/e.height,a=Math.min(l,u),d=Er(a,r,o),c=e.x+e.width/2,f=e.y+e.height/2,m=t/2-c*d,y=n/2-f*d,w=vE(e,m,y,d,t,n),x={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:m-x.left+x.right,y:y-x.top+x.bottom,zoom:d}},Ao=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function kr(e){return e!=null&&e!=="parent"}function Ht(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Og(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Fg(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const l=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function Xf(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wE(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function xE(e){return{...Pg,...e||{}}}function lo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=dt(e),l=Uo({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:u,y:a}=n?Wo(l,t):l;return{xSnapped:u,ySnapped:a,...l}}const Ja=e=>({width:e.offsetWidth,height:e.offsetHeight}),jg=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},SE=["INPUT","SELECT","TEXTAREA"];function Hg(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:SE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Vg=e=>"clientX"in e,dt=(e,t)=>{var i,s;const n=Vg(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Qf=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const l=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Ja(s)}})};function bg({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:l}){const u=e*.125+o*.375+s*.375+n*.125,a=t*.125+i*.375+l*.375+r*.125,d=Math.abs(u-e),c=Math.abs(a-t);return[u,a,d,c]}function yi(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Gf({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case G.Left:return[t-yi(t-r,i),n];case G.Right:return[t+yi(r-t,i),n];case G.Top:return[t,n-yi(n-o,i)];case G.Bottom:return[t,n+yi(o-n,i)]}}function Bg({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[l,u]=Gf({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[a,d]=Gf({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[c,f,m,y]=bg({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:a,targetControlY:d});return[`M${e},${t} C${l},${u} ${a},${d} ${r},${o}`,c,f,m,y]}function Wg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n0}const kE=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,CE=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),NE=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||kE;let o;return zg(e)?o={...e}:o={...e,id:r(e)},CE(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Ug({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,l]=Wg({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,l]}const Kf={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},ME=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function PE({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const l=Kf[t],u=Kf[r],a={x:e.x+l.x*i,y:e.y+l.y*i},d={x:n.x+u.x*i,y:n.y+u.y*i},c=ME({source:a,sourcePosition:t,target:d}),f=c.x!==0?"x":"y",m=c[f];let y=[],w,x;const h={x:0,y:0},g={x:0,y:0},[,,p,v]=Wg({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*u[f]===-1){f==="x"?(w=o.x??a.x+(d.x-a.x)*s,x=o.y??(a.y+d.y)/2):(w=o.x??(a.x+d.x)/2,x=o.y??a.y+(d.y-a.y)*s);const _=[{x:w,y:a.y},{x:w,y:d.y}],N=[{x:a.x,y:x},{x:d.x,y:x}];l[f]===m?y=f==="x"?_:N:y=f==="x"?N:_}else{const _=[{x:a.x,y:d.y}],N=[{x:d.x,y:a.y}];if(f==="x"?y=l.x===m?N:_:y=l.y===m?_:N,t===r){const R=Math.abs(e[f]-n[f]);if(R<=i){const H=Math.min(i-1,i-R);l[f]===m?h[f]=(a[f]>e[f]?-1:1)*H:g[f]=(d[f]>n[f]?-1:1)*H}}if(t!==r){const R=f==="x"?"y":"x",H=l[f]===u[R],C=a[R]>d[R],A=a[R]=z?(w=(P.x+L.x)/2,x=y[0].y):(w=y[0].x,x=(P.y+L.y)/2)}return[[e,{x:a.x+h.x,y:a.y+h.y},...y,{x:d.x+g.x,y:d.y+g.y},n],w,x,p,v]}function TE(e,t,n,r){const o=Math.min(Zf(e,t)/2,Zf(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const a=e.x{let v="";return p>0&&pn.id===t):e[0])||null}function Uu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function zE(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,l)=>([l.markerStart||r,l.markerEnd||o].forEach(u=>{if(u&&typeof u=="object"){const a=Uu(u,t);i.has(a)||(s.push({id:a,color:u.color||n,...u}),i.add(a))}}),s),[]).sort((s,l)=>s.id.localeCompare(l.id))}const Yg=1e3,LE=10,ec={nodeOrigin:[0,0],nodeExtent:Io,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},AE={...ec,checkEquality:!0};function tc(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function RE(e,t,n){const r=tc(ec,n);for(const o of e.values())if(o.parentId)rc(o,e,t,r);else{const i=bo(o,r.nodeOrigin),s=kr(o.extent)?o.extent:r.nodeExtent,l=An(i,s,Ht(o));o.internals.positionAbsolute=l}}function $E(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function nc(e){return e==="manual"}function Yu(e,t,n,r={}){var a,d;const o=tc(AE,r),i={i:0},s=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!nc(o.zIndexMode)?Yg:0;let u=e.length>0;t.clear(),n.clear();for(const c of e){let f=s.get(c.id);if(o.checkEquality&&c===(f==null?void 0:f.internals.userNode))t.set(c.id,f);else{const m=bo(c,o.nodeOrigin),y=kr(c.extent)?c.extent:o.nodeExtent,w=An(m,y,Ht(c));f={...o.defaults,...c,measured:{width:(a=c.measured)==null?void 0:a.width,height:(d=c.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:$E(c,f),z:Xg(c,l,o.zIndexMode),userNode:c}},t.set(c.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(u=!1),c.parentId&&rc(f,t,n,r,i)}return u}function DE(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function rc(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:l,zIndexMode:u}=tc(ec,r),a=e.parentId,d=t.get(a);if(!d){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}DE(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&u==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*LE),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const c=i&&!nc(u)?Yg:0,{x:f,y:m,z:y}=OE(e,d,s,l,c,u),{positionAbsolute:w}=e.internals,x=f!==w.x||m!==w.y;(x||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:m}:w,z:y}})}function Xg(e,t,n){const r=ft(e.zIndex)?e.zIndex:0;return nc(n)?r:r+(e.selected?t:0)}function OE(e,t,n,r,o,i){const{x:s,y:l}=t.internals.positionAbsolute,u=Ht(e),a=bo(e,n),d=kr(e.extent)?An(a,e.extent,u):a;let c=An({x:s+d.x,y:l+d.y},r,u);e.extent==="parent"&&(c=Rg(c,u,t));const f=Xg(e,o,i),m=t.internals.z??0;return{x:c.x,y:c.y,z:m>=f?m+1:f}}function oc(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const a=((s=i.get(l.parentId))==null?void 0:s.expandedRect)??_r(u),d=Dg(a,l.rect);i.set(l.parentId,{expandedRect:d,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},a)=>{var p;const d=u.internals.positionAbsolute,c=Ht(u),f=u.origin??r,m=l.x0||y>0||h||g)&&(o.push({id:a,type:"position",position:{x:u.position.x-m+h,y:u.position.y-y+g}}),(p=n.get(a))==null||p.forEach(v=>{e.some(E=>E.id===v.id)||o.push({id:v.id,type:"position",position:{x:v.position.x+m,y:v.position.y+y}})})),(c.width0){const m=oc(f,t,n,o);a.push(...m)}return{changes:a,updatedInternals:u}}async function jE({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),l=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(l)}function td(e,t,n,r,o,i){let s=o;const l=r.get(s)||new Map;r.set(s,l.set(n,t)),s=`${o}-${e}`;const u=r.get(s)||new Map;if(r.set(s,u.set(n,t)),i){s=`${o}-${e}-${i}`;const a=r.get(s)||new Map;r.set(s,a.set(n,t))}}function Qg(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:l=null}=r,u={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:l},a=`${o}-${s}--${i}-${l}`,d=`${i}-${l}--${o}-${s}`;td("source",u,d,e,o,s),td("target",u,a,e,i,l),t.set(r.id,r)}}function Gg(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Gg(n,t):!1}function nd(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function HE(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Gg(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const l=e.get(i);l&&o.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function Rl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,l,u;const o=[];for(const[a,d]of t){const c=(s=n.get(a))==null?void 0:s.internals.userNode;c&&o.push({...c,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:o[0],o]}function VE({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Wo(i,t);return{x:s.x-i.x,y:s.y-i.y}}function bE({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,l=new Map,u=!1,a={x:0,y:0},d=null,c=!1,f=null,m=!1,y=!1,w=null;function x({noDragClassName:g,handleSelector:p,domNode:v,isSelectable:E,nodeId:_,nodeClickDistance:N=0}){f=Ye(v);function P({x:R,y:H}){const{nodeLookup:C,nodeExtent:A,snapGrid:I,snapToGrid:D,nodeOrigin:k,onNodeDrag:S,onSelectionDrag:T,onError:F,updateNodePositions:O}=t();i={x:R,y:H};let W=!1;const V=l.size>1,U=V&&A?Bu(Bo(l)):null,Y=V&&D?VE({dragItems:l,snapGrid:I,x:R,y:H}):null;for(const[Q,B]of l){if(!C.has(Q))continue;let K={x:R-B.distance.x,y:H-B.distance.y};D&&(K=Y?{x:Math.round(K.x+Y.x),y:Math.round(K.y+Y.y)}:Wo(K,I));let ee=null;if(V&&A&&!B.extent&&U){const{positionAbsolute:Z}=B.internals,ie=Z.x-U.x+A[0][0],ue=Z.x+B.measured.width-U.x2+A[1][0],oe=Z.y-U.y+A[0][1],Pe=Z.y+B.measured.height-U.y2+A[1][1];ee=[[ie,oe],[ue,Pe]]}const{position:J,positionAbsolute:q}=Ag({nodeId:Q,nextPosition:K,nodeLookup:C,nodeExtent:ee||A,nodeOrigin:k,onError:F});W=W||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=q}if(y=y||W,!!W&&(O(l,!0),w&&(r||S||!_&&T))){const[Q,B]=Rl({nodeId:_,dragItems:l,nodeLookup:C});r==null||r(w,l,Q,B),S==null||S(w,Q,B),_||T==null||T(w,B)}}async function L(){if(!d)return;const{transform:R,panBy:H,autoPanSpeed:C,autoPanOnNodeDrag:A}=t();if(!A){u=!1,cancelAnimationFrame(s);return}const[I,D]=$g(a,d,C);(I!==0||D!==0)&&(i.x=(i.x??0)-I/R[2],i.y=(i.y??0)-D/R[2],await H({x:I,y:D})&&P(i)),s=requestAnimationFrame(L)}function j(R){var V;const{nodeLookup:H,multiSelectionActive:C,nodesDraggable:A,transform:I,snapGrid:D,snapToGrid:k,selectNodesOnDrag:S,onNodeDragStart:T,onSelectionDragStart:F,unselectNodesAndEdges:O}=t();c=!0,(!S||!E)&&!C&&_&&((V=H.get(_))!=null&&V.selected||O()),E&&S&&_&&(e==null||e(_));const W=lo(R.sourceEvent,{transform:I,snapGrid:D,snapToGrid:k,containerBounds:d});if(i=W,l=HE(H,A,W,_),l.size>0&&(n||T||!_&&F)){const[U,Y]=Rl({nodeId:_,dragItems:l,nodeLookup:H});n==null||n(R.sourceEvent,l,U,Y),T==null||T(R.sourceEvent,U,Y),_||F==null||F(R.sourceEvent,Y)}}const z=fg().clickDistance(N).on("start",R=>{const{domNode:H,nodeDragThreshold:C,transform:A,snapGrid:I,snapToGrid:D}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,m=!1,y=!1,w=R.sourceEvent,C===0&&j(R),i=lo(R.sourceEvent,{transform:A,snapGrid:I,snapToGrid:D,containerBounds:d}),a=dt(R.sourceEvent,d)}).on("drag",R=>{const{autoPanOnNodeDrag:H,transform:C,snapGrid:A,snapToGrid:I,nodeDragThreshold:D,nodeLookup:k}=t(),S=lo(R.sourceEvent,{transform:C,snapGrid:A,snapToGrid:I,containerBounds:d});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!k.has(_))&&(m=!0),!m){if(!u&&H&&c&&(u=!0,L()),!c){const T=dt(R.sourceEvent,d),F=T.x-a.x,O=T.y-a.y;Math.sqrt(F*F+O*O)>D&&j(R)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&l&&c&&(a=dt(R.sourceEvent,d),P(S))}}).on("end",R=>{if(!(!c||m)&&(u=!1,c=!1,cancelAnimationFrame(s),l.size>0)){const{nodeLookup:H,updateNodePositions:C,onNodeDragStop:A,onSelectionDragStop:I}=t();if(y&&(C(l,!1),y=!1),o||A||!_&&I){const[D,k]=Rl({nodeId:_,dragItems:l,nodeLookup:H,dragging:!1});o==null||o(R.sourceEvent,l,D,k),A==null||A(R.sourceEvent,D,k),_||I==null||I(R.sourceEvent,k)}}}).filter(R=>{const H=R.target;return!R.button&&(!g||!nd(H,`.${g}`,v))&&(!p||nd(H,p,v))});f.call(z)}function h(){f==null||f.on(".drag",null)}return{update:x,destroy:h}}function BE(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Lo(o,_r(i))>0&&r.push(i);return r}const WE=250;function UE(e,t,n,r){var l,u;let o=[],i=1/0;const s=BE(e,n,t+WE);for(const a of s){const d=[...((l=a.internals.handleBounds)==null?void 0:l.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of d){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:f,y:m}=Rn(a,c,c.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(m-e.y,2));y>t||(y1){const a=r.type==="source"?"target":"source";return o.find(d=>d.type===a)??o[0]}return o[0]}function Kg(e,t,n,r,o,i=!1){var a,d,c;const s=r.get(e);if(!s)return null;const l=o==="strict"?(a=s.internals.handleBounds)==null?void 0:a[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((c=s.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Rn(s,u,u.position,!0)}:u}function Zg(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function YE(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qg=()=>!0;function XE(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:l,nodeLookup:u,lib:a,autoPanOnConnect:d,flowId:c,panBy:f,cancelConnection:m,onConnectStart:y,onConnect:w,onConnectEnd:x,isValidConnection:h=qg,onReconnectEnd:g,updateConnection:p,getTransform:v,getFromHandle:E,autoPanSpeed:_,dragThreshold:N=1,handleDomNode:P}){const L=jg(e.target);let j=0,z;const{x:R,y:H}=dt(e),C=Zg(i,P),A=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!A||!C)return;const D=Kg(o,C,r,u,t);if(!D)return;let k=dt(e,A),S=!1,T=null,F=!1,O=null;function W(){if(!d||!A)return;const[J,q]=$g(k,A,_);f({x:J,y:q}),j=requestAnimationFrame(W)}const V={...D,nodeId:o,type:C,position:D.position},U=u.get(o);let Q={inProgress:!0,isValid:null,from:Rn(U,V,G.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:U,to:k,toHandle:null,toPosition:Wf[V.position],toNode:null,pointer:k};function B(){I=!0,p(Q),y==null||y(e,{nodeId:o,handleId:r,handleType:C})}N===0&&B();function K(J){if(!I){const{x:Pe,y:Vt}=dt(J),Nt=Pe-R,pn=Vt-H;if(!(Nt*Nt+pn*pn>N*N))return;B()}if(!E()||!V){ee(J);return}const q=v();k=dt(J,A),z=UE(Uo(k,q,!1,[1,1]),n,u,V),S||(W(),S=!0);const Z=Jg(J,{handle:z,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:h,doc:L,lib:a,flowId:c,nodeLookup:u});O=Z.handleDomNode,T=Z.connection,F=YE(!!z,Z.isValid);const ie=u.get(o),ue=ie?Rn(ie,V,G.Left,!0):Q.from,oe={...Q,from:ue,isValid:F,to:Z.toHandle&&F?ws({x:Z.toHandle.x,y:Z.toHandle.y},q):k,toHandle:Z.toHandle,toPosition:F&&Z.toHandle?Z.toHandle.position:Wf[V.position],toNode:Z.toHandle?u.get(Z.toHandle.nodeId):null,pointer:k};p(oe),Q=oe}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(I){(z||O)&&T&&F&&(w==null||w(T));const{inProgress:q,...Z}=Q,ie={...Z,toPosition:Q.toHandle?Q.toPosition:null};x==null||x(J,ie),i&&(g==null||g(J,ie))}m(),cancelAnimationFrame(j),S=!1,F=!1,T=null,O=null,L.removeEventListener("mousemove",K),L.removeEventListener("mouseup",ee),L.removeEventListener("touchmove",K),L.removeEventListener("touchend",ee)}}L.addEventListener("mousemove",K),L.addEventListener("mouseup",ee),L.addEventListener("touchmove",K),L.addEventListener("touchend",ee)}function Jg(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:l,flowId:u,isValidConnection:a=qg,nodeLookup:d}){const c=i==="target",f=t?s.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y}=dt(e),w=s.elementFromPoint(m,y),x=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:f,h={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const g=Zg(void 0,x),p=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),E=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!p||!g)return h;const N={source:c?p:r,sourceHandle:c?v:o,target:c?r:p,targetHandle:c?o:v};h.connection=N;const L=E&&_&&(n===xr.Strict?c&&g==="source"||!c&&g==="target":p!==r||v!==o);h.isValid=L&&a(N),h.toHandle=Kg(p,g,v,d,n,!0)}return h}const Xu={onPointerDown:XE,isValid:Jg};function QE({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Ye(e);function i({translateExtent:l,width:u,height:a,zoomStep:d=1,pannable:c=!0,zoomable:f=!0,inversePan:m=!1}){const y=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),E=p.sourceEvent.ctrlKey&&Ao()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,N=v[2]*Math.pow(2,_*E);t.scaleTo(N)};let w=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},h=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const E=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[E[0]-w[0],E[1]-w[1]];w=E;const N=r()*Math.max(v[2],Math.log(v[2]))*(m?-1:1),P={x:v[0]-_[0]*N,y:v[1]-_[1]*N},L=[[0,0],[u,a]];t.setViewportConstrained({x:P.x,y:P.y,zoom:v[2]},L,l)},g=Ng().on("start",x).on("zoom",c?h:null).on("zoom.wheel",f?y:null);o.call(g,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Qs=e=>({x:e.x,y:e.y,zoom:e.k}),$l=({x:e,y:t,zoom:n})=>Ws.translate(e,t).scale(n),tr=(e,t)=>e.target.closest(`.${t}`),em=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),GE=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Dl=(e,t=0,n=GE,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},tm=e=>{const t=e.ctrlKey&&Ao()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function KE({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:a}){return d=>{if(tr(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=ut(d),h=tm(d),g=c*Math.pow(2,h);r.scaleTo(n,g,x,d);return}const f=d.deltaMode===1?20:1;let m=o===Cn.Vertical?0:d.deltaX*f,y=o===Cn.Horizontal?0:d.deltaY*f;!Ao()&&d.shiftKey&&o!==Cn.Vertical&&(m=d.deltaY*f,y=0),r.translateBy(n,-(m/c)*i,-(y/c)*i,{internal:!0});const w=Qs(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(d,w),e.panScrollTimeout=setTimeout(()=>{a==null||a(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,w))}}function ZE({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,l=tr(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),s||l)return null;r.preventDefault(),n.call(this,r,o)}}function qE({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Qs(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function JE({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,l;e.usedRightMouseButton=!!(n&&em(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((l=i.sourceEvent)!=null&&l.internal)&&(o==null||o(i.sourceEvent,Qs(i.transform)))}}function e_({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var l;if(!((l=s.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&em(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=Qs(s.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,u)},n?150:0)}}}function t_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:l,noPanClassName:u,lib:a,connectionInProgress:d}){return c=>{var x;const f=e||t,m=n&&c.ctrlKey,y=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(tr(c,`${a}-flow__node`)||tr(c,`${a}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!y||tr(c,l)&&y||tr(c,u)&&(!y||o&&y&&!e)||!n&&c.ctrlKey&&y)return!1;if(!n&&c.type==="touchstart"&&((x=c.touches)==null?void 0:x.length)>1)return c.preventDefault(),!1;if(!f&&!o&&!m&&y||!r&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(r)&&!r.includes(c.button)&&c.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||y)&&w}}function n_({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:u}){const a={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),c=Ng().scaleExtent([t,n]).translateExtent(r),f=Ye(e).call(c);g({x:o.x,y:o.y,zoom:Er(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const m=f.on("wheel.zoom"),y=f.on("dblclick.zoom");c.wheelDelta(tm);function w(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?so:Oi).transform(Dl(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function x({noWheelClassName:z,noPanClassName:R,onPaneContextMenu:H,userSelectionActive:C,panOnScroll:A,panOnDrag:I,panOnScrollMode:D,panOnScrollSpeed:k,preventScrolling:S,zoomOnPinch:T,zoomOnScroll:F,zoomOnDoubleClick:O,zoomActivationKeyPressed:W,lib:V,onTransformChange:U,connectionInProgress:Y,paneClickDistance:Q,selectionOnDrag:B}){C&&!a.isZoomingOrPanning&&h();const K=A&&!W&&!C;c.clickDistance(B?1/0:!ft(Q)||Q<0?0:Q);const ee=K?KE({zoomPanValues:a,noWheelClassName:z,d3Selection:f,d3Zoom:c,panOnScrollMode:D,panOnScrollSpeed:k,zoomOnPinch:T,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:l}):ZE({noWheelClassName:z,preventScrolling:S,d3ZoomHandler:m});if(f.on("wheel.zoom",ee,{passive:!1}),!C){const q=qE({zoomPanValues:a,onDraggingChange:u,onPanZoomStart:s});c.on("start",q);const Z=JE({zoomPanValues:a,panOnDrag:I,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:U});c.on("zoom",Z);const ie=e_({zoomPanValues:a,panOnDrag:I,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:l,onDraggingChange:u});c.on("end",ie)}const J=t_({zoomActivationKeyPressed:W,panOnDrag:I,zoomOnScroll:F,panOnScroll:A,zoomOnDoubleClick:O,zoomOnPinch:T,userSelectionActive:C,noPanClassName:R,noWheelClassName:z,lib:V,connectionInProgress:Y});c.filter(J),O?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function h(){c.on("zoom",null)}async function g(z,R,H){const C=$l(z),A=c==null?void 0:c.constrain()(C,R,H);return A&&await w(A),new Promise(I=>I(A))}async function p(z,R){const H=$l(z);return await w(H,R),new Promise(C=>C(H))}function v(z){if(f){const R=$l(z),H=f.property("__zoom");(H.k!==z.zoom||H.x!==z.x||H.y!==z.y)&&(c==null||c.transform(f,R,null,{sync:!0}))}}function E(){const z=f?Cg(f.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function _(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?so:Oi).scaleTo(Dl(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function N(z,R){return f?new Promise(H=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?so:Oi).scaleBy(Dl(f,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function P(z){c==null||c.scaleExtent(z)}function L(z){c==null||c.translateExtent(z)}function j(z){const R=!ft(z)||z<0?0:z;c==null||c.clickDistance(R)}return{update:x,destroy:h,setViewport:p,setViewportConstrained:g,getViewport:E,scaleTo:_,scaleBy:N,setScaleExtent:P,setTranslateExtent:L,syncViewport:v,setClickDistance:j}}var Cr;(function(e){e.Line="line",e.Handle="handle"})(Cr||(Cr={}));function r_({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,l=n-r,u=[s>0?1:s<0?-1:0,l>0?1:l<0?-1:0];return s&&o&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function rd(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Bt(e,t){return Math.max(0,t-e)}function Wt(e,t){return Math.max(0,e-t)}function vi(e,t,n){return Math.max(0,t-e,e-n)}function od(e,t){return e?!t:t}function o_(e,t,n,r,o,i,s,l){let{affectsX:u,affectsY:a}=t;const{isHorizontal:d,isVertical:c}=t,f=d&&c,{xSnapped:m,ySnapped:y}=n,{minWidth:w,maxWidth:x,minHeight:h,maxHeight:g}=r,{x:p,y:v,width:E,height:_,aspectRatio:N}=e;let P=Math.floor(d?m-e.pointerX:0),L=Math.floor(c?y-e.pointerY:0);const j=E+(u?-P:P),z=_+(a?-L:L),R=-i[0]*E,H=-i[1]*_;let C=vi(j,w,x),A=vi(z,h,g);if(s){let k=0,S=0;u&&P<0?k=Bt(p+P+R,s[0][0]):!u&&P>0&&(k=Wt(p+j+R,s[1][0])),a&&L<0?S=Bt(v+L+H,s[0][1]):!a&&L>0&&(S=Wt(v+z+H,s[1][1])),C=Math.max(C,k),A=Math.max(A,S)}if(l){let k=0,S=0;u&&P>0?k=Wt(p+P,l[0][0]):!u&&P<0&&(k=Bt(p+j,l[1][0])),a&&L>0?S=Wt(v+L,l[0][1]):!a&&L<0&&(S=Bt(v+z,l[1][1])),C=Math.max(C,k),A=Math.max(A,S)}if(o){if(d){const k=vi(j/N,h,g)*N;if(C=Math.max(C,k),s){let S=0;!u&&!a||u&&!a&&f?S=Wt(v+H+j/N,s[1][1])*N:S=Bt(v+H+(u?P:-P)/N,s[0][1])*N,C=Math.max(C,S)}if(l){let S=0;!u&&!a||u&&!a&&f?S=Bt(v+j/N,l[1][1])*N:S=Wt(v+(u?P:-P)/N,l[0][1])*N,C=Math.max(C,S)}}if(c){const k=vi(z*N,w,x)/N;if(A=Math.max(A,k),s){let S=0;!u&&!a||a&&!u&&f?S=Wt(p+z*N+R,s[1][0])/N:S=Bt(p+(a?L:-L)*N+R,s[0][0])/N,A=Math.max(A,S)}if(l){let S=0;!u&&!a||a&&!u&&f?S=Bt(p+z*N,l[1][0])/N:S=Wt(p+(a?L:-L)*N,l[0][0])/N,A=Math.max(A,S)}}}L=L+(L<0?A:-A),P=P+(P<0?C:-C),o&&(f?j>z*N?L=(od(u,a)?-P:P)/N:P=(od(u,a)?-L:L)*N:d?(L=P/N,a=u):(P=L*N,u=a));const I=u?p+P:p,D=a?v+L:v;return{width:E+(u?-P:P),height:_+(a?-L:L),x:i[0]*P*(u?-1:1)+I,y:i[1]*L*(a?-1:1)+D}}const nm={width:0,height:0,x:0,y:0},i_={...nm,pointerX:0,pointerY:0,aspectRatio:1};function s_(e){return[[0,0],[e.measured.width,e.measured.height]]}function l_(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,l=n[0]*i,u=n[1]*s;return[[r-l,o-u],[r+i-l,o+s-u]]}function u_({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Ye(e);let s={controlDirection:rd("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:a,boundaries:d,keepAspectRatio:c,resizeDirection:f,onResizeStart:m,onResize:y,onResizeEnd:w,shouldResize:x}){let h={...nm},g={...i_};s={boundaries:d,resizeDirection:f,keepAspectRatio:c,controlDirection:rd(a)};let p,v=null,E=[],_,N,P,L=!1;const j=fg().on("start",z=>{const{nodeLookup:R,transform:H,snapGrid:C,snapToGrid:A,nodeOrigin:I,paneDomNode:D}=n();if(p=R.get(t),!p)return;v=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:k,ySnapped:S}=lo(z.sourceEvent,{transform:H,snapGrid:C,snapToGrid:A,containerBounds:v});h={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},g={...h,pointerX:k,pointerY:S,aspectRatio:h.width/h.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=R.get(p.parentId),N=_&&p.extent==="parent"?s_(_):void 0),E=[],P=void 0;for(const[T,F]of R)if(F.parentId===t&&(E.push({id:T,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const O=l_(F,p,F.origin??I);P?P=[[Math.min(O[0][0],P[0][0]),Math.min(O[0][1],P[0][1])],[Math.max(O[1][0],P[1][0]),Math.max(O[1][1],P[1][1])]]:P=O}m==null||m(z,{...h})}).on("drag",z=>{const{transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A}=n(),I=lo(z.sourceEvent,{transform:R,snapGrid:H,snapToGrid:C,containerBounds:v}),D=[];if(!p)return;const{x:k,y:S,width:T,height:F}=h,O={},W=p.origin??A,{width:V,height:U,x:Y,y:Q}=o_(g,s.controlDirection,I,s.boundaries,s.keepAspectRatio,W,N,P),B=V!==T,K=U!==F,ee=Y!==k&&B,J=Q!==S&&K;if(!ee&&!J&&!B&&!K)return;if((ee||J||W[0]===1||W[1]===1)&&(O.x=ee?Y:h.x,O.y=J?Q:h.y,h.x=O.x,h.y=O.y,E.length>0)){const ue=Y-k,oe=Q-S;for(const Pe of E)Pe.position={x:Pe.position.x-ue+W[0]*(V-T),y:Pe.position.y-oe+W[1]*(U-F)},D.push(Pe)}if((B||K)&&(O.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?V:h.width,O.height=K&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:h.height,h.width=O.width,h.height=O.height),_&&p.expandParent){const ue=W[0]*(O.width??0);O.x&&O.x{L&&(w==null||w(z,{...h}),o==null||o({...h}),L=!1)});i.call(j)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var rm={exports:{}},om={},im={exports:{}},sm={};/**
* @license React
* use-sync-external-store-shim.production.js
*
@@ -45,7 +45,7 @@ Error generating stack: `+i.message+`
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var Cr=$;function l_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var u_=typeof Object.is=="function"?Object.is:l_,a_=Cr.useState,c_=Cr.useEffect,f_=Cr.useLayoutEffect,d_=Cr.useDebugValue;function h_(e,t){var n=t(),r=a_({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return f_(function(){o.value=n,o.getSnapshot=t,Dl(o)&&i({inst:o})},[e,n,t]),c_(function(){return Dl(o)&&i({inst:o}),e(function(){Dl(o)&&i({inst:o})})},[e]),d_(n),n}function Dl(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!u_(e,n)}catch{return!0}}function p_(e,t){return t()}var g_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p_:h_;im.useSyncExternalStore=Cr.useSyncExternalStore!==void 0?Cr.useSyncExternalStore:g_;om.exports=im;var m_=om.exports;/**
+ */var Nr=$;function a_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var c_=typeof Object.is=="function"?Object.is:a_,f_=Nr.useState,d_=Nr.useEffect,h_=Nr.useLayoutEffect,p_=Nr.useDebugValue;function g_(e,t){var n=t(),r=f_({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return h_(function(){o.value=n,o.getSnapshot=t,Ol(o)&&i({inst:o})},[e,n,t]),d_(function(){return Ol(o)&&i({inst:o}),e(function(){Ol(o)&&i({inst:o})})},[e]),p_(n),n}function Ol(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!c_(e,n)}catch{return!0}}function m_(e,t){return t()}var y_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m_:g_;sm.useSyncExternalStore=Nr.useSyncExternalStore!==void 0?Nr.useSyncExternalStore:y_;im.exports=sm;var v_=im.exports;/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
@@ -53,11 +53,11 @@ Error generating stack: `+i.message+`
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var Qs=$,y_=m_;function v_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var w_=typeof Object.is=="function"?Object.is:v_,x_=y_.useSyncExternalStore,S_=Qs.useRef,E_=Qs.useEffect,__=Qs.useMemo,k_=Qs.useDebugValue;rm.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=S_(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=__(function(){function u(m){if(!a){if(a=!0,d=m,m=r(m),o!==void 0&&s.hasValue){var y=s.value;if(o(y,m))return c=y}return c=m}if(y=c,w_(d,m))return y;var w=r(m);return o!==void 0&&o(y,w)?(d=m,y):(d=m,c=w)}var a=!1,d,c,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,o]);var l=x_(e,i[0],i[1]);return E_(function(){s.hasValue=!0,s.value=l},[l]),k_(l),l};nm.exports=rm;var C_=nm.exports;const N_=Dd(C_),M_={},od=e=>{let t;const n=new Set,r=(d,c)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const m=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(y=>y(t,m))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(M_?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,u);return u},P_=e=>e?od(e):od,{useDebugValue:T_}=vy,{useSyncExternalStoreWithSelector:I_}=N_,z_=e=>e;function sm(e,t=z_,n){const r=I_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return T_(r),r}const id=(e,t)=>{const n=P_(e),r=(o,i=t)=>sm(n,o,i);return Object.assign(r,n),r},L_=(e,t)=>e?id(e,t):id;function de(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Gs=$.createContext(null),A_=Gs.Provider,lm=kt.error001();function ne(e,t){const n=$.useContext(Gs);if(n===null)throw new Error(lm);return sm(n,e,t)}function he(){const e=$.useContext(Gs);if(e===null)throw new Error(lm);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const sd={display:"none"},R_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},um="react-flow__node-desc",am="react-flow__edge-desc",$_="react-flow__aria-live",D_=e=>e.ariaLiveMessage,F_=e=>e.ariaLabelConfig;function O_({rfId:e}){const t=ne(D_);return M.jsx("div",{id:`${$_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:R_,children:t})}function j_({rfId:e,disableKeyboardA11y:t}){const n=ne(F_);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${um}-${e}`,style:sd,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${am}-${e}`,style:sd,children:n["edge.a11yDescription.default"]}),!t&&M.jsx(O_,{rfId:e})]})}const Ks=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return M.jsx("div",{className:xe(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Ks.displayName="Panel";function H_({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:M.jsx(Ks,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const V_=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},vi=e=>e.id;function b_(e,t){return de(e.selectedNodes.map(vi),t.selectedNodes.map(vi))&&de(e.selectedEdges.map(vi),t.selectedEdges.map(vi))}function B_({onSelectionChange:e}){const t=he(),{selectedNodes:n,selectedEdges:r}=ne(V_,b_);return $.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const W_=e=>!!e.onSelectionChangeHandlers;function U_({onSelectionChange:e}){const t=ne(W_);return e||t?M.jsx(B_,{onSelectionChange:e}):null}const cm=[0,0],Y_={x:0,y:0,zoom:1},X_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ld=[...X_,"rfId"],Q_=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ud={translateExtent:To,nodeOrigin:cm,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function G_(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:u}=ne(Q_,de),a=he();$.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{d.current=ud,l()}),[]);const d=$.useRef(ud);return $.useEffect(()=>{for(const c of ld){const f=e[c],m=d.current[c];f!==m&&(typeof e[c]>"u"||(c==="nodes"?t(f):c==="edges"?n(f):c==="minZoom"?r(f):c==="maxZoom"?o(f):c==="translateExtent"?i(f):c==="nodeExtent"?s(f):c==="ariaLabelConfig"?a.setState({ariaLabelConfig:vE(f)}):c==="fitView"?a.setState({fitViewQueued:f}):c==="fitViewOptions"?a.setState({fitViewOptions:f}):a.setState({[c]:f})))}d.current=e},ld.map(c=>e[c])),null}function ad(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function K_(e){var r;const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=ad(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=ad())!=null&&r.matches?"dark":"light"}const cd=typeof document<"u"?document:null;function Ao(e=null,t={target:cd,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),o=$.useRef(!1),i=$.useRef(new Set([])),[s,l]=$.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
+ */var Gs=$,w_=v_;function x_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var S_=typeof Object.is=="function"?Object.is:x_,E_=w_.useSyncExternalStore,__=Gs.useRef,k_=Gs.useEffect,C_=Gs.useMemo,N_=Gs.useDebugValue;om.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=__(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=C_(function(){function u(m){if(!a){if(a=!0,d=m,m=r(m),o!==void 0&&s.hasValue){var y=s.value;if(o(y,m))return c=y}return c=m}if(y=c,S_(d,m))return y;var w=r(m);return o!==void 0&&o(y,w)?(d=m,y):(d=m,c=w)}var a=!1,d,c,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,o]);var l=E_(e,i[0],i[1]);return k_(function(){s.hasValue=!0,s.value=l},[l]),N_(l),l};rm.exports=om;var M_=rm.exports;const P_=Od(M_),T_={},id=e=>{let t;const n=new Set,r=(d,c)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const m=t;t=c??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(y=>y(t,m))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(T_?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(r,o,u);return u},I_=e=>e?id(e):id,{useDebugValue:z_}=xy,{useSyncExternalStoreWithSelector:L_}=P_,A_=e=>e;function lm(e,t=A_,n){const r=L_(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return z_(r),r}const sd=(e,t)=>{const n=I_(e),r=(o,i=t)=>lm(n,o,i);return Object.assign(r,n),r},R_=(e,t)=>e?sd(e,t):sd;function de(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Ks=$.createContext(null),$_=Ks.Provider,um=kt.error001();function ne(e,t){const n=$.useContext(Ks);if(n===null)throw new Error(um);return lm(n,e,t)}function he(){const e=$.useContext(Ks);if(e===null)throw new Error(um);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ld={display:"none"},D_={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},am="react-flow__node-desc",cm="react-flow__edge-desc",O_="react-flow__aria-live",F_=e=>e.ariaLiveMessage,j_=e=>e.ariaLabelConfig;function H_({rfId:e}){const t=ne(F_);return M.jsx("div",{id:`${O_}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:D_,children:t})}function V_({rfId:e,disableKeyboardA11y:t}){const n=ne(j_);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${am}-${e}`,style:ld,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${cm}-${e}`,style:ld,children:n["edge.a11yDescription.default"]}),!t&&M.jsx(H_,{rfId:e})]})}const Zs=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return M.jsx("div",{className:xe(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Zs.displayName="Panel";function b_({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:M.jsx(Zs,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const B_=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},wi=e=>e.id;function W_(e,t){return de(e.selectedNodes.map(wi),t.selectedNodes.map(wi))&&de(e.selectedEdges.map(wi),t.selectedEdges.map(wi))}function U_({onSelectionChange:e}){const t=he(),{selectedNodes:n,selectedEdges:r}=ne(B_,W_);return $.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Y_=e=>!!e.onSelectionChangeHandlers;function X_({onSelectionChange:e}){const t=ne(Y_);return e||t?M.jsx(U_,{onSelectionChange:e}):null}const fm=[0,0],Q_={x:0,y:0,zoom:1},G_=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ud=[...G_,"rfId"],K_=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),ad={translateExtent:Io,nodeOrigin:fm,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Z_(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:u}=ne(K_,de),a=he();$.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{d.current=ad,l()}),[]);const d=$.useRef(ad);return $.useEffect(()=>{for(const c of ud){const f=e[c],m=d.current[c];f!==m&&(typeof e[c]>"u"||(c==="nodes"?t(f):c==="edges"?n(f):c==="minZoom"?r(f):c==="maxZoom"?o(f):c==="translateExtent"?i(f):c==="nodeExtent"?s(f):c==="ariaLabelConfig"?a.setState({ariaLabelConfig:xE(f)}):c==="fitView"?a.setState({fitViewQueued:f}):c==="fitViewOptions"?a.setState({fitViewOptions:f}):a.setState({[c]:f})))}d.current=e},ud.map(c=>e[c])),null}function cd(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function q_(e){var r;const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=cd(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=cd())!=null&&r.matches?"dark":"light"}const fd=typeof document<"u"?document:null;function Ro(e=null,t={target:fd,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),o=$.useRef(!1),i=$.useRef(new Set([])),[s,l]=$.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",`
`).replace(`
`,`
+`).split(`
-`)),d=a.reduce((c,f)=>c.concat(...f),[]);return[a,d]}return[[],[]]},[e]);return $.useEffect(()=>{const u=(t==null?void 0:t.target)??cd,a=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var x,h;if(o.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!o.current||o.current&&!a)&&jg(m))return!1;const w=dd(m.code,l);if(i.current.add(m[w]),fd(s,i.current,!1)){const g=((h=(x=m.composedPath)==null?void 0:x.call(m))==null?void 0:h[0])||m.target,p=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&m.preventDefault(),r(!0)}},c=m=>{const y=dd(m.code,l);fd(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),o.current=!1},f=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",d),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{u==null||u.removeEventListener("keydown",d),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function fd(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function dd(e,t){return t.includes(e)?"code":"key"}const Z_=()=>{const e=he();return $.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:l}=e.getState(),u=Ys(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:l,y:u}=s.getBoundingClientRect(),a={x:t.x-l,y:t.y-u},d=n.snapGrid??o,c=n.snapToGrid??i;return Wo(a,r,c,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=vs(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function fm(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const l={...i};for(const u of s)q_(u,l);n.push(l)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function q_(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function dm(e,t){return fm(e,t)}function hm(e,t){return fm(e,t)}function yn(e,t){return{id:e,type:"select",selected:t}}function tr(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(yn(i.id,s)))}return r}function hd({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const l=t.get(s.id),u=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;u!==void 0&&u!==s&&n.push({id:s.id,item:s,type:"replace"}),u===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function pd(e){return{id:e.id,type:"remove"}}const gd=e=>aE(e),J_=e=>Ig(e);function pm(e){return $.forwardRef(e)}const e2=typeof window<"u"?$.useLayoutEffect:$.useEffect;function md(e){const[t,n]=$.useState(BigInt(0)),[r]=$.useState(()=>t2(()=>n(o=>o+BigInt(1))));return e2(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function t2(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const gm=$.createContext(null);function n2({children:e}){const t=he(),n=$.useCallback(l=>{const{nodes:u=[],setNodes:a,hasDefaultNodes:d,onNodesChange:c,nodeLookup:f,fitViewQueued:m,onNodesChangeMiddlewareMap:y}=t.getState();let w=u;for(const h of l)w=typeof h=="function"?h(w):h;let x=hd({items:w,lookup:f});for(const h of y.values())x=h(x);d&&a(w),x.length>0?c==null||c(x):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:h,nodes:g,setNodes:p}=t.getState();h&&p(g)})},[]),r=md(n),o=$.useCallback(l=>{const{edges:u=[],setEdges:a,hasDefaultEdges:d,onEdgesChange:c,edgeLookup:f}=t.getState();let m=u;for(const y of l)m=typeof y=="function"?y(m):y;d?a(m):c&&c(hd({items:m,lookup:f}))},[]),i=md(o),s=$.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return M.jsx(gm.Provider,{value:s,children:e})}function r2(){const e=$.useContext(gm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const o2=e=>!!e.panZoom;function Uo(){const e=Z_(),t=he(),n=r2(),r=ne(o2),o=$.useMemo(()=>{const i=c=>t.getState().nodeLookup.get(c),s=c=>{n.nodeQueue.push(c)},l=c=>{n.edgeQueue.push(c)},u=c=>{var h,g;const{nodeLookup:f,nodeOrigin:m}=t.getState(),y=gd(c)?c:f.get(c.id),w=y.parentId?Fg(y.position,y.measured,y.parentId,f,m):y.position,x={...y,position:w,width:((h=y.measured)==null?void 0:h.width)??y.width,height:((g=y.measured)==null?void 0:g.height)??y.height};return Er(x)},a=(c,f,m={replace:!1})=>{s(y=>y.map(w=>{if(w.id===c){const x=typeof f=="function"?f(w):f;return m.replace&&gd(x)?x:{...w,...x}}return w}))},d=(c,f,m={replace:!1})=>{l(y=>y.map(w=>{if(w.id===c){const x=typeof f=="function"?f(w):f;return m.replace&&J_(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var f;return(f=i(c))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(f=>({...f}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:s,setEdges:l,addNodes:c=>{const f=Array.isArray(c)?c:[c];n.nodeQueue.push(m=>[...m,...f])},addEdges:c=>{const f=Array.isArray(c)?c:[c];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:c=[],edges:f=[],transform:m}=t.getState(),[y,w,x]=m;return{nodes:c.map(h=>({...h})),edges:f.map(h=>({...h})),viewport:{x:y,y:w,zoom:x}}},deleteElements:async({nodes:c=[],edges:f=[]})=>{const{nodes:m,edges:y,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:h,triggerEdgeChanges:g,onDelete:p,onBeforeDelete:v}=t.getState(),{nodes:E,edges:_}=await hE({nodesToRemove:c,edgesToRemove:f,nodes:m,edges:y,onBeforeDelete:v}),N=_.length>0,P=E.length>0;if(N){const L=_.map(pd);x==null||x(_),g(L)}if(P){const L=E.map(pd);w==null||w(E),h(L)}return(P||N)&&(p==null||p({nodes:E,edges:_})),{deletedNodes:E,deletedEdges:_}},getIntersectingNodes:(c,f=!0,m)=>{const y=Uf(c),w=y?c:u(c),x=m!==void 0;return w?(m||t.getState().nodes).filter(h=>{const g=t.getState().nodeLookup.get(h.id);if(g&&!y&&(h.id===c.id||!g.internals.positionAbsolute))return!1;const p=Er(x?h:g),v=zo(p,w);return f&&v>0||v>=p.width*p.height||v>=w.width*w.height}):[]},isNodeIntersecting:(c,f,m=!0)=>{const w=Uf(c)?c:u(c);if(!w)return!1;const x=zo(w,f);return m&&x>0||x>=f.width*f.height||x>=w.width*w.height},updateNode:a,updateNodeData:(c,f,m={replace:!1})=>{a(c,y=>{const w=typeof f=="function"?f(y):f;return m.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},m)},updateEdge:d,updateEdgeData:(c,f,m={replace:!1})=>{d(c,y=>{const w=typeof f=="function"?f(y):f;return m.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},m)},getNodesBounds:c=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return zg(c,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:c,id:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${c}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:c,handleId:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${c?f?`-${c}-${f}`:`-${c}`:""}`))==null?void 0:y.values())??[])},fitView:async c=>{const f=t.getState().fitViewResolver??yE();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return $.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const yd=e=>e.selected,i2=typeof window<"u"?window:void 0;function s2({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=he(),{deleteElements:r}=Uo(),o=Ao(e,{actInsideInputWithModifier:!1}),i=Ao(t,{target:i2});$.useEffect(()=>{if(o){const{edges:s,nodes:l}=n.getState();r({nodes:l.filter(yd),edges:s.filter(yd)}),n.setState({nodesSelectionActive:!1})}},[o]),$.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function l2(e){const t=he();$.useEffect(()=>{const n=()=>{var o,i,s,l;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=qa(e.current);(r.height===0||r.width===0)&&((l=(s=t.getState()).onError)==null||l.call(s,"004",kt.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Zs={position:"absolute",width:"100%",height:"100%",top:0,left:0},u2=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function a2({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Cn.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:a,minZoom:d,maxZoom:c,zoomActivationKeyCode:f,preventScrolling:m=!0,children:y,noWheelClassName:w,noPanClassName:x,onViewportChange:h,isControlledViewport:g,paneClickDistance:p,selectionOnDrag:v}){const E=he(),_=$.useRef(null),{userSelectionActive:N,lib:P,connectionInProgress:L}=ne(u2,de),j=Ao(f),z=$.useRef();l2(_);const R=$.useCallback(H=>{h==null||h({x:H[0],y:H[1],zoom:H[2]}),g||E.setState({transform:H})},[h,g]);return $.useEffect(()=>{if(_.current){z.current=e_({domNode:_.current,minZoom:d,maxZoom:c,translateExtent:a,viewport:u,onDraggingChange:I=>E.setState(D=>D.paneDragging===I?D:{paneDragging:I}),onPanZoomStart:(I,D)=>{const{onViewportChangeStart:k,onMoveStart:S}=E.getState();S==null||S(I,D),k==null||k(D)},onPanZoom:(I,D)=>{const{onViewportChange:k,onMove:S}=E.getState();S==null||S(I,D),k==null||k(D)},onPanZoomEnd:(I,D)=>{const{onViewportChangeEnd:k,onMoveEnd:S}=E.getState();S==null||S(I,D),k==null||k(D)}});const{x:H,y:C,zoom:A}=z.current.getViewport();return E.setState({panZoom:z.current,transform:[H,C,A],domNode:_.current.closest(".react-flow")}),()=>{var I;(I=z.current)==null||I.destroy()}}},[]),$.useEffect(()=>{var H;(H=z.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:m,noPanClassName:x,userSelectionActive:N,noWheelClassName:w,lib:P,onTransformChange:R,connectionInProgress:L,selectionOnDrag:v,paneClickDistance:p})},[e,t,n,r,o,i,s,l,j,m,x,N,w,P,R,L,v,p]),M.jsx("div",{className:"react-flow__renderer",ref:_,style:Zs,children:y})}const c2=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function f2(){const{userSelectionActive:e,userSelectionRect:t}=ne(c2,de);return e&&t?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Fl=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},d2=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function h2({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Io.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:a,onPaneScroll:d,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:m,children:y}){const w=he(),{userSelectionActive:x,elementsSelectable:h,dragging:g,connectionInProgress:p}=ne(d2,de),v=h&&(e||x),E=$.useRef(null),_=$.useRef(),N=$.useRef(new Set),P=$.useRef(new Set),L=$.useRef(!1),j=k=>{if(L.current||p){L.current=!1;return}u==null||u(k),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},z=k=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){k.preventDefault();return}a==null||a(k)},R=d?k=>d(k):void 0,H=k=>{L.current&&(k.stopPropagation(),L.current=!1)},C=k=>{var U,Y;const{domNode:S}=w.getState();if(_.current=S==null?void 0:S.getBoundingClientRect(),!_.current)return;const T=k.target===E.current;if(!T&&!!k.target.closest(".nokey")||!e||!(i&&T||t)||k.button!==0||!k.isPrimary)return;(Y=(U=k.target)==null?void 0:U.setPointerCapture)==null||Y.call(U,k.pointerId),L.current=!1;const{x:W,y:V}=dt(k.nativeEvent,_.current);w.setState({userSelectionRect:{width:0,height:0,startX:W,startY:V,x:W,y:V}}),T||(k.stopPropagation(),k.preventDefault())},A=k=>{const{userSelectionRect:S,transform:T,nodeLookup:O,edgeLookup:F,connectionLookup:W,triggerNodeChanges:V,triggerEdgeChanges:U,defaultEdgeOptions:Y,resetSelectedElements:Q}=w.getState();if(!_.current||!S)return;const{x:B,y:K}=dt(k.nativeEvent,_.current),{startX:ee,startY:J}=S;if(!L.current){const oe=t?0:o;if(Math.hypot(B-ee,K-J)<=oe)return;Q(),s==null||s(k)}L.current=!0;const q={startX:ee,startY:J,x:Boe.id)),P.current=new Set;const ue=(Y==null?void 0:Y.selectable)??!0;for(const oe of N.current){const Pe=W.get(oe);if(Pe)for(const{edgeId:Vt}of Pe.values()){const Nt=F.get(Vt);Nt&&(Nt.selectable??ue)&&P.current.add(Vt)}}if(!Yf(Z,N.current)){const oe=tr(O,N.current,!0);V(oe)}if(!Yf(ie,P.current)){const oe=tr(F,P.current);U(oe)}w.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},I=k=>{var S,T;k.button===0&&((T=(S=k.target)==null?void 0:S.releasePointerCapture)==null||T.call(S,k.pointerId),!x&&k.target===E.current&&w.getState().userSelectionRect&&(j==null||j(k)),w.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(k),w.setState({nodesSelectionActive:N.current.size>0})))},D=r===!0||Array.isArray(r)&&r.includes(0);return M.jsxs("div",{className:xe(["react-flow__pane",{draggable:D,dragging:g,selection:e}]),onClick:v?void 0:Fl(j,E),onContextMenu:Fl(z,E),onWheel:Fl(R,E),onPointerEnter:v?void 0:c,onPointerMove:v?A:f,onPointerUp:v?I:void 0,onPointerDownCapture:v?C:void 0,onClickCapture:v?H:void 0,onPointerLeave:m,ref:E,style:Zs,children:[y,M.jsx(f2,{})]})}function Xu({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:l,onError:u}=t.getState(),a=l.get(e);if(!a){u==null||u("012",kt.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function mm({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const l=he(),[u,a]=$.useState(!1),d=$.useRef();return $.useEffect(()=>{d.current=HE({getStoreItems:()=>l.getState(),onNodeMouseDown:c=>{Xu({id:c,store:l,nodeRef:e})},onDragStart:()=>{a(!0)},onDragStop:()=>{a(!1)}})},[]),$.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var c;(c=d.current)==null||c.destroy()}},[n,r,t,i,e,o,s]),u}const p2=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ym(){const e=he();return $.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:l,updateNodePositions:u,nodeLookup:a,nodeOrigin:d}=e.getState(),c=new Map,f=p2(s),m=o?i[0]:5,y=o?i[1]:5,w=n.direction.x*m*n.factor,x=n.direction.y*y*n.factor;for(const[,h]of a){if(!f(h))continue;let g={x:h.internals.positionAbsolute.x+w,y:h.internals.positionAbsolute.y+x};o&&(g=Bo(g,i));const{position:p,positionAbsolute:v}=Lg({nodeId:h.id,nextPosition:g,nodeLookup:a,nodeExtent:r,nodeOrigin:d,onError:l});h.position=p,h.internals.positionAbsolute=v,c.set(h.id,h)}u(c)},[])}const oc=$.createContext(null),g2=oc.Provider;oc.Consumer;const vm=()=>$.useContext(oc),m2=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),y2=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:l,toHandle:u,isValid:a}=s,d=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===wr.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!o,valid:d&&a}};function v2({type:e="source",position:t=G.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:a,onMouseDown:d,onTouchStart:c,...f},m){var A,I;const y=s||null,w=e==="target",x=he(),h=vm(),{connectOnClick:g,noPanClassName:p,rfId:v}=ne(m2,de),{connectingFrom:E,connectingTo:_,clickConnecting:N,isPossibleEndHandle:P,connectionInProcess:L,clickConnectionInProcess:j,valid:z}=ne(y2(h,y,e),de);h||(I=(A=x.getState()).onError)==null||I.call(A,"010",kt.error010());const R=D=>{const{defaultEdgeOptions:k,onConnect:S,hasDefaultEdges:T}=x.getState(),O={...k,...D};if(T){const{edges:F,setEdges:W}=x.getState();W(kE(O,F))}S==null||S(O),l==null||l(O)},H=D=>{if(!h)return;const k=Hg(D.nativeEvent);if(o&&(k&&D.button===0||!k)){const S=x.getState();Yu.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:S.autoPanOnConnect,connectionMode:S.connectionMode,connectionRadius:S.connectionRadius,domNode:S.domNode,nodeLookup:S.nodeLookup,lib:S.lib,isTarget:w,handleId:y,nodeId:h,flowId:S.rfId,panBy:S.panBy,cancelConnection:S.cancelConnection,onConnectStart:S.onConnectStart,onConnectEnd:(...T)=>{var O,F;return(F=(O=x.getState()).onConnectEnd)==null?void 0:F.call(O,...T)},updateConnection:S.updateConnection,onConnect:R,isValidConnection:n||((...T)=>{var O,F;return((F=(O=x.getState()).isValidConnection)==null?void 0:F.call(O,...T))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:S.autoPanSpeed,dragThreshold:S.connectionDragThreshold})}k?d==null||d(D):c==null||c(D)},C=D=>{const{onClickConnectStart:k,onClickConnectEnd:S,connectionClickStartHandle:T,connectionMode:O,isValidConnection:F,lib:W,rfId:V,nodeLookup:U,connection:Y}=x.getState();if(!h||!T&&!o)return;if(!T){k==null||k(D.nativeEvent,{nodeId:h,handleId:y,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:h,type:e,id:y}});return}const Q=Og(D.target),B=n||F,{connection:K,isValid:ee}=Yu.isValid(D.nativeEvent,{handle:{nodeId:h,id:y,type:e},connectionMode:O,fromNodeId:T.nodeId,fromHandleId:T.id||null,fromType:T.type,isValidConnection:B,flowId:V,doc:Q,lib:W,nodeLookup:U});ee&&K&&R(K);const J=structuredClone(Y);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,S==null||S(D,J),x.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":y,"data-nodeid":h,"data-handlepos":t,"data-id":`${v}-${h}-${y}-${e}`,className:xe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,a,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:N,connectingfrom:E,connectingto:_,valid:z,connectionindicator:r&&(!L||P)&&(L||j?i:o)}]),onMouseDown:H,onTouchStart:H,onClick:g?C:void 0,ref:m,...f,children:u})}const Nr=$.memo(pm(v2));function w2({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return M.jsxs(M.Fragment,{children:[e==null?void 0:e.label,M.jsx(Nr,{type:"source",position:n,isConnectable:t})]})}function x2({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(Nr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,M.jsx(Nr,{type:"source",position:r,isConnectable:t})]})}function S2(){return null}function E2({data:e,isConnectable:t,targetPosition:n=G.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(Nr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ws={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},vd={input:w2,default:x2,output:E2,group:S2};function _2(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const k2=e=>{const{width:t,height:n,x:r,y:o}=bo(e.nodeLookup,{filter:i=>!!i.selected});return{width:ft(t)?t:null,height:ft(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function C2({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=he(),{width:o,height:i,transformString:s,userSelectionActive:l}=ne(k2,de),u=ym(),a=$.useRef(null);$.useEffect(()=>{var m;n||(m=a.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&o!==null&&i!==null;if(mm({nodeRef:a,disabled:!d}),!d)return null;const c=e?m=>{const y=r.getState().nodes.filter(w=>w.selected);e(m,y)}:void 0,f=m=>{Object.prototype.hasOwnProperty.call(ws,m.key)&&(m.preventDefault(),u({direction:ws[m.key],factor:m.shiftKey?4:1}))};return M.jsx("div",{className:xe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:M.jsx("div",{ref:a,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:i}})})}const wd=typeof window<"u"?window:void 0,N2=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function wm({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:a,selectionOnDrag:d,selectionMode:c,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:h,zoomOnScroll:g,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:N,panOnDrag:P,defaultViewport:L,translateExtent:j,minZoom:z,maxZoom:R,preventScrolling:H,onSelectionContextMenu:C,noWheelClassName:A,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:k,isControlledViewport:S}){const{nodesSelectionActive:T,userSelectionActive:O}=ne(N2,de),F=Ao(a,{target:wd}),W=Ao(w,{target:wd}),V=W||P,U=W||v,Y=d&&V!==!0,Q=F||O||Y;return s2({deleteKeyCode:u,multiSelectionKeyCode:y}),M.jsx(a2,{onPaneContextMenu:i,elementsSelectable:h,zoomOnScroll:g,zoomOnPinch:p,panOnScroll:U,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:N,panOnDrag:!F&&V,defaultViewport:L,translateExtent:j,minZoom:z,maxZoom:R,zoomActivationKeyCode:x,preventScrolling:H,noWheelClassName:A,noPanClassName:I,onViewportChange:k,isControlledViewport:S,paneClickDistance:l,selectionOnDrag:Y,children:M.jsxs(h2,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:V,isSelecting:!!Q,selectionMode:c,selectionKeyPressed:F,paneClickDistance:l,selectionOnDrag:Y,children:[e,T&&M.jsx(C2,{onSelectionContextMenu:C,noPanClassName:I,disableKeyboardA11y:D})]})})}wm.displayName="FlowRenderer";const M2=$.memo(wm),P2=e=>t=>e?Za(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function T2(e){return ne($.useCallback(P2(e),[e]),de)}const I2=e=>e.updateNodeInternals;function z2(){const e=ne(I2),[t]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return $.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function L2({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=he(),i=$.useRef(null),s=$.useRef(null),l=$.useRef(e.sourcePosition),u=$.useRef(e.targetPosition),a=$.useRef(t),d=n&&!!e.internals.handleBounds;return $.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[d,e.hidden]),$.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),$.useEffect(()=>{if(i.current){const c=a.current!==t,f=l.current!==e.sourcePosition,m=u.current!==e.targetPosition;(c||f||m)&&(a.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function A2({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:a,nodesFocusable:d,resizeObserver:c,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:y,rfId:w,nodeTypes:x,nodeClickDistance:h,onError:g}){const{node:p,internals:v,isParent:E}=ne(B=>{const K=B.nodeLookup.get(e),ee=B.parentLookup.has(e);return{node:K,internals:K.internals,isParent:ee}},de);let _=p.type||"default",N=(x==null?void 0:x[_])||vd[_];N===void 0&&(g==null||g("003",kt.error003(_)),_="default",N=(x==null?void 0:x.default)||vd.default);const P=!!(p.draggable||l&&typeof p.draggable>"u"),L=!!(p.selectable||u&&typeof p.selectable>"u"),j=!!(p.connectable||a&&typeof p.connectable>"u"),z=!!(p.focusable||d&&typeof p.focusable>"u"),R=he(),H=Dg(p),C=L2({node:p,nodeType:_,hasDimensions:H,resizeObserver:c}),A=mm({nodeRef:C,disabled:p.hidden||!P,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:h}),I=ym();if(p.hidden)return null;const D=Ht(p),k=_2(p),S=L||P||t||n||r||o,T=n?B=>n(B,{...v.userNode}):void 0,O=r?B=>r(B,{...v.userNode}):void 0,F=o?B=>o(B,{...v.userNode}):void 0,W=i?B=>i(B,{...v.userNode}):void 0,V=s?B=>s(B,{...v.userNode}):void 0,U=B=>{const{selectNodesOnDrag:K,nodeDragThreshold:ee}=R.getState();L&&(!K||!P||ee>0)&&Xu({id:e,store:R,nodeRef:C}),t&&t(B,{...v.userNode})},Y=B=>{if(!(jg(B.nativeEvent)||y)){if(Ng.includes(B.key)&&L){const K=B.key==="Escape";Xu({id:e,store:R,unselect:K,nodeRef:C})}else if(P&&p.selected&&Object.prototype.hasOwnProperty.call(ws,B.key)){B.preventDefault();const{ariaLabelConfig:K}=R.getState();R.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),I({direction:ws[B.key],factor:B.shiftKey?4:1})}}},Q=()=>{var ie;if(y||!((ie=C.current)!=null&&ie.matches(":focus-visible")))return;const{transform:B,width:K,height:ee,autoPanOnNodeFocus:J,setCenter:q}=R.getState();if(!J)return;Za(new Map([[e,p]]),{x:0,y:0,width:K,height:ee},B,!0).length>0||q(p.position.x+D.width/2,p.position.y+D.height/2,{zoom:B[2]})};return M.jsx("div",{className:xe(["react-flow__node",`react-flow__node-${_}`,{[m]:P},p.className,{selected:p.selected,selectable:L,parent:E,draggable:P,dragging:A}]),ref:C,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:S?"all":"none",visibility:H?"visible":"hidden",...p.style,...k},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:O,onMouseLeave:F,onContextMenu:W,onClick:U,onDoubleClick:V,onKeyDown:z?Y:void 0,tabIndex:z?0:void 0,onFocus:z?Q:void 0,role:p.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${um}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:M.jsx(g2,{value:e,children:M.jsx(N,{id:e,data:p.data,type:_,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:p.selected??!1,selectable:L,draggable:P,deletable:p.deletable??!0,isConnectable:j,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:A,dragHandle:p.dragHandle,zIndex:v.z,parentId:p.parentId,...D})})})}var R2=$.memo(A2);const $2=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function xm(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=ne($2,de),s=T2(e.onlyRenderVisibleElements),l=z2();return M.jsx("div",{className:"react-flow__nodes",style:Zs,children:s.map(u=>M.jsx(R2,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},u))})}xm.displayName="NodeRenderer";const D2=$.memo(xm);function F2(e){return ne($.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&SE({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),de)}const O2=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},j2=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},xd={[xr.Arrow]:O2,[xr.ArrowClosed]:j2};function H2(e){const t=he();return $.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(xd,e)?xd[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",kt.error009(e)),null)},[e])}const V2=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const u=H2(t);return u?M.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:M.jsx(u,{color:n,strokeWidth:s})}):null},Sm=({defaultColor:e,rfId:t})=>{const n=ne(i=>i.edges),r=ne(i=>i.defaultEdgeOptions),o=$.useMemo(()=>TE(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:o.map(i=>M.jsx(V2,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Sm.displayName="MarkerDefinitions";var b2=$.memo(Sm);function Em({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:a,...d}){const[c,f]=$.useState({x:1,y:0,width:0,height:0}),m=xe(["react-flow__edge-textwrapper",a]),y=$.useRef(null);return $.useEffect(()=>{if(y.current){const w=y.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?M.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:m,visibility:c.width?"visible":"hidden",...d,children:[o&&M.jsx("rect",{width:c.width+2*s[0],x:-s[0],y:-s[1],height:c.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),M.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:y,style:r,children:n}),u]}):null}Em.displayName="EdgeText";const B2=$.memo(Em);function qs({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:a=20,...d}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...d,d:e,fill:"none",className:xe(["react-flow__edge-path",d.className])}),a?M.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:a,className:"react-flow__edge-interaction"}):null,r&&ft(t)&&ft(n)?M.jsx(B2,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function Sd({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===G.Left||e===G.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function _m({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top}){const[s,l]=Sd({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,a]=Sd({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,c,f,m]=Vg({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:a});return[`M${e},${t} C${s},${l} ${u},${a} ${r},${o}`,d,c,f,m]}function km(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:l,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:h})=>{const[g,p,v]=_m({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return M.jsx(qs,{id:E,path:g,labelX:p,labelY:v,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:h})})}const W2=km({isInternal:!1}),Cm=km({isInternal:!0});W2.displayName="SimpleBezierEdge";Cm.displayName="SimpleBezierEdgeInternal";function Nm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,sourcePosition:m=G.Bottom,targetPosition:y=G.Top,markerEnd:w,markerStart:x,pathOptions:h,interactionWidth:g})=>{const[p,v,E]=Bu({sourceX:n,sourceY:r,sourcePosition:m,targetX:o,targetY:i,targetPosition:y,borderRadius:h==null?void 0:h.borderRadius,offset:h==null?void 0:h.offset,stepPosition:h==null?void 0:h.stepPosition}),_=e.isInternal?void 0:t;return M.jsx(qs,{id:_,path:p,labelX:v,labelY:E,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:w,markerStart:x,interactionWidth:g})})}const Mm=Nm({isInternal:!1}),Pm=Nm({isInternal:!0});Mm.displayName="SmoothStepEdge";Pm.displayName="SmoothStepEdgeInternal";function Tm(e){return $.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return M.jsx(Mm,{...n,id:r,pathOptions:$.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const U2=Tm({isInternal:!1}),Im=Tm({isInternal:!0});U2.displayName="StepEdge";Im.displayName="StepEdgeInternal";function zm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[x,h,g]=Wg({sourceX:n,sourceY:r,targetX:o,targetY:i}),p=e.isInternal?void 0:t;return M.jsx(qs,{id:p,path:x,labelX:h,labelY:g,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:w})})}const Y2=zm({isInternal:!1}),Lm=zm({isInternal:!0});Y2.displayName="StraightEdge";Lm.displayName="StraightEdgeInternal";function Am(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=G.Bottom,targetPosition:l=G.Top,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,pathOptions:h,interactionWidth:g})=>{const[p,v,E]=bg({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l,curvature:h==null?void 0:h.curvature}),_=e.isInternal?void 0:t;return M.jsx(qs,{id:_,path:p,labelX:v,labelY:E,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:g})})}const X2=Am({isInternal:!1}),Rm=Am({isInternal:!0});X2.displayName="BezierEdge";Rm.displayName="BezierEdgeInternal";const Ed={default:Rm,straight:Lm,step:Im,smoothstep:Pm,simplebezier:Cm},_d={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Q2=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,G2=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,kd="react-flow__edgeupdater";function Cd({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:l}){return M.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:xe([kd,`${kd}-${l}`]),cx:Q2(t,r,e),cy:G2(n,r,e),r,stroke:"transparent",fill:"transparent"})}function K2({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:l,targetPosition:u,onReconnect:a,onReconnectStart:d,onReconnectEnd:c,setReconnecting:f,setUpdateHover:m}){const y=he(),w=(v,E)=>{if(v.button!==0)return;const{autoPanOnConnect:_,domNode:N,connectionMode:P,connectionRadius:L,lib:j,onConnectStart:z,cancelConnection:R,nodeLookup:H,rfId:C,panBy:A,updateConnection:I}=y.getState(),D=E.type==="target",k=(O,F)=>{f(!1),c==null||c(O,n,E.type,F)},S=O=>a==null?void 0:a(n,O),T=(O,F)=>{f(!0),d==null||d(v,n,E.type),z==null||z(O,F)};Yu.onPointerDown(v.nativeEvent,{autoPanOnConnect:_,connectionMode:P,connectionRadius:L,domNode:N,handleId:E.id,nodeId:E.nodeId,nodeLookup:H,isTarget:D,edgeUpdaterType:E.type,lib:j,flowId:C,cancelConnection:R,panBy:A,isValidConnection:(...O)=>{var F,W;return((W=(F=y.getState()).isValidConnection)==null?void 0:W.call(F,...O))??!0},onConnect:S,onConnectStart:T,onConnectEnd:(...O)=>{var F,W;return(W=(F=y.getState()).onConnectEnd)==null?void 0:W.call(F,...O)},onReconnectEnd:k,updateConnection:I,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},x=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),h=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),g=()=>m(!0),p=()=>m(!1);return M.jsxs(M.Fragment,{children:[(e===!0||e==="source")&&M.jsx(Cd,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:g,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&M.jsx(Cd,{position:u,centerX:i,centerY:s,radius:t,onMouseDown:h,onMouseEnter:g,onMouseOut:p,type:"target"})]})}function Z2({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,rfId:y,edgeTypes:w,noPanClassName:x,onError:h,disableKeyboardA11y:g}){let p=ne(q=>q.edgeLookup.get(e));const v=ne(q=>q.defaultEdgeOptions);p=v?{...v,...p}:p;let E=p.type||"default",_=(w==null?void 0:w[E])||Ed[E];_===void 0&&(h==null||h("011",kt.error011(E)),E="default",_=(w==null?void 0:w.default)||Ed.default);const N=!!(p.focusable||t&&typeof p.focusable>"u"),P=typeof c<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),L=!!(p.selectable||r&&typeof p.selectable>"u"),j=$.useRef(null),[z,R]=$.useState(!1),[H,C]=$.useState(!1),A=he(),{zIndex:I,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:O,targetPosition:F}=ne($.useCallback(q=>{const Z=q.nodeLookup.get(p.source),ie=q.nodeLookup.get(p.target);if(!Z||!ie)return{zIndex:p.zIndex,..._d};const ue=PE({id:e,sourceNode:Z,targetNode:ie,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:q.connectionMode,onError:h});return{zIndex:xE({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:ie,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ue||_d}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),de),W=$.useMemo(()=>p.markerStart?`url('#${Wu(p.markerStart,y)}')`:void 0,[p.markerStart,y]),V=$.useMemo(()=>p.markerEnd?`url('#${Wu(p.markerEnd,y)}')`:void 0,[p.markerEnd,y]);if(p.hidden||D===null||k===null||S===null||T===null)return null;const U=q=>{var oe;const{addSelectedEdges:Z,unselectNodesAndEdges:ie,multiSelectionActive:ue}=A.getState();L&&(A.setState({nodesSelectionActive:!1}),p.selected&&ue?(ie({nodes:[],edges:[p]}),(oe=j.current)==null||oe.blur()):Z([e])),o&&o(q,p)},Y=i?q=>{i(q,{...p})}:void 0,Q=s?q=>{s(q,{...p})}:void 0,B=l?q=>{l(q,{...p})}:void 0,K=u?q=>{u(q,{...p})}:void 0,ee=a?q=>{a(q,{...p})}:void 0,J=q=>{var Z;if(!g&&Ng.includes(q.key)&&L){const{unselectNodesAndEdges:ie,addSelectedEdges:ue}=A.getState();q.key==="Escape"?((Z=j.current)==null||Z.blur(),ie({edges:[p]})):ue([e])}};return M.jsx("svg",{style:{zIndex:I},children:M.jsxs("g",{className:xe(["react-flow__edge",`react-flow__edge-${E}`,p.className,x,{selected:p.selected,animated:p.animated,inactive:!L&&!o,updating:z,selectable:L}]),onClick:U,onDoubleClick:Y,onContextMenu:Q,onMouseEnter:B,onMouseMove:K,onMouseLeave:ee,onKeyDown:N?J:void 0,tabIndex:N?0:void 0,role:p.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":N?`${am}-${y}`:void 0,ref:j,...p.domAttributes,children:[!H&&M.jsx(_,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:L,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:O,targetPosition:F,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:W,markerEnd:V,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),P&&M.jsx(K2,{edge:p,isReconnectable:P,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:O,targetPosition:F,setUpdateHover:R,setReconnecting:C})]})})}var q2=$.memo(Z2);const J2=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $m({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:a,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:h,elementsSelectable:g,onError:p}=ne(J2,de),v=F2(t);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(b2,{defaultColor:e,rfId:n}),v.map(E=>M.jsx(q2,{id:E,edgesFocusable:x,edgesReconnectable:h,elementsSelectable:g,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,onClick:d,reconnectRadius:c,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:w},E))]})}$m.displayName="EdgeRenderer";const ek=$.memo($m),tk=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function nk({children:e}){const t=ne(tk);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function rk(e){const t=Uo(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const ok=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function ik(e){const t=ne(ok),n=he();return $.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function sk(e){return e.connection.inProgress?{...e.connection,to:Wo(e.connection.to,e.transform)}:{...e.connection}}function lk(e){return sk}function uk(e){const t=lk();return ne(t,de)}const ak=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ck({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:l,inProgress:u}=ne(ak,de);return!(i&&o&&u)?null:M.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:xe(["react-flow__connection",Tg(l)]),children:M.jsx(Dm,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Dm=({style:e,type:t=Gt.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:l,fromPosition:u,to:a,toNode:d,toHandle:c,toPosition:f,pointer:m}=uk();if(!o)return;if(n)return M.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:l,fromX:i.x,fromY:i.y,toX:a.x,toY:a.y,fromPosition:u,toPosition:f,connectionStatus:Tg(r),toNode:d,toHandle:c,pointer:m});let y="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:a.x,targetY:a.y,targetPosition:f};switch(t){case Gt.Bezier:[y]=bg(w);break;case Gt.SimpleBezier:[y]=_m(w);break;case Gt.Step:[y]=Bu({...w,borderRadius:0});break;case Gt.SmoothStep:[y]=Bu(w);break;default:[y]=Wg(w)}return M.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};Dm.displayName="ConnectionLine";const fk={};function Nd(e=fk){$.useRef(e),he(),$.useEffect(()=>{},[e])}function dk(){he(),$.useRef(!1),$.useEffect(()=>{},[])}function Fm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:f,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:h,selectionKeyCode:g,selectionOnDrag:p,selectionMode:v,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:N,deleteKeyCode:P,onlyRenderVisibleElements:L,elementsSelectable:j,defaultViewport:z,translateExtent:R,minZoom:H,maxZoom:C,preventScrolling:A,defaultMarkerColor:I,zoomOnScroll:D,zoomOnPinch:k,panOnScroll:S,panOnScrollSpeed:T,panOnScrollMode:O,zoomOnDoubleClick:F,panOnDrag:W,onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:Y,onPaneMouseLeave:Q,onPaneScroll:B,onPaneContextMenu:K,paneClickDistance:ee,nodeClickDistance:J,onEdgeContextMenu:q,onEdgeMouseEnter:Z,onEdgeMouseMove:ie,onEdgeMouseLeave:ue,reconnectRadius:oe,onReconnect:Pe,onReconnectStart:Vt,onReconnectEnd:Nt,noDragClassName:pn,noWheelClassName:Ir,noPanClassName:zr,disableKeyboardA11y:Lr,nodeExtent:el,rfId:Yo,viewport:Fn,onViewportChange:Ar}){return Nd(e),Nd(t),dk(),rk(n),ik(Fn),M.jsx(M2,{onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:Y,onPaneMouseLeave:Q,onPaneContextMenu:K,onPaneScroll:B,paneClickDistance:ee,deleteKeyCode:P,selectionKeyCode:g,selectionOnDrag:p,selectionMode:v,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:j,zoomOnScroll:D,zoomOnPinch:k,zoomOnDoubleClick:F,panOnScroll:S,panOnScrollSpeed:T,panOnScrollMode:O,panOnDrag:W,defaultViewport:z,translateExtent:R,minZoom:H,maxZoom:C,onSelectionContextMenu:c,preventScrolling:A,noDragClassName:pn,noWheelClassName:Ir,noPanClassName:zr,disableKeyboardA11y:Lr,onViewportChange:Ar,isControlledViewport:!!Fn,children:M.jsxs(nk,{children:[M.jsx(ek,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:Pe,onReconnectStart:Vt,onReconnectEnd:Nt,onlyRenderVisibleElements:L,onEdgeContextMenu:q,onEdgeMouseEnter:Z,onEdgeMouseMove:ie,onEdgeMouseLeave:ue,reconnectRadius:oe,defaultMarkerColor:I,noPanClassName:zr,disableKeyboardA11y:Lr,rfId:Yo}),M.jsx(ck,{style:w,type:y,component:x,containerStyle:h}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(D2,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:d,nodeClickDistance:J,onlyRenderVisibleElements:L,noPanClassName:zr,noDragClassName:pn,disableKeyboardA11y:Lr,nodeExtent:el,rfId:Yo}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Fm.displayName="GraphView";const hk=$.memo(Fm),Md=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u=.5,maxZoom:a=2,nodeOrigin:d,nodeExtent:c,zIndexMode:f="basic"}={})=>{const m=new Map,y=new Map,w=new Map,x=new Map,h=r??t??[],g=n??e??[],p=d??[0,0],v=c??To;Xg(w,x,h);const E=Uu(g,m,y,{nodeOrigin:p,nodeExtent:v,zIndexMode:f});let _=[0,0,1];if(s&&o&&i){const N=bo(m,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:P,y:L,zoom:j}=Ys(N,o,i,u,a,(l==null?void 0:l.padding)??.1);_=[P,L,j]}return{rfId:"1",width:o??0,height:i??0,transform:_,nodes:g,nodesInitialized:E,nodeLookup:m,parentLookup:y,edges:h,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:a,translateExtent:To,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:wr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:l,fitViewResolver:null,connection:{...Pg},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:pE,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Mg,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},pk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:d,nodeExtent:c,zIndexMode:f})=>L_((m,y)=>{async function w(){const{nodeLookup:x,panZoom:h,fitViewOptions:g,fitViewResolver:p,width:v,height:E,minZoom:_,maxZoom:N}=y();h&&(await dE({nodes:x,width:v,height:E,panZoom:h,minZoom:_,maxZoom:N},g),p==null||p.resolve(!0),m({fitViewResolver:null}))}return{...Md({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:x=>{const{nodeLookup:h,parentLookup:g,nodeOrigin:p,elevateNodesOnSelect:v,fitViewQueued:E,zIndexMode:_}=y(),N=Uu(x,h,g,{nodeOrigin:p,nodeExtent:c,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:_});E&&N?(w(),m({nodes:x,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):m({nodes:x,nodesInitialized:N})},setEdges:x=>{const{connectionLookup:h,edgeLookup:g}=y();Xg(h,g,x),m({edges:x})},setDefaultNodesAndEdges:(x,h)=>{if(x){const{setNodes:g}=y();g(x),m({hasDefaultNodes:!0})}if(h){const{setEdges:g}=y();g(h),m({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:h,nodeLookup:g,parentLookup:p,domNode:v,nodeOrigin:E,nodeExtent:_,debug:N,fitViewQueued:P,zIndexMode:L}=y(),{changes:j,updatedInternals:z}=DE(x,g,p,v,E,_,L);z&&(LE(g,p,{nodeOrigin:E,nodeExtent:_,zIndexMode:L}),P?(w(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(j==null?void 0:j.length)>0&&(N&&console.log("React Flow: trigger node changes",j),h==null||h(j)))},updateNodePositions:(x,h=!1)=>{const g=[];let p=[];const{nodeLookup:v,triggerNodeChanges:E,connection:_,updateConnection:N,onNodesChangeMiddlewareMap:P}=y();for(const[L,j]of x){const z=v.get(L),R=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(j!=null&&j.position)),H={id:L,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:h};if(z&&_.inProgress&&_.fromNode.id===z.id){const C=Rn(z,_.fromHandle,G.Left,!0);N({..._,from:C})}R&&z.parentId&&g.push({id:L,parentId:z.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),p.push(H)}if(g.length>0){const{parentLookup:L,nodeOrigin:j}=y(),z=rc(g,v,L,j);p.push(...z)}for(const L of P.values())p=L(p);E(p)},triggerNodeChanges:x=>{const{onNodesChange:h,setNodes:g,nodes:p,hasDefaultNodes:v,debug:E}=y();if(x!=null&&x.length){if(v){const _=dm(x,p);g(_)}E&&console.log("React Flow: trigger node changes",x),h==null||h(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:h,setEdges:g,edges:p,hasDefaultEdges:v,debug:E}=y();if(x!=null&&x.length){if(v){const _=hm(x,p);g(_)}E&&console.log("React Flow: trigger edge changes",x),h==null||h(x)}},addSelectedNodes:x=>{const{multiSelectionActive:h,edgeLookup:g,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:E}=y();if(h){const _=x.map(N=>yn(N,!0));v(_);return}v(tr(p,new Set([...x]),!0)),E(tr(g))},addSelectedEdges:x=>{const{multiSelectionActive:h,edgeLookup:g,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:E}=y();if(h){const _=x.map(N=>yn(N,!0));E(_);return}E(tr(g,new Set([...x]))),v(tr(p,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:h}={})=>{const{edges:g,nodes:p,nodeLookup:v,triggerNodeChanges:E,triggerEdgeChanges:_}=y(),N=x||p,P=h||g,L=[];for(const z of N){if(!z.selected)continue;const R=v.get(z.id);R&&(R.selected=!1),L.push(yn(z.id,!1))}const j=[];for(const z of P)z.selected&&j.push(yn(z.id,!1));E(L),_(j)},setMinZoom:x=>{const{panZoom:h,maxZoom:g}=y();h==null||h.setScaleExtent([x,g]),m({minZoom:x})},setMaxZoom:x=>{const{panZoom:h,minZoom:g}=y();h==null||h.setScaleExtent([g,x]),m({maxZoom:x})},setTranslateExtent:x=>{var h;(h=y().panZoom)==null||h.setTranslateExtent(x),m({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:h,triggerNodeChanges:g,triggerEdgeChanges:p,elementsSelectable:v}=y();if(!v)return;const E=h.reduce((N,P)=>P.selected?[...N,yn(P.id,!1)]:N,[]),_=x.reduce((N,P)=>P.selected?[...N,yn(P.id,!1)]:N,[]);g(E),p(_)},setNodeExtent:x=>{const{nodes:h,nodeLookup:g,parentLookup:p,nodeOrigin:v,elevateNodesOnSelect:E,nodeExtent:_,zIndexMode:N}=y();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(Uu(h,g,p,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:N}),m({nodeExtent:x}))},panBy:x=>{const{transform:h,width:g,height:p,panZoom:v,translateExtent:E}=y();return FE({delta:x,panZoom:v,transform:h,translateExtent:E,width:g,height:p})},setCenter:async(x,h,g)=>{const{width:p,height:v,maxZoom:E,panZoom:_}=y();if(!_)return Promise.resolve(!1);const N=typeof(g==null?void 0:g.zoom)<"u"?g.zoom:E;return await _.setViewport({x:p/2-x*N,y:v/2-h*N,zoom:N},{duration:g==null?void 0:g.duration,ease:g==null?void 0:g.ease,interpolate:g==null?void 0:g.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...Pg}})},updateConnection:x=>{m({connection:x})},reset:()=>m({...Md()})}},Object.is);function Om({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:u,fitView:a,nodeOrigin:d,nodeExtent:c,zIndexMode:f,children:m}){const[y]=$.useState(()=>pk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,minZoom:s,maxZoom:l,fitViewOptions:u,nodeOrigin:d,nodeExtent:c,zIndexMode:f}));return M.jsx(A_,{value:y,children:M.jsx(n2,{children:m})})}function gk({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:a,maxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m}){return $.useContext(Gs)?M.jsx(M.Fragment,{children:e}):M.jsx(Om,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:u,initialMinZoom:a,initialMaxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m,children:e})}const mk={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function yk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:a,onMove:d,onMoveStart:c,onMoveEnd:f,onConnect:m,onConnectStart:y,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:h,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:N,onNodeDrag:P,onNodeDragStop:L,onNodesDelete:j,onEdgesDelete:z,onDelete:R,onSelectionChange:H,onSelectionDragStart:C,onSelectionDrag:A,onSelectionDragStop:I,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:S,onBeforeDelete:T,connectionMode:O,connectionLineType:F=Gt.Bezier,connectionLineStyle:W,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:Y="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:B=!1,selectionMode:K=Io.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:J=Lo()?"Meta":"Control",zoomActivationKeyCode:q=Lo()?"Meta":"Control",snapToGrid:Z,snapGrid:ie,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:oe,nodesDraggable:Pe,autoPanOnNodeFocus:Vt,nodesConnectable:Nt,nodesFocusable:pn,nodeOrigin:Ir=cm,edgesFocusable:zr,edgesReconnectable:Lr,elementsSelectable:el=!0,defaultViewport:Yo=Y_,minZoom:Fn=.5,maxZoom:Ar=2,translateExtent:uc=To,preventScrolling:e0=!0,nodeExtent:tl,defaultMarkerColor:t0="#b1b1b7",zoomOnScroll:n0=!0,zoomOnPinch:r0=!0,panOnScroll:o0=!1,panOnScrollSpeed:i0=.5,panOnScrollMode:s0=Cn.Free,zoomOnDoubleClick:l0=!0,panOnDrag:u0=!0,onPaneClick:a0,onPaneMouseEnter:c0,onPaneMouseMove:f0,onPaneMouseLeave:d0,onPaneScroll:h0,onPaneContextMenu:p0,paneClickDistance:g0=1,nodeClickDistance:m0=0,children:y0,onReconnect:v0,onReconnectStart:w0,onReconnectEnd:x0,onEdgeContextMenu:S0,onEdgeDoubleClick:E0,onEdgeMouseEnter:_0,onEdgeMouseMove:k0,onEdgeMouseLeave:C0,reconnectRadius:N0=10,onNodesChange:M0,onEdgesChange:P0,noDragClassName:T0="nodrag",noWheelClassName:I0="nowheel",noPanClassName:ac="nopan",fitView:cc,fitViewOptions:fc,connectOnClick:z0,attributionPosition:L0,proOptions:A0,defaultEdgeOptions:R0,elevateNodesOnSelect:$0=!0,elevateEdgesOnSelect:D0=!1,disableKeyboardA11y:dc=!1,autoPanOnConnect:F0,autoPanOnNodeDrag:O0,autoPanSpeed:j0,connectionRadius:H0,isValidConnection:V0,onError:b0,style:B0,id:hc,nodeDragThreshold:W0,connectionDragThreshold:U0,viewport:Y0,onViewportChange:X0,width:Q0,height:G0,colorMode:K0="light",debug:Z0,onScroll:Xo,ariaLabelConfig:q0,zIndexMode:pc="basic",...J0},ey){const nl=hc||"1",ty=K_(K0),ny=$.useCallback(gc=>{gc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Xo==null||Xo(gc)},[Xo]);return M.jsx("div",{"data-testid":"rf__wrapper",...J0,onScroll:ny,style:{...B0,...mk},ref:ey,className:xe(["react-flow",o,ty]),id:hc,role:"application",children:M.jsxs(gk,{nodes:e,edges:t,width:Q0,height:G0,fitView:cc,fitViewOptions:fc,minZoom:Fn,maxZoom:Ar,nodeOrigin:Ir,nodeExtent:tl,zIndexMode:pc,children:[M.jsx(hk,{onInit:a,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:F,connectionLineStyle:W,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:Q,selectionOnDrag:B,selectionMode:K,deleteKeyCode:Y,multiSelectionKeyCode:J,panActivationKeyCode:ee,zoomActivationKeyCode:q,onlyRenderVisibleElements:ue,defaultViewport:Yo,translateExtent:uc,minZoom:Fn,maxZoom:Ar,preventScrolling:e0,zoomOnScroll:n0,zoomOnPinch:r0,zoomOnDoubleClick:l0,panOnScroll:o0,panOnScrollSpeed:i0,panOnScrollMode:s0,panOnDrag:u0,onPaneClick:a0,onPaneMouseEnter:c0,onPaneMouseMove:f0,onPaneMouseLeave:d0,onPaneScroll:h0,onPaneContextMenu:p0,paneClickDistance:g0,nodeClickDistance:m0,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:S,onReconnect:v0,onReconnectStart:w0,onReconnectEnd:x0,onEdgeContextMenu:S0,onEdgeDoubleClick:E0,onEdgeMouseEnter:_0,onEdgeMouseMove:k0,onEdgeMouseLeave:C0,reconnectRadius:N0,defaultMarkerColor:t0,noDragClassName:T0,noWheelClassName:I0,noPanClassName:ac,rfId:nl,disableKeyboardA11y:dc,nodeExtent:tl,viewport:Y0,onViewportChange:X0}),M.jsx(G_,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:h,nodesDraggable:Pe,autoPanOnNodeFocus:Vt,nodesConnectable:Nt,nodesFocusable:pn,edgesFocusable:zr,edgesReconnectable:Lr,elementsSelectable:el,elevateNodesOnSelect:$0,elevateEdgesOnSelect:D0,minZoom:Fn,maxZoom:Ar,nodeExtent:tl,onNodesChange:M0,onEdgesChange:P0,snapToGrid:Z,snapGrid:ie,connectionMode:O,translateExtent:uc,connectOnClick:z0,defaultEdgeOptions:R0,fitView:cc,fitViewOptions:fc,onNodesDelete:j,onEdgesDelete:z,onDelete:R,onNodeDragStart:N,onNodeDrag:P,onNodeDragStop:L,onSelectionDrag:A,onSelectionDragStart:C,onSelectionDragStop:I,onMove:d,onMoveStart:c,onMoveEnd:f,noPanClassName:ac,nodeOrigin:Ir,rfId:nl,autoPanOnConnect:F0,autoPanOnNodeDrag:O0,autoPanSpeed:j0,onError:b0,connectionRadius:H0,isValidConnection:V0,selectNodesOnDrag:oe,nodeDragThreshold:W0,connectionDragThreshold:U0,onBeforeDelete:T,debug:Z0,ariaLabelConfig:q0,zIndexMode:pc}),M.jsx(U_,{onSelectionChange:H}),y0,M.jsx(H_,{proOptions:A0,position:L0}),M.jsx(j_,{rfId:nl,disableKeyboardA11y:dc})]})})}var vk=pm(yk);function wk(e){const[t,n]=$.useState(e),r=$.useCallback(o=>n(i=>dm(o,i)),[]);return[t,n,r]}function xk(e){const[t,n]=$.useState(e),r=$.useCallback(o=>n(i=>hm(o,i)),[]);return[t,n,r]}function Sk({dimensions:e,lineWidth:t,variant:n,className:r}){return M.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:xe(["react-flow__background-pattern",n,r])})}function Ek({radius:e,className:t}){return M.jsx("circle",{cx:e,cy:e,r:e,className:xe(["react-flow__background-pattern","dots",t])})}var ln;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ln||(ln={}));const _k={[ln.Dots]:1,[ln.Lines]:1,[ln.Cross]:6},kk=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jm({id:e,variant:t=ln.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:l,style:u,className:a,patternClassName:d}){const c=$.useRef(null),{transform:f,patternId:m}=ne(kk,de),y=r||_k[t],w=t===ln.Dots,x=t===ln.Cross,h=Array.isArray(n)?n:[n,n],g=[h[0]*f[2]||1,h[1]*f[2]||1],p=y*f[2],v=Array.isArray(i)?i:[i,i],E=x?[p,p]:g,_=[v[0]*f[2]||1+E[0]/2,v[1]*f[2]||1+E[1]/2],N=`${m}${e||""}`;return M.jsxs("svg",{className:xe(["react-flow__background",a]),style:{...u,...Zs,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:c,"data-testid":"rf__background",children:[M.jsx("pattern",{id:N,x:f[0]%g[0],y:f[1]%g[1],width:g[0],height:g[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:w?M.jsx(Ek,{radius:p/2,className:d}):M.jsx(Sk,{dimensions:E,lineWidth:o,variant:t,className:d})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}jm.displayName="Background";const Ck=$.memo(jm);function Nk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Mk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Pk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Tk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Ik(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function wi({children:e,className:t,...n}){return M.jsx("button",{type:"button",className:xe(["react-flow__controls-button",t]),...n,children:e})}const zk=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Hm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:u,className:a,children:d,position:c="bottom-left",orientation:f="vertical","aria-label":m}){const y=he(),{isInteractive:w,minZoomReached:x,maxZoomReached:h,ariaLabelConfig:g}=ne(zk,de),{zoomIn:p,zoomOut:v,fitView:E}=Uo(),_=()=>{p(),i==null||i()},N=()=>{v(),s==null||s()},P=()=>{E(o),l==null||l()},L=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},j=f==="horizontal"?"horizontal":"vertical";return M.jsxs(Ks,{className:xe(["react-flow__controls",j,a]),position:c,style:e,"data-testid":"rf__controls","aria-label":m??g["controls.ariaLabel"],children:[t&&M.jsxs(M.Fragment,{children:[M.jsx(wi,{onClick:_,className:"react-flow__controls-zoomin",title:g["controls.zoomIn.ariaLabel"],"aria-label":g["controls.zoomIn.ariaLabel"],disabled:h,children:M.jsx(Nk,{})}),M.jsx(wi,{onClick:N,className:"react-flow__controls-zoomout",title:g["controls.zoomOut.ariaLabel"],"aria-label":g["controls.zoomOut.ariaLabel"],disabled:x,children:M.jsx(Mk,{})})]}),n&&M.jsx(wi,{className:"react-flow__controls-fitview",onClick:P,title:g["controls.fitView.ariaLabel"],"aria-label":g["controls.fitView.ariaLabel"],children:M.jsx(Pk,{})}),r&&M.jsx(wi,{className:"react-flow__controls-interactive",onClick:L,title:g["controls.interactive.ariaLabel"],"aria-label":g["controls.interactive.ariaLabel"],children:w?M.jsx(Ik,{}):M.jsx(Tk,{})}),d]})}Hm.displayName="Controls";const Lk=$.memo(Hm);function Ak({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:l,strokeWidth:u,className:a,borderRadius:d,shapeRendering:c,selected:f,onClick:m}){const{background:y,backgroundColor:w}=i||{},x=s||y||w;return M.jsx("rect",{className:xe(["react-flow__minimap-node",{selected:f},a]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:x,stroke:l,strokeWidth:u},shapeRendering:c,onClick:m?h=>m(h,e):void 0})}const Rk=$.memo(Ak),$k=e=>e.nodes.map(t=>t.id),Ol=e=>e instanceof Function?e:()=>e;function Dk({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=Rk,onClick:s}){const l=ne($k,de),u=Ol(t),a=Ol(e),d=Ol(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:l.map(f=>M.jsx(Ok,{id:f,nodeColorFunc:u,nodeStrokeColorFunc:a,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:c},f))})}function Fk({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:l,onClick:u}){const{node:a,x:d,y:c,width:f,height:m}=ne(y=>{const w=y.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:h,y:g}=w.internals.positionAbsolute,{width:p,height:v}=Ht(x);return{node:x,x:h,y:g,width:p,height:v}},de);return!a||a.hidden||!Dg(a)?null:M.jsx(l,{x:d,y:c,width:f,height:m,style:a.style,selected:!!a.selected,className:r(a),color:t(a),borderRadius:o,strokeColor:n(a),strokeWidth:i,shapeRendering:s,onClick:u,id:a.id})}const Ok=$.memo(Fk);var jk=$.memo(Dk);const Hk=200,Vk=150,bk=e=>!e.hidden,Bk=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?$g(bo(e.nodeLookup,{filter:bk}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Wk="react-flow__minimap-desc";function Vm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:a,maskStrokeColor:d,maskStrokeWidth:c,position:f="bottom-right",onClick:m,onNodeClick:y,pannable:w=!1,zoomable:x=!1,ariaLabel:h,inversePan:g,zoomStep:p=1,offsetScale:v=5}){const E=he(),_=$.useRef(null),{boundingRect:N,viewBB:P,rfId:L,panZoom:j,translateExtent:z,flowWidth:R,flowHeight:H,ariaLabelConfig:C}=ne(Bk,de),A=(e==null?void 0:e.width)??Hk,I=(e==null?void 0:e.height)??Vk,D=N.width/A,k=N.height/I,S=Math.max(D,k),T=S*A,O=S*I,F=v*S,W=N.x-(T-N.width)/2-F,V=N.y-(O-N.height)/2-F,U=T+F*2,Y=O+F*2,Q=`${Wk}-${L}`,B=$.useRef(0),K=$.useRef();B.current=S,$.useEffect(()=>{if(_.current&&j)return K.current=YE({domNode:_.current,panZoom:j,getTransform:()=>E.getState().transform,getViewScale:()=>B.current}),()=>{var Z;(Z=K.current)==null||Z.destroy()}},[j]),$.useEffect(()=>{var Z;(Z=K.current)==null||Z.update({translateExtent:z,width:R,height:H,inversePan:g,pannable:w,zoomStep:p,zoomable:x})},[w,x,g,p,z,R,H]);const ee=m?Z=>{var oe;const[ie,ue]=((oe=K.current)==null?void 0:oe.pointer(Z))||[0,0];m(Z,{x:ie,y:ue})}:void 0,J=y?$.useCallback((Z,ie)=>{const ue=E.getState().nodeLookup.get(ie).internals.userNode;y(Z,ue)},[]):void 0,q=h??C["minimap.ariaLabel"];return M.jsx(Ks,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*S:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:xe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:A,height:I,viewBox:`${W} ${V} ${U} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:_,onClick:ee,children:[q&&M.jsx("title",{id:Q,children:q}),M.jsx(jk,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:l}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-F},${V-F}h${U+F*2}v${Y+F*2}h${-U-F*2}z
- M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Vm.displayName="MiniMap";const Uk=$.memo(Vm),Yk=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Xk={[kr.Line]:"right",[kr.Handle]:"bottom-right"};function Qk({nodeId:e,position:t,variant:n=kr.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:a=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:m=!0,shouldResize:y,onResizeStart:w,onResize:x,onResizeEnd:h}){const g=vm(),p=typeof e=="string"?e:g,v=he(),E=$.useRef(null),_=n===kr.Handle,N=ne($.useCallback(Yk(_&&m),[_,m]),de),P=$.useRef(null),L=t??Xk[n];$.useEffect(()=>{if(!(!E.current||!p))return P.current||(P.current=s_({domNode:E.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:z,transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A,domNode:I}=v.getState();return{nodeLookup:z,transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A,paneDomNode:I}},onChange:(z,R)=>{const{triggerNodeChanges:H,nodeLookup:C,parentLookup:A,nodeOrigin:I}=v.getState(),D=[],k={x:z.x,y:z.y},S=C.get(p);if(S&&S.expandParent&&S.parentId){const T=S.origin??I,O=z.width??S.measured.width??0,F=z.height??S.measured.height??0,W={id:S.id,parentId:S.parentId,rect:{width:O,height:F,...Fg({x:z.x??S.position.x,y:z.y??S.position.y},{width:O,height:F},S.parentId,C,T)}},V=rc([W],C,A,I);D.push(...V),k.x=z.x?Math.max(T[0]*O,z.x):void 0,k.y=z.y?Math.max(T[1]*F,z.y):void 0}if(k.x!==void 0&&k.y!==void 0){const T={id:p,type:"position",position:{...k}};D.push(T)}if(z.width!==void 0&&z.height!==void 0){const O={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};D.push(O)}for(const T of R){const O={...T,type:"position"};D.push(O)}H(D)},onEnd:({width:z,height:R})=>{const H={id:p,type:"dimensions",resizing:!1,dimensions:{width:z,height:R}};v.getState().triggerNodeChanges([H])}})),P.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:u,maxWidth:a,maxHeight:d},keepAspectRatio:c,resizeDirection:f,onResizeStart:w,onResize:x,onResizeEnd:h,shouldResize:y}),()=>{var z;(z=P.current)==null||z.destroy()}},[L,l,u,a,d,c,w,x,h,y]);const j=L.split("-");return M.jsx("div",{className:xe(["react-flow__resize-control","nodrag",...j,n,r]),ref:E,style:{...o,scale:N,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}$.memo(Qk);function Gk(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}const Kk=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function un(e){const t=[];for(let n=0,r=e.length;nWe||e.height>We)&&(e.width>We&&e.height>We?e.width>e.height?(e.height*=We/e.width,e.width=We):(e.width*=We/e.height,e.height=We):e.width>We?(e.height*=We/e.width,e.width=We):(e.width*=We/e.height,e.height=We))}function Ss(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function tC(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function nC(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),tC(o)}const Be=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Be(n,t)};function rC(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function oC(e,t){return bm(t).map(n=>{const r=e.getPropertyValue(n),o=e.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function iC(e,t,n,r){const o=`.${e}:${t}`,i=n.cssText?rC(n):oC(n,r);return document.createTextNode(`${o}{${i}}`)}function Pd(e,t,n,r){const o=window.getComputedStyle(e,n),i=o.getPropertyValue("content");if(i===""||i==="none")return;const s=Kk();try{t.className=`${t.className} ${s}`}catch{return}const l=document.createElement("style");l.appendChild(iC(s,n,o,r)),t.appendChild(l)}function sC(e,t,n){Pd(e,t,":before",n),Pd(e,t,":after",n)}const Td="application/font-woff",Id="image/jpeg",lC={woff:Td,woff2:Td,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Id,jpeg:Id,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function uC(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ic(e){const t=uC(e).toLowerCase();return lC[t]||""}function aC(e){return e.split(/,/)[1]}function Qu(e){return e.search(/^(data:)/)!==-1}function cC(e,t){return`data:${t};base64,${e}`}async function Wm(e,t,n){const r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise((i,s)=>{const l=new FileReader;l.onerror=s,l.onloadend=()=>{try{i(n({res:r,result:l.result}))}catch(u){s(u)}},l.readAsDataURL(o)})}const jl={};function fC(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function sc(e,t,n){const r=fC(e,t,n.includeQueryParams);if(jl[r]!=null)return jl[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let o;try{const i=await Wm(e,n.fetchRequestInit,({res:s,result:l})=>(t||(t=s.headers.get("Content-Type")||""),aC(l)));o=cC(i,t)}catch(i){o=n.imagePlaceholder||"";let s=`Failed to fetch resource: ${e}`;i&&(s=typeof i=="string"?i:i.message),s&&console.warn(s)}return jl[r]=o,o}async function dC(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Ss(t)}async function hC(e,t){if(e.currentSrc){const i=document.createElement("canvas"),s=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,s==null||s.drawImage(e,0,0,i.width,i.height);const l=i.toDataURL();return Ss(l)}const n=e.poster,r=ic(n),o=await sc(n,r,t);return Ss(o)}async function pC(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await Js(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function gC(e,t){return Be(e,HTMLCanvasElement)?dC(e):Be(e,HTMLVideoElement)?hC(e,t):Be(e,HTMLIFrameElement)?pC(e,t):e.cloneNode(Um(e))}const mC=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Um=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function yC(e,t,n){var r,o;if(Um(t))return t;let i=[];return mC(e)&&e.assignedNodes?i=un(e.assignedNodes()):Be(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?i=un(e.contentDocument.body.childNodes):i=un(((o=e.shadowRoot)!==null&&o!==void 0?o:e).childNodes),i.length===0||Be(e,HTMLVideoElement)||await i.reduce((s,l)=>s.then(()=>Js(l,n)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function vC(e,t,n){const r=t.style;if(!r)return;const o=window.getComputedStyle(e);o.cssText?(r.cssText=o.cssText,r.transformOrigin=o.transformOrigin):bm(n).forEach(i=>{let s=o.getPropertyValue(i);i==="font-size"&&s.endsWith("px")&&(s=`${Math.floor(parseFloat(s.substring(0,s.length-2)))-.1}px`),Be(e,HTMLIFrameElement)&&i==="display"&&s==="inline"&&(s="block"),i==="d"&&t.getAttribute("d")&&(s=`path(${t.getAttribute("d")})`),r.setProperty(i,s,o.getPropertyPriority(i))})}function wC(e,t){Be(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Be(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function xC(e,t){if(Be(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find(o=>e.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function SC(e,t,n){return Be(t,Element)&&(vC(e,t,n),sC(e,t,n),wC(e,t),xC(e,t)),t}async function EC(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const r={};for(let i=0;igC(r,t)).then(r=>yC(e,r,t)).then(r=>SC(e,r,t)).then(r=>EC(r,t))}const Ym=/url\((['"]?)([^'"]+?)\1\)/g,_C=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,kC=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function CC(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function NC(e){const t=[];return e.replace(Ym,(n,r,o)=>(t.push(o),n)),t.filter(n=>!Qu(n))}async function MC(e,t,n,r,o){try{const i=n?Gk(t,n):t,s=ic(t);let l;return o||(l=await sc(i,s,r)),e.replace(CC(t),`$1${l}$3`)}catch{}return e}function PC(e,{preferredFontFormat:t}){return t?e.replace(kC,n=>{for(;;){const[r,,o]=_C.exec(n)||[];if(!o)return"";if(o===t)return`src: ${r};`}}):e}function Xm(e){return e.search(Ym)!==-1}async function Qm(e,t,n){if(!Xm(e))return e;const r=PC(e,n);return NC(r).reduce((i,s)=>i.then(l=>MC(l,s,t,n)),Promise.resolve(r))}async function Vn(e,t,n){var r;const o=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(o){const i=await Qm(o,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function TC(e,t){await Vn("background",e,t)||await Vn("background-image",e,t),await Vn("mask",e,t)||await Vn("-webkit-mask",e,t)||await Vn("mask-image",e,t)||await Vn("-webkit-mask-image",e,t)}async function IC(e,t){const n=Be(e,HTMLImageElement);if(!(n&&!Qu(e.src))&&!(Be(e,SVGImageElement)&&!Qu(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await sc(r,ic(r),t);await new Promise((i,s)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(a){s(a)}}:s;const l=e;l.decode&&(l.decode=i),l.loading==="lazy"&&(l.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o})}async function zC(e,t){const r=un(e.childNodes).map(o=>Gm(o,t));await Promise.all(r).then(()=>e)}async function Gm(e,t){Be(e,Element)&&(await TC(e,t),await IC(e,t),await zC(e,t))}function LC(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(o=>{n[o]=r[o]}),e}const zd={};async function Ld(e){let t=zd[e];if(t!=null)return t;const r=await(await fetch(e)).text();return t={url:e,cssText:r},zd[e]=t,t}async function Ad(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async s=>{let l=s.replace(r,"$1");return l.startsWith("https://")||(l=new URL(l,e.url).href),Wm(l,t.fetchRequestInit,({result:u})=>(n=n.replace(s,`url(${u})`),[s,u]))});return Promise.all(i).then(()=>n)}function Rd(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=e.replace(n,"");const o=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=o.exec(r);if(u===null)break;t.push(u[0])}r=r.replace(o,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(s,"gi");for(;;){let u=i.exec(r);if(u===null){if(u=l.exec(r),u===null)break;i.lastIndex=l.lastIndex}else l.lastIndex=i.lastIndex;t.push(u[0])}return t}async function AC(e,t){const n=[],r=[];return e.forEach(o=>{if("cssRules"in o)try{un(o.cssRules||[]).forEach((i,s)=>{if(i.type===CSSRule.IMPORT_RULE){let l=s+1;const u=i.href,a=Ld(u).then(d=>Ad(d,t)).then(d=>Rd(d).forEach(c=>{try{o.insertRule(c,c.startsWith("@import")?l+=1:o.cssRules.length)}catch(f){console.error("Error inserting rule from remote css",{rule:c,error:f})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(a)}})}catch(i){const s=e.find(l=>l.href==null)||document.styleSheets[0];o.href!=null&&r.push(Ld(o.href).then(l=>Ad(l,t)).then(l=>Rd(l).forEach(u=>{s.insertRule(u,s.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",i)}}),Promise.all(r).then(()=>(e.forEach(o=>{if("cssRules"in o)try{un(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function RC(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Xm(t.style.getPropertyValue("src")))}async function $C(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=un(e.ownerDocument.styleSheets),r=await AC(n,t);return RC(r)}function Km(e){return e.trim().replace(/["']/g,"")}function DC(e){const t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{t.add(Km(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(e),t}async function FC(e,t){const n=await $C(e,t),r=DC(e);return(await Promise.all(n.filter(i=>r.has(Km(i.style.fontFamily))).map(i=>{const s=i.parentStyleSheet?i.parentStyleSheet.href:null;return Qm(i.cssText,s,t)}))).join(`
-`)}async function OC(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await FC(e,t);if(n){const r=document.createElement("style"),o=document.createTextNode(n);r.appendChild(o),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function jC(e,t={}){const{width:n,height:r}=Bm(e,t),o=await Js(e,t,!0);return await OC(o,t),await Gm(o,t),LC(o,t),await nC(o,n,r)}async function HC(e,t={}){const{width:n,height:r}=Bm(e,t),o=await jC(e,t),i=await Ss(o),s=document.createElement("canvas"),l=s.getContext("2d"),u=t.pixelRatio||Jk(),a=t.canvasWidth||n,d=t.canvasHeight||r;return s.width=a*u,s.height=d*u,t.skipAutoScale||eC(s),s.style.width=`${a}`,s.style.height=`${d}`,t.backgroundColor&&(l.fillStyle=t.backgroundColor,l.fillRect(0,0,s.width,s.height)),l.drawImage(i,0,0,s.width,s.height),s}async function VC(e,t={}){return(await HC(e,t)).toDataURL()}function bC(e,t){const n=Object.fromEntries(e.map(h=>[h.id,h])),r=h=>e.filter(g=>g.type===h),o=r("route");r("handler");const i=new Map;o.forEach(h=>{var g,p;i.set(h.id,{method:((g=h.data)==null?void 0:g.method)||"GET",path:((p=h.data)==null?void 0:p.path)||"/",middleware:[]})});const s=t.filter(h=>h.edgeType==="wraps"),l=new Map;s.forEach(h=>l.set(h.target,h.source)),o.forEach(h=>{var v;const g=[];let p=l.get(h.id);for(;p&&((v=n[p])==null?void 0:v.type)==="middleware";)g.unshift(n[p].data.name),p=l.get(p);g.length&&(i.get(h.id).middleware=g)});const u=new Map;t.filter(h=>h.edgeType==="extends").forEach(h=>{var v,E;const g=n[h.source],p=n[h.target];(v=g==null?void 0:g.data)!=null&&v.name&&((E=p==null?void 0:p.data)!=null&&E.name)&&u.set(g.data.name,p.data.name)});const d=t.filter(h=>h.edgeType==="handles"),c=new Map;d.forEach(h=>{var p;const g=n[h.target];if((p=g==null?void 0:g.data)!=null&&p.name){const v=[];let E=g.data.name;for(;E;)v.push(E),E=u.get(E);c.set(h.source,v)}}),o.forEach(h=>{c.has(h.id)||c.set(h.id,[])});const f=new Set;c.forEach(h=>h.forEach(g=>f.add(g)));const m=new Map;[...f].forEach(h=>{const g="class:"+h;m.set(g,{id:g,name:h,isAbstract:!0,routes:[],parentId:null,isLambda:!1})}),u.forEach((h,g)=>{const p="class:"+g,v="class:"+h;m.has(p)&&m.has(v)&&(m.get(p).parentId=v)}),c.forEach((h,g)=>{if(h.length===0){const p=i.get(g),v="class:Lambda:"+p.method+":"+encodeURIComponent(p.path);m.set(v,{id:v,name:"Lambda Handler",isAbstract:!1,isLambda:!0,method:p.method,path:p.path,routes:[{method:p.method,path:p.path,middleware:p.middleware}],parentId:null})}else{const v="class:"+h[0];if(m.has(v)){const E=m.get(v);E.isAbstract=!1;const _=i.get(g);E.routes.push({method:_.method,path:_.path,middleware:_.middleware})}}});const y=[...m.values()].map(h=>({id:h.id,type:"handler",data:{name:h.name,isAbstract:h.isAbstract,isLambda:h.isLambda,method:h.method,path:h.path,routes:h.routes,middleware:h.routes.length>0?[...new Set(h.routes.flatMap(g=>g.middleware))]:[]}})),w=new Set,x=[];return m.forEach((h,g)=>{if(h.parentId){const p=h.parentId+"->"+g;w.has(p)||(w.add(p),x.push({id:p,source:h.parentId,target:g,edgeType:"extends"}))}}),{nodes:y,edges:x}}const BC=60,Zm=12,WC=48,xi=60,$d=60,UC=160,YC=50,XC=260,QC=230,GC=80;function qm(e){var t;return(t=e.data)!=null&&t.isAbstract?UC:XC}function lc(e){var r,o,i,s,l;if((r=e.data)!=null&&r.isAbstract)return YC;const t=((i=(o=e.data)==null?void 0:o.routes)==null?void 0:i.length)||1,n=(((l=(s=e.data)==null?void 0:s.middleware)==null?void 0:l.length)||0)>0;return 53+t*22+(n?22:0)+20}function Es(e,t,n){const r=t.get(e)||[],o=lc(n[e]);if(!r.length)return o;const i=r.reduce((s,l,u)=>s+Es(l,t,n)+(u>0?Zm:0),0);return Math.max(o,i)}function Jm(e,t,n,r,o,i){const s=o[e],l=r.get(e)||[],u=lc(s),a=qm(s),d=Es(e,r,o);if(i.set(e,{x:t,y:n+(d-u)/2}),l.length){const c=t+a+BC;let f=n;l.forEach(m=>{const y=Es(m,r,o);Jm(m,c,f,r,o,i),f+=y+Zm})}}function KC(e,t){const n=e.filter(w=>{var x;return(x=w.data)==null?void 0:x.isLambda}),r=e.filter(w=>{var x;return!((x=w.data)!=null&&x.isLambda)}),o=Object.fromEntries(r.map(w=>[w.id,w])),i=new Map,s=new Set;t.forEach(w=>{w.edgeType==="extends"&&(i.has(w.source)||i.set(w.source,[]),i.get(w.source).push(w.target),s.add(w.target))});const l=r.filter(w=>!s.has(w.id)),u=new Map;let a=$d;l.forEach(w=>{const x=Es(w.id,i,o);Jm(w.id,xi,a,i,o,u),a+=x+WC});let d=-1/0,c=-1/0,f=1/0;const m=r.map(w=>{const x=u.get(w.id)||{x:xi,y:$d},h=x.x+qm(w),g=x.y+lc(w);return h>d&&(d=h),g>c&&(c=g),x.y{m.push({..._,position:{x:v+N%x*h,y:E+Math.floor(N/x)*g}})})}const y=t.filter(w=>w.edgeType==="extends").map((w,x)=>({...w,id:w.id||`ext-${x}`,type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#2e3347",strokeWidth:1.5},markerEnd:{type:"arrowclosed",width:11,height:11,color:"#2e3347"},animated:!1}));return{nodes:m,edges:y}}const Si={GET:{bg:"#0d4429",color:"#4ade80"},POST:{bg:"#172554",color:"#60a5fa"},PUT:{bg:"#451a03",color:"#fb923c"},PATCH:{bg:"#2e1065",color:"#c084fc"},DELETE:{bg:"#450a0a",color:"#f87171"},OPTIONS:{bg:"#1c1917",color:"#a8a29e"},HEAD:{bg:"#1c1917",color:"#a8a29e"}},Hl=M.jsx(Nr,{type:"target",position:G.Left,style:{left:0,top:"50%",transform:"translateY(-50%)"}}),Vl=M.jsx(Nr,{type:"source",position:G.Right,style:{right:0,top:"50%",transform:"translateY(-50%)"}});function ZC({data:e,selected:t}){var n,r,o,i;if(e.isAbstract)return M.jsxs("div",{style:{background:"rgba(239,68,68,0.05)",border:t?"2px solid #60a5fa":"1px solid #ef4444",borderRadius:8,padding:"8px 14px",width:160,fontFamily:"system-ui, sans-serif",boxSizing:"border-box"},children:[Hl,Vl,M.jsx("div",{style:{fontSize:9,color:"#ef4444",fontWeight:700,letterSpacing:.5,marginBottom:3},children:"ABSTRACT"}),M.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e2e8f0",fontFamily:"monospace"},children:e.name})]});if(e.isLambda){const s=e.method||"GET",l=e.path||"/",u=Si[s]||Si.OPTIONS,a=l.replace(/\{([^}]+)\}/g,'{$1}');return M.jsxs("div",{style:{background:"#1a1d27",border:t?"2px solid #60a5fa":"1px solid #3b82f6",borderRadius:8,padding:"10px 12px",width:230,fontFamily:"system-ui, sans-serif",boxSizing:"border-box"},children:[Hl,Vl,M.jsx("div",{style:{fontSize:9,color:"#60a5fa",fontWeight:700,letterSpacing:.5,marginBottom:7},children:"LAMBDA"}),M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[M.jsx("span",{style:{background:u.bg,color:u.color,fontSize:9,fontWeight:700,padding:"2px 5px",borderRadius:3,fontFamily:"monospace",flexShrink:0},children:s}),M.jsx("span",{style:{fontSize:10,fontFamily:"monospace",color:"#8892a4"},dangerouslySetInnerHTML:{__html:a}})]}),((n=e.middleware)==null?void 0:n.length)>0&&M.jsx("div",{style:{display:"flex",gap:3,flexWrap:"wrap",marginTop:7},children:e.middleware.map(d=>M.jsx("span",{style:{background:"#1f1a0e",color:"#f6ad55",fontSize:8,fontWeight:600,padding:"1px 4px",borderRadius:2,fontFamily:"monospace"},children:d},d))})]})}return M.jsxs("div",{style:{background:"#1a1d27",border:t?"2px solid #60a5fa":"1px solid #3b82f6",borderRadius:8,padding:"10px 12px",width:260,fontFamily:"system-ui, sans-serif",boxSizing:"border-box"},children:[Hl,Vl,M.jsxs("div",{style:{marginBottom:8},children:[M.jsx("div",{style:{fontSize:9,color:"#60a5fa",fontWeight:700,letterSpacing:.5,marginBottom:2},children:"HANDLER"}),M.jsx("div",{style:{fontSize:12,fontWeight:700,color:"#e2e8f0",fontFamily:"monospace"},children:e.name})]}),M.jsx("div",{style:{height:1,background:"#2e3347",marginBottom:8}}),M.jsx("div",{style:{marginBottom:((r=e.middleware)==null?void 0:r.length)>0?8:0},children:(o=e.routes)==null?void 0:o.map((s,l)=>{const u=Si[s.method]||Si.OPTIONS,a=(s.path||"/").replace(/\{([^}]+)\}/g,'{$1}');return M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:l0&&M.jsx("div",{style:{display:"flex",gap:3,flexWrap:"wrap"},children:e.middleware.map(s=>M.jsx("span",{style:{background:"#1f1a0e",color:"#f6ad55",fontSize:8,fontWeight:600,padding:"1px 4px",borderRadius:2,fontFamily:"monospace"},children:s},s))})]})}const qC={handler:ZC};function JC(e){const{getNodes:t}=Uo();$.useEffect(()=>{e.current=()=>{const n=t();if(!n.length)return;const r=zg(n),o=60,i=Math.max(1920,r.width+o*2),s=Math.max(1080,r.height+o*2),l=Ys(r,i,s,.1,4,o);VC(document.querySelector(".react-flow__viewport"),{backgroundColor:"#0f1117",width:i,height:s,style:{width:i+"px",height:s+"px",transform:`translate(${l.x}px,${l.y}px) scale(${l.zoom})`}}).then(u=>{const a=document.createElement("a");a.download="flash-routes.png",a.href=u,a.click()}).catch(console.error)}},[t,e])}function eN({styledNodes:e,styledEdges:t,onNodesChange:n,onEdgesChange:r,onNodeMouseEnter:o,onNodeMouseLeave:i,showLambdas:s,searchQuery:l,exportRef:u}){const{fitView:a}=Uo();return JC(u),$.useEffect(()=>{setTimeout(()=>a({padding:.15,duration:300}),50)},[s,l,a]),M.jsxs(vk,{nodes:e,edges:t,onNodesChange:n,onEdgesChange:r,onNodeMouseEnter:o,onNodeMouseLeave:i,nodeTypes:qC,fitView:!0,fitViewOptions:{padding:.15},colorMode:"dark",minZoom:.03,maxZoom:2,panOnDrag:!0,panOnScroll:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,zoomOnDoubleClick:!0,children:[M.jsx(Ck,{color:"#161822",gap:32,size:1}),M.jsx(Lk,{showInteractive:!1,style:{background:"#12141c",border:"1px solid #1e2235"}}),M.jsx(Uk,{style:{background:"#12141c",border:"1px solid #1e2235"},maskColor:"rgba(0,0,0,0.5)",nodeColor:d=>{var c;return(c=d.data)!=null&&c.isAbstract?"#ef444499":"#3b82f666"}})]})}function tN(){const[e,t]=$.useState([]),[n,r]=$.useState([]),[o,i,s]=wk([]),[l,u,a]=xk([]),[d,c]=$.useState(!0),[f,m]=$.useState(null),[y,w]=$.useState(null),[x,h]=$.useState(null),[g,p]=$.useState({nodes:new Set,edges:new Set}),[v,E]=$.useState(!1),[_,N]=$.useState(""),[P,L]=$.useState(!1),j=$.useRef(null);$.useEffect(()=>{fetch("/routeviewer/data").then(S=>{if(!S.ok)throw new Error(S.statusText);return S.json()}).then(S=>{const T=S.nodes.filter(U=>U.type==="route").length,{nodes:O,edges:F}=bC(S.nodes,S.edges),{nodes:W,edges:V}=KC(O,F);t(W),r(V),w({routes:T}),c(!1)}).catch(S=>{m(S.message),c(!1)})},[]);const z=$.useMemo(()=>{const S=new Map;return n.forEach(T=>{T.edgeType==="extends"&&S.set(T.target,T.source)}),T=>{const O=new Set;let F=S.get(T);for(;F;)O.add(F),F=S.get(F);return O}},[n]);$.useEffect(()=>{const S=_.trim().toLowerCase(),T=new Set(e.filter(V=>{var U;return(U=V.data)==null?void 0:U.isLambda}).map(V=>V.id));let O=new Set(e.map(V=>V.id));if(S){const V=new Set(e.filter(Y=>{var Q,B;return(((Q=Y.data)==null?void 0:Q.name)||"").toLowerCase().includes(S)||(((B=Y.data)==null?void 0:B.routes)||[]).some(K=>K.path.toLowerCase().includes(S))}).map(Y=>Y.id)),U=new Set(V);V.forEach(Y=>z(Y).forEach(Q=>U.add(Q))),O=U}const F=e.filter(V=>T.has(V.id)&&!v?!1:O.has(V.id)),W=new Set(F.map(V=>V.id));i(F),u(n.filter(V=>W.has(V.source)&&W.has(V.target)))},[v,_,e,n,i,u,z]);const R=$.useCallback((S,T)=>{const O=new Map;l.forEach(U=>{U.edgeType==="extends"&&O.set(U.target,{pid:U.source,eid:U.id})});const F=new Set([T.id]),W=new Set,V=[T.id];for(;V.length;){const U=V.shift(),Y=O.get(U);Y&&!F.has(Y.pid)&&(W.add(Y.eid),F.add(Y.pid),V.push(Y.pid))}h(T.id),p({nodes:F,edges:W})},[l]),H=$.useCallback(()=>{h(null),p({nodes:new Set,edges:new Set})},[]),C=o.map(S=>({...S,style:{opacity:x&&!g.nodes.has(S.id)?.1:1,transition:"opacity 0.15s"}})),A=l.map(S=>{const T={type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#1e2235",strokeWidth:1.5},markerEnd:{type:xr.ArrowClosed,width:10,height:10,color:"#1e2235"}};return x?g.edges.has(S.id)?{...S,type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#60a5fa",strokeWidth:2.5},markerEnd:{type:xr.ArrowClosed,width:13,height:13,color:"#60a5fa"}}:{...S,...T,style:{...T.style,opacity:.04}}:{...S,...T}}),I=e.filter(S=>{var T;return(T=S.data)==null?void 0:T.isLambda}).length,D=e.filter(S=>{var T;return!((T=S.data)!=null&&T.isLambda)}).length,k=$.useCallback(()=>{L(!0),setTimeout(()=>{var S;(S=j.current)==null||S.call(j),setTimeout(()=>L(!1),1200)},50)},[]);return M.jsxs("div",{style:{display:"flex",width:"100vw",height:"100vh",overflow:"hidden",background:"#0f1117"},children:[M.jsxs("aside",{style:{width:"240px",minWidth:"240px",flexShrink:0,display:"flex",flexDirection:"column",background:"#0c0e15",borderRight:"1px solid #1a1d2a",fontFamily:"system-ui, sans-serif",color:"#c8cfe0"},children:[M.jsx("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid #1a1d2a",display:"flex",alignItems:"center",gap:8},children:M.jsx("span",{style:{fontSize:15,fontWeight:700,letterSpacing:"-0.3px"},children:"⚡ Route Viewer"})}),M.jsxs("div",{style:{padding:"14px 14px",overflowY:"auto",flex:1},children:[M.jsxs(Ei,{label:"SEARCH",children:[M.jsx("input",{type:"text",placeholder:"handler or path…",value:_,onChange:S=>N(S.target.value),style:{width:"100%",boxSizing:"border-box",background:"#12141e",border:"1px solid #1e2235",borderRadius:5,padding:"6px 9px",color:"#c8cfe0",fontSize:12,fontFamily:"monospace",outline:"none"}}),_&&M.jsxs("div",{style:{fontSize:11,color:"#4a5370",marginTop:5},children:[o.length," node",o.length!==1?"s":""," visible"]})]}),M.jsxs(Ei,{label:"DISPLAY",children:[M.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",fontSize:12},children:[M.jsx("input",{type:"checkbox",checked:v,onChange:S=>E(S.target.checked),style:{cursor:"pointer",accentColor:"#3b82f6"}}),M.jsx("span",{style:{color:"#8892a4"},children:"Show lambda handlers"})]}),M.jsxs("div",{style:{fontSize:11,color:"#343b54",marginTop:4,paddingLeft:21},children:[I," lambda",I!==1?"s":""]})]}),M.jsx(Ei,{label:"STATS",children:[["Routes",(y==null?void 0:y.routes)||0],["Handlers",D],["Lambdas",I]].map(([S,T])=>M.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,marginBottom:5},children:[M.jsx("span",{style:{color:"#4a5370"},children:S}),M.jsx("span",{style:{color:"#e2e8f0",fontWeight:600,fontFamily:"monospace"},children:T})]},S))}),M.jsx(Ei,{label:"LEGEND",children:[{dot:"#3b82f6",border:"#3b82f6",label:"Handler"},{dot:"#ef4444",border:"#ef4444",label:"Abstract"},{dot:"#f6ad55",border:"#f6ad55",label:"Middleware"}].map(({dot:S,label:T})=>M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[M.jsx("div",{style:{width:9,height:9,borderRadius:2,background:S,flexShrink:0,opacity:.8}}),M.jsx("span",{style:{fontSize:12,color:"#4a5370"},children:T})]},T))}),M.jsxs("div",{style:{fontSize:11,color:"#2d3347",lineHeight:1.65,marginTop:4},children:["Hover a node to trace its ancestry.",M.jsx("br",{}),"Search filters nodes + parents."]})]}),M.jsx("div",{style:{padding:"12px 14px",borderTop:"1px solid #1a1d2a"},children:M.jsx("button",{onClick:k,disabled:P||d,style:{width:"100%",padding:"8px 0",background:P?"#1e2235":"#12141e",border:"1px solid #1e2235",borderRadius:6,color:P?"#4a5370":"#8892a4",fontSize:12,cursor:P?"default":"pointer",fontFamily:"system-ui, sans-serif",transition:"all 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:P?"⏳ Exporting…":"⬇ Export PNG"})})]}),M.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:[M.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"9px 18px",background:"#0c0e15",borderBottom:"1px solid #1a1d2a",flexShrink:0,zIndex:10},children:[M.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#e2e8f0",letterSpacing:"-0.2px"},children:"Flash Route Graph"}),M.jsx("span",{style:{marginLeft:"auto",display:"flex",gap:18,fontSize:11,color:"#2d3347",fontFamily:"system-ui"},children:[["#3b82f6","handler"],["#ef4444","abstract"],["#f6ad55","middleware"]].map(([S,T])=>M.jsxs("span",{style:{display:"flex",alignItems:"center",gap:5},children:[M.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:S,display:"inline-block",opacity:.8}}),T]},T))})]}),d&&M.jsx("div",{className:"center muted",children:"Loading…"}),f&&M.jsxs("div",{className:"center error",children:["Error: ",f]}),!d&&!f&&M.jsx("div",{style:{flex:1,position:"relative"},children:M.jsx(Om,{children:M.jsx(eN,{styledNodes:C,styledEdges:A,onNodesChange:s,onEdgesChange:a,onNodeMouseEnter:R,onNodeMouseLeave:H,showLambdas:v,searchQuery:_,exportRef:j})})})]})]})}function Ei({label:e,children:t}){return M.jsxs("div",{style:{marginBottom:18},children:[M.jsx("div",{style:{fontSize:9,fontWeight:700,letterSpacing:1,color:"#272d42",marginBottom:8,fontFamily:"monospace"},children:e}),t]})}Gp(document.getElementById("root")).render(M.jsx($.StrictMode,{children:M.jsx(tN,{})}));
+`)),d=a.reduce((c,f)=>c.concat(...f),[]);return[a,d]}return[[],[]]},[e]);return $.useEffect(()=>{const u=(t==null?void 0:t.target)??fd,a=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var x,h;if(o.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!o.current||o.current&&!a)&&Hg(m))return!1;const w=hd(m.code,l);if(i.current.add(m[w]),dd(s,i.current,!1)){const g=((h=(x=m.composedPath)==null?void 0:x.call(m))==null?void 0:h[0])||m.target,p=(g==null?void 0:g.nodeName)==="BUTTON"||(g==null?void 0:g.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&m.preventDefault(),r(!0)}},c=m=>{const y=hd(m.code,l);dd(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[y]),m.key==="Meta"&&i.current.clear(),o.current=!1},f=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",d),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{u==null||u.removeEventListener("keydown",d),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function dd(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function hd(e,t){return t.includes(e)?"code":"key"}const J_=()=>{const e=he();return $.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:l}=e.getState(),u=Xs(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:l,y:u}=s.getBoundingClientRect(),a={x:t.x-l,y:t.y-u},d=n.snapGrid??o,c=n.snapToGrid??i;return Uo(a,r,c,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=ws(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function dm(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const l={...i};for(const u of s)e2(u,l);n.push(l)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function e2(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function hm(e,t){return dm(e,t)}function pm(e,t){return dm(e,t)}function yn(e,t){return{id:e,type:"select",selected:t}}function nr(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(yn(i.id,s)))}return r}function pd({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const l=t.get(s.id),u=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;u!==void 0&&u!==s&&n.push({id:s.id,item:s,type:"replace"}),u===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function gd(e){return{id:e.id,type:"remove"}}const md=e=>fE(e),t2=e=>zg(e);function gm(e){return $.forwardRef(e)}const n2=typeof window<"u"?$.useLayoutEffect:$.useEffect;function yd(e){const[t,n]=$.useState(BigInt(0)),[r]=$.useState(()=>r2(()=>n(o=>o+BigInt(1))));return n2(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function r2(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const mm=$.createContext(null);function o2({children:e}){const t=he(),n=$.useCallback(l=>{const{nodes:u=[],setNodes:a,hasDefaultNodes:d,onNodesChange:c,nodeLookup:f,fitViewQueued:m,onNodesChangeMiddlewareMap:y}=t.getState();let w=u;for(const h of l)w=typeof h=="function"?h(w):h;let x=pd({items:w,lookup:f});for(const h of y.values())x=h(x);d&&a(w),x.length>0?c==null||c(x):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:h,nodes:g,setNodes:p}=t.getState();h&&p(g)})},[]),r=yd(n),o=$.useCallback(l=>{const{edges:u=[],setEdges:a,hasDefaultEdges:d,onEdgesChange:c,edgeLookup:f}=t.getState();let m=u;for(const y of l)m=typeof y=="function"?y(m):y;d?a(m):c&&c(pd({items:m,lookup:f}))},[]),i=yd(o),s=$.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return M.jsx(mm.Provider,{value:s,children:e})}function i2(){const e=$.useContext(mm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const s2=e=>!!e.panZoom;function Yo(){const e=J_(),t=he(),n=i2(),r=ne(s2),o=$.useMemo(()=>{const i=c=>t.getState().nodeLookup.get(c),s=c=>{n.nodeQueue.push(c)},l=c=>{n.edgeQueue.push(c)},u=c=>{var h,g;const{nodeLookup:f,nodeOrigin:m}=t.getState(),y=md(c)?c:f.get(c.id),w=y.parentId?Fg(y.position,y.measured,y.parentId,f,m):y.position,x={...y,position:w,width:((h=y.measured)==null?void 0:h.width)??y.width,height:((g=y.measured)==null?void 0:g.height)??y.height};return _r(x)},a=(c,f,m={replace:!1})=>{s(y=>y.map(w=>{if(w.id===c){const x=typeof f=="function"?f(w):f;return m.replace&&md(x)?x:{...w,...x}}return w}))},d=(c,f,m={replace:!1})=>{l(y=>y.map(w=>{if(w.id===c){const x=typeof f=="function"?f(w):f;return m.replace&&t2(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var f;return(f=i(c))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(f=>({...f}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:s,setEdges:l,addNodes:c=>{const f=Array.isArray(c)?c:[c];n.nodeQueue.push(m=>[...m,...f])},addEdges:c=>{const f=Array.isArray(c)?c:[c];n.edgeQueue.push(m=>[...m,...f])},toObject:()=>{const{nodes:c=[],edges:f=[],transform:m}=t.getState(),[y,w,x]=m;return{nodes:c.map(h=>({...h})),edges:f.map(h=>({...h})),viewport:{x:y,y:w,zoom:x}}},deleteElements:async({nodes:c=[],edges:f=[]})=>{const{nodes:m,edges:y,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:h,triggerEdgeChanges:g,onDelete:p,onBeforeDelete:v}=t.getState(),{nodes:E,edges:_}=await gE({nodesToRemove:c,edgesToRemove:f,nodes:m,edges:y,onBeforeDelete:v}),N=_.length>0,P=E.length>0;if(N){const L=_.map(gd);x==null||x(_),g(L)}if(P){const L=E.map(gd);w==null||w(E),h(L)}return(P||N)&&(p==null||p({nodes:E,edges:_})),{deletedNodes:E,deletedEdges:_}},getIntersectingNodes:(c,f=!0,m)=>{const y=Yf(c),w=y?c:u(c),x=m!==void 0;return w?(m||t.getState().nodes).filter(h=>{const g=t.getState().nodeLookup.get(h.id);if(g&&!y&&(h.id===c.id||!g.internals.positionAbsolute))return!1;const p=_r(x?h:g),v=Lo(p,w);return f&&v>0||v>=p.width*p.height||v>=w.width*w.height}):[]},isNodeIntersecting:(c,f,m=!0)=>{const w=Yf(c)?c:u(c);if(!w)return!1;const x=Lo(w,f);return m&&x>0||x>=f.width*f.height||x>=w.width*w.height},updateNode:a,updateNodeData:(c,f,m={replace:!1})=>{a(c,y=>{const w=typeof f=="function"?f(y):f;return m.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},m)},updateEdge:d,updateEdgeData:(c,f,m={replace:!1})=>{d(c,y=>{const w=typeof f=="function"?f(y):f;return m.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},m)},getNodesBounds:c=>{const{nodeLookup:f,nodeOrigin:m}=t.getState();return Lg(c,{nodeLookup:f,nodeOrigin:m})},getHandleConnections:({type:c,id:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}-${c}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:c,handleId:f,nodeId:m})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${m}${c?f?`-${c}-${f}`:`-${c}`:""}`))==null?void 0:y.values())??[])},fitView:async c=>{const f=t.getState().fitViewResolver??wE();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:f}),n.nodeQueue.push(m=>[...m]),f.promise}}},[]);return $.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const vd=e=>e.selected,l2=typeof window<"u"?window:void 0;function u2({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=he(),{deleteElements:r}=Yo(),o=Ro(e,{actInsideInputWithModifier:!1}),i=Ro(t,{target:l2});$.useEffect(()=>{if(o){const{edges:s,nodes:l}=n.getState();r({nodes:l.filter(vd),edges:s.filter(vd)}),n.setState({nodesSelectionActive:!1})}},[o]),$.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function a2(e){const t=he();$.useEffect(()=>{const n=()=>{var o,i,s,l;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=Ja(e.current);(r.height===0||r.width===0)&&((l=(s=t.getState()).onError)==null||l.call(s,"004",kt.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const qs={position:"absolute",width:"100%",height:"100%",top:0,left:0},c2=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function f2({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Cn.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:a,minZoom:d,maxZoom:c,zoomActivationKeyCode:f,preventScrolling:m=!0,children:y,noWheelClassName:w,noPanClassName:x,onViewportChange:h,isControlledViewport:g,paneClickDistance:p,selectionOnDrag:v}){const E=he(),_=$.useRef(null),{userSelectionActive:N,lib:P,connectionInProgress:L}=ne(c2,de),j=Ro(f),z=$.useRef();a2(_);const R=$.useCallback(H=>{h==null||h({x:H[0],y:H[1],zoom:H[2]}),g||E.setState({transform:H})},[h,g]);return $.useEffect(()=>{if(_.current){z.current=n_({domNode:_.current,minZoom:d,maxZoom:c,translateExtent:a,viewport:u,onDraggingChange:I=>E.setState(D=>D.paneDragging===I?D:{paneDragging:I}),onPanZoomStart:(I,D)=>{const{onViewportChangeStart:k,onMoveStart:S}=E.getState();S==null||S(I,D),k==null||k(D)},onPanZoom:(I,D)=>{const{onViewportChange:k,onMove:S}=E.getState();S==null||S(I,D),k==null||k(D)},onPanZoomEnd:(I,D)=>{const{onViewportChangeEnd:k,onMoveEnd:S}=E.getState();S==null||S(I,D),k==null||k(D)}});const{x:H,y:C,zoom:A}=z.current.getViewport();return E.setState({panZoom:z.current,transform:[H,C,A],domNode:_.current.closest(".react-flow")}),()=>{var I;(I=z.current)==null||I.destroy()}}},[]),$.useEffect(()=>{var H;(H=z.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:m,noPanClassName:x,userSelectionActive:N,noWheelClassName:w,lib:P,onTransformChange:R,connectionInProgress:L,selectionOnDrag:v,paneClickDistance:p})},[e,t,n,r,o,i,s,l,j,m,x,N,w,P,R,L,v,p]),M.jsx("div",{className:"react-flow__renderer",ref:_,style:qs,children:y})}const d2=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function h2(){const{userSelectionActive:e,userSelectionRect:t}=ne(d2,de);return e&&t?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Fl=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},p2=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function g2({isSelecting:e,selectionKeyPressed:t,selectionMode:n=zo.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:a,onPaneScroll:d,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:m,children:y}){const w=he(),{userSelectionActive:x,elementsSelectable:h,dragging:g,connectionInProgress:p}=ne(p2,de),v=h&&(e||x),E=$.useRef(null),_=$.useRef(),N=$.useRef(new Set),P=$.useRef(new Set),L=$.useRef(!1),j=k=>{if(L.current||p){L.current=!1;return}u==null||u(k),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},z=k=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){k.preventDefault();return}a==null||a(k)},R=d?k=>d(k):void 0,H=k=>{L.current&&(k.stopPropagation(),L.current=!1)},C=k=>{var U,Y;const{domNode:S}=w.getState();if(_.current=S==null?void 0:S.getBoundingClientRect(),!_.current)return;const T=k.target===E.current;if(!T&&!!k.target.closest(".nokey")||!e||!(i&&T||t)||k.button!==0||!k.isPrimary)return;(Y=(U=k.target)==null?void 0:U.setPointerCapture)==null||Y.call(U,k.pointerId),L.current=!1;const{x:W,y:V}=dt(k.nativeEvent,_.current);w.setState({userSelectionRect:{width:0,height:0,startX:W,startY:V,x:W,y:V}}),T||(k.stopPropagation(),k.preventDefault())},A=k=>{const{userSelectionRect:S,transform:T,nodeLookup:F,edgeLookup:O,connectionLookup:W,triggerNodeChanges:V,triggerEdgeChanges:U,defaultEdgeOptions:Y,resetSelectedElements:Q}=w.getState();if(!_.current||!S)return;const{x:B,y:K}=dt(k.nativeEvent,_.current),{startX:ee,startY:J}=S;if(!L.current){const oe=t?0:o;if(Math.hypot(B-ee,K-J)<=oe)return;Q(),s==null||s(k)}L.current=!0;const q={startX:ee,startY:J,x:Boe.id)),P.current=new Set;const ue=(Y==null?void 0:Y.selectable)??!0;for(const oe of N.current){const Pe=W.get(oe);if(Pe)for(const{edgeId:Vt}of Pe.values()){const Nt=O.get(Vt);Nt&&(Nt.selectable??ue)&&P.current.add(Vt)}}if(!Xf(Z,N.current)){const oe=nr(F,N.current,!0);V(oe)}if(!Xf(ie,P.current)){const oe=nr(O,P.current);U(oe)}w.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},I=k=>{var S,T;k.button===0&&((T=(S=k.target)==null?void 0:S.releasePointerCapture)==null||T.call(S,k.pointerId),!x&&k.target===E.current&&w.getState().userSelectionRect&&(j==null||j(k)),w.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(k),w.setState({nodesSelectionActive:N.current.size>0})))},D=r===!0||Array.isArray(r)&&r.includes(0);return M.jsxs("div",{className:xe(["react-flow__pane",{draggable:D,dragging:g,selection:e}]),onClick:v?void 0:Fl(j,E),onContextMenu:Fl(z,E),onWheel:Fl(R,E),onPointerEnter:v?void 0:c,onPointerMove:v?A:f,onPointerUp:v?I:void 0,onPointerDownCapture:v?C:void 0,onClickCapture:v?H:void 0,onPointerLeave:m,ref:E,style:qs,children:[y,M.jsx(h2,{})]})}function Qu({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:l,onError:u}=t.getState(),a=l.get(e);if(!a){u==null||u("012",kt.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function ym({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const l=he(),[u,a]=$.useState(!1),d=$.useRef();return $.useEffect(()=>{d.current=bE({getStoreItems:()=>l.getState(),onNodeMouseDown:c=>{Qu({id:c,store:l,nodeRef:e})},onDragStart:()=>{a(!0)},onDragStop:()=>{a(!1)}})},[]),$.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var c;(c=d.current)==null||c.destroy()}},[n,r,t,i,e,o,s]),u}const m2=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function vm(){const e=he();return $.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:l,updateNodePositions:u,nodeLookup:a,nodeOrigin:d}=e.getState(),c=new Map,f=m2(s),m=o?i[0]:5,y=o?i[1]:5,w=n.direction.x*m*n.factor,x=n.direction.y*y*n.factor;for(const[,h]of a){if(!f(h))continue;let g={x:h.internals.positionAbsolute.x+w,y:h.internals.positionAbsolute.y+x};o&&(g=Wo(g,i));const{position:p,positionAbsolute:v}=Ag({nodeId:h.id,nextPosition:g,nodeLookup:a,nodeExtent:r,nodeOrigin:d,onError:l});h.position=p,h.internals.positionAbsolute=v,c.set(h.id,h)}u(c)},[])}const ic=$.createContext(null),y2=ic.Provider;ic.Consumer;const wm=()=>$.useContext(ic),v2=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),w2=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:l,toHandle:u,isValid:a}=s,d=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===xr.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!o,valid:d&&a}};function x2({type:e="source",position:t=G.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:a,onMouseDown:d,onTouchStart:c,...f},m){var A,I;const y=s||null,w=e==="target",x=he(),h=wm(),{connectOnClick:g,noPanClassName:p,rfId:v}=ne(v2,de),{connectingFrom:E,connectingTo:_,clickConnecting:N,isPossibleEndHandle:P,connectionInProcess:L,clickConnectionInProcess:j,valid:z}=ne(w2(h,y,e),de);h||(I=(A=x.getState()).onError)==null||I.call(A,"010",kt.error010());const R=D=>{const{defaultEdgeOptions:k,onConnect:S,hasDefaultEdges:T}=x.getState(),F={...k,...D};if(T){const{edges:O,setEdges:W}=x.getState();W(NE(F,O))}S==null||S(F),l==null||l(F)},H=D=>{if(!h)return;const k=Vg(D.nativeEvent);if(o&&(k&&D.button===0||!k)){const S=x.getState();Xu.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:S.autoPanOnConnect,connectionMode:S.connectionMode,connectionRadius:S.connectionRadius,domNode:S.domNode,nodeLookup:S.nodeLookup,lib:S.lib,isTarget:w,handleId:y,nodeId:h,flowId:S.rfId,panBy:S.panBy,cancelConnection:S.cancelConnection,onConnectStart:S.onConnectStart,onConnectEnd:(...T)=>{var F,O;return(O=(F=x.getState()).onConnectEnd)==null?void 0:O.call(F,...T)},updateConnection:S.updateConnection,onConnect:R,isValidConnection:n||((...T)=>{var F,O;return((O=(F=x.getState()).isValidConnection)==null?void 0:O.call(F,...T))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:S.autoPanSpeed,dragThreshold:S.connectionDragThreshold})}k?d==null||d(D):c==null||c(D)},C=D=>{const{onClickConnectStart:k,onClickConnectEnd:S,connectionClickStartHandle:T,connectionMode:F,isValidConnection:O,lib:W,rfId:V,nodeLookup:U,connection:Y}=x.getState();if(!h||!T&&!o)return;if(!T){k==null||k(D.nativeEvent,{nodeId:h,handleId:y,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:h,type:e,id:y}});return}const Q=jg(D.target),B=n||O,{connection:K,isValid:ee}=Xu.isValid(D.nativeEvent,{handle:{nodeId:h,id:y,type:e},connectionMode:F,fromNodeId:T.nodeId,fromHandleId:T.id||null,fromType:T.type,isValidConnection:B,flowId:V,doc:Q,lib:W,nodeLookup:U});ee&&K&&R(K);const J=structuredClone(Y);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,S==null||S(D,J),x.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":y,"data-nodeid":h,"data-handlepos":t,"data-id":`${v}-${h}-${y}-${e}`,className:xe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,a,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:N,connectingfrom:E,connectingto:_,valid:z,connectionindicator:r&&(!L||P)&&(L||j?i:o)}]),onMouseDown:H,onTouchStart:H,onClick:g?C:void 0,ref:m,...f,children:u})}const Mr=$.memo(gm(x2));function S2({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return M.jsxs(M.Fragment,{children:[e==null?void 0:e.label,M.jsx(Mr,{type:"source",position:n,isConnectable:t})]})}function E2({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(Mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,M.jsx(Mr,{type:"source",position:r,isConnectable:t})]})}function _2(){return null}function k2({data:e,isConnectable:t,targetPosition:n=G.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(Mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const xs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wd={input:S2,default:E2,output:k2,group:_2};function C2(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const N2=e=>{const{width:t,height:n,x:r,y:o}=Bo(e.nodeLookup,{filter:i=>!!i.selected});return{width:ft(t)?t:null,height:ft(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function M2({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=he(),{width:o,height:i,transformString:s,userSelectionActive:l}=ne(N2,de),u=vm(),a=$.useRef(null);$.useEffect(()=>{var m;n||(m=a.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&o!==null&&i!==null;if(ym({nodeRef:a,disabled:!d}),!d)return null;const c=e?m=>{const y=r.getState().nodes.filter(w=>w.selected);e(m,y)}:void 0,f=m=>{Object.prototype.hasOwnProperty.call(xs,m.key)&&(m.preventDefault(),u({direction:xs[m.key],factor:m.shiftKey?4:1}))};return M.jsx("div",{className:xe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:M.jsx("div",{ref:a,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:i}})})}const xd=typeof window<"u"?window:void 0,P2=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function xm({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:a,selectionOnDrag:d,selectionMode:c,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:h,zoomOnScroll:g,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:N,panOnDrag:P,defaultViewport:L,translateExtent:j,minZoom:z,maxZoom:R,preventScrolling:H,onSelectionContextMenu:C,noWheelClassName:A,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:k,isControlledViewport:S}){const{nodesSelectionActive:T,userSelectionActive:F}=ne(P2,de),O=Ro(a,{target:xd}),W=Ro(w,{target:xd}),V=W||P,U=W||v,Y=d&&V!==!0,Q=O||F||Y;return u2({deleteKeyCode:u,multiSelectionKeyCode:y}),M.jsx(f2,{onPaneContextMenu:i,elementsSelectable:h,zoomOnScroll:g,zoomOnPinch:p,panOnScroll:U,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:N,panOnDrag:!O&&V,defaultViewport:L,translateExtent:j,minZoom:z,maxZoom:R,zoomActivationKeyCode:x,preventScrolling:H,noWheelClassName:A,noPanClassName:I,onViewportChange:k,isControlledViewport:S,paneClickDistance:l,selectionOnDrag:Y,children:M.jsxs(g2,{onSelectionStart:f,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:V,isSelecting:!!Q,selectionMode:c,selectionKeyPressed:O,paneClickDistance:l,selectionOnDrag:Y,children:[e,T&&M.jsx(M2,{onSelectionContextMenu:C,noPanClassName:I,disableKeyboardA11y:D})]})})}xm.displayName="FlowRenderer";const T2=$.memo(xm),I2=e=>t=>e?qa(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function z2(e){return ne($.useCallback(I2(e),[e]),de)}const L2=e=>e.updateNodeInternals;function A2(){const e=ne(L2),[t]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return $.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function R2({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=he(),i=$.useRef(null),s=$.useRef(null),l=$.useRef(e.sourcePosition),u=$.useRef(e.targetPosition),a=$.useRef(t),d=n&&!!e.internals.handleBounds;return $.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[d,e.hidden]),$.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),$.useEffect(()=>{if(i.current){const c=a.current!==t,f=l.current!==e.sourcePosition,m=u.current!==e.targetPosition;(c||f||m)&&(a.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function $2({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:a,nodesFocusable:d,resizeObserver:c,noDragClassName:f,noPanClassName:m,disableKeyboardA11y:y,rfId:w,nodeTypes:x,nodeClickDistance:h,onError:g}){const{node:p,internals:v,isParent:E}=ne(B=>{const K=B.nodeLookup.get(e),ee=B.parentLookup.has(e);return{node:K,internals:K.internals,isParent:ee}},de);let _=p.type||"default",N=(x==null?void 0:x[_])||wd[_];N===void 0&&(g==null||g("003",kt.error003(_)),_="default",N=(x==null?void 0:x.default)||wd.default);const P=!!(p.draggable||l&&typeof p.draggable>"u"),L=!!(p.selectable||u&&typeof p.selectable>"u"),j=!!(p.connectable||a&&typeof p.connectable>"u"),z=!!(p.focusable||d&&typeof p.focusable>"u"),R=he(),H=Og(p),C=R2({node:p,nodeType:_,hasDimensions:H,resizeObserver:c}),A=ym({nodeRef:C,disabled:p.hidden||!P,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:h}),I=vm();if(p.hidden)return null;const D=Ht(p),k=C2(p),S=L||P||t||n||r||o,T=n?B=>n(B,{...v.userNode}):void 0,F=r?B=>r(B,{...v.userNode}):void 0,O=o?B=>o(B,{...v.userNode}):void 0,W=i?B=>i(B,{...v.userNode}):void 0,V=s?B=>s(B,{...v.userNode}):void 0,U=B=>{const{selectNodesOnDrag:K,nodeDragThreshold:ee}=R.getState();L&&(!K||!P||ee>0)&&Qu({id:e,store:R,nodeRef:C}),t&&t(B,{...v.userNode})},Y=B=>{if(!(Hg(B.nativeEvent)||y)){if(Mg.includes(B.key)&&L){const K=B.key==="Escape";Qu({id:e,store:R,unselect:K,nodeRef:C})}else if(P&&p.selected&&Object.prototype.hasOwnProperty.call(xs,B.key)){B.preventDefault();const{ariaLabelConfig:K}=R.getState();R.setState({ariaLiveMessage:K["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),I({direction:xs[B.key],factor:B.shiftKey?4:1})}}},Q=()=>{var ie;if(y||!((ie=C.current)!=null&&ie.matches(":focus-visible")))return;const{transform:B,width:K,height:ee,autoPanOnNodeFocus:J,setCenter:q}=R.getState();if(!J)return;qa(new Map([[e,p]]),{x:0,y:0,width:K,height:ee},B,!0).length>0||q(p.position.x+D.width/2,p.position.y+D.height/2,{zoom:B[2]})};return M.jsx("div",{className:xe(["react-flow__node",`react-flow__node-${_}`,{[m]:P},p.className,{selected:p.selected,selectable:L,parent:E,draggable:P,dragging:A}]),ref:C,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:S?"all":"none",visibility:H?"visible":"hidden",...p.style,...k},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:F,onMouseLeave:O,onContextMenu:W,onClick:U,onDoubleClick:V,onKeyDown:z?Y:void 0,tabIndex:z?0:void 0,onFocus:z?Q:void 0,role:p.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${am}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:M.jsx(y2,{value:e,children:M.jsx(N,{id:e,data:p.data,type:_,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:p.selected??!1,selectable:L,draggable:P,deletable:p.deletable??!0,isConnectable:j,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:A,dragHandle:p.dragHandle,zIndex:v.z,parentId:p.parentId,...D})})})}var D2=$.memo($2);const O2=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Sm(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=ne(O2,de),s=z2(e.onlyRenderVisibleElements),l=A2();return M.jsx("div",{className:"react-flow__nodes",style:qs,children:s.map(u=>M.jsx(D2,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},u))})}Sm.displayName="NodeRenderer";const F2=$.memo(Sm);function j2(e){return ne($.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&_E({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),de)}const H2=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},V2=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Sd={[Sr.Arrow]:H2,[Sr.ArrowClosed]:V2};function b2(e){const t=he();return $.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(Sd,e)?Sd[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",kt.error009(e)),null)},[e])}const B2=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const u=b2(t);return u?M.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:M.jsx(u,{color:n,strokeWidth:s})}):null},Em=({defaultColor:e,rfId:t})=>{const n=ne(i=>i.edges),r=ne(i=>i.defaultEdgeOptions),o=$.useMemo(()=>zE(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:o.map(i=>M.jsx(B2,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Em.displayName="MarkerDefinitions";var W2=$.memo(Em);function _m({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:a,...d}){const[c,f]=$.useState({x:1,y:0,width:0,height:0}),m=xe(["react-flow__edge-textwrapper",a]),y=$.useRef(null);return $.useEffect(()=>{if(y.current){const w=y.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?M.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:m,visibility:c.width?"visible":"hidden",...d,children:[o&&M.jsx("rect",{width:c.width+2*s[0],x:-s[0],y:-s[1],height:c.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),M.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:y,style:r,children:n}),u]}):null}_m.displayName="EdgeText";const U2=$.memo(_m);function Js({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:a=20,...d}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...d,d:e,fill:"none",className:xe(["react-flow__edge-path",d.className])}),a?M.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:a,className:"react-flow__edge-interaction"}):null,r&&ft(t)&&ft(n)?M.jsx(U2,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function Ed({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===G.Left||e===G.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function km({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top}){const[s,l]=Ed({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,a]=Ed({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,c,f,m]=bg({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:a});return[`M${e},${t} C${s},${l} ${u},${a} ${r},${o}`,d,c,f,m]}function Cm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:l,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:h})=>{const[g,p,v]=km({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return M.jsx(Js,{id:E,path:g,labelX:p,labelY:v,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:h})})}const Y2=Cm({isInternal:!1}),Nm=Cm({isInternal:!0});Y2.displayName="SimpleBezierEdge";Nm.displayName="SimpleBezierEdgeInternal";function Mm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,sourcePosition:m=G.Bottom,targetPosition:y=G.Top,markerEnd:w,markerStart:x,pathOptions:h,interactionWidth:g})=>{const[p,v,E]=Wu({sourceX:n,sourceY:r,sourcePosition:m,targetX:o,targetY:i,targetPosition:y,borderRadius:h==null?void 0:h.borderRadius,offset:h==null?void 0:h.offset,stepPosition:h==null?void 0:h.stepPosition}),_=e.isInternal?void 0:t;return M.jsx(Js,{id:_,path:p,labelX:v,labelY:E,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:w,markerStart:x,interactionWidth:g})})}const Pm=Mm({isInternal:!1}),Tm=Mm({isInternal:!0});Pm.displayName="SmoothStepEdge";Tm.displayName="SmoothStepEdgeInternal";function Im(e){return $.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return M.jsx(Pm,{...n,id:r,pathOptions:$.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const X2=Im({isInternal:!1}),zm=Im({isInternal:!0});X2.displayName="StepEdge";zm.displayName="StepEdgeInternal";function Lm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:w})=>{const[x,h,g]=Ug({sourceX:n,sourceY:r,targetX:o,targetY:i}),p=e.isInternal?void 0:t;return M.jsx(Js,{id:p,path:x,labelX:h,labelY:g,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:m,markerStart:y,interactionWidth:w})})}const Q2=Lm({isInternal:!1}),Am=Lm({isInternal:!0});Q2.displayName="StraightEdge";Am.displayName="StraightEdgeInternal";function Rm(e){return $.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=G.Bottom,targetPosition:l=G.Top,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,pathOptions:h,interactionWidth:g})=>{const[p,v,E]=Bg({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l,curvature:h==null?void 0:h.curvature}),_=e.isInternal?void 0:t;return M.jsx(Js,{id:_,path:p,labelX:v,labelY:E,label:u,labelStyle:a,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:x,interactionWidth:g})})}const G2=Rm({isInternal:!1}),$m=Rm({isInternal:!0});G2.displayName="BezierEdge";$m.displayName="BezierEdgeInternal";const _d={default:$m,straight:Am,step:zm,smoothstep:Tm,simplebezier:Nm},kd={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},K2=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,Z2=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Cd="react-flow__edgeupdater";function Nd({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:l}){return M.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:xe([Cd,`${Cd}-${l}`]),cx:K2(t,r,e),cy:Z2(n,r,e),r,stroke:"transparent",fill:"transparent"})}function q2({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:l,targetPosition:u,onReconnect:a,onReconnectStart:d,onReconnectEnd:c,setReconnecting:f,setUpdateHover:m}){const y=he(),w=(v,E)=>{if(v.button!==0)return;const{autoPanOnConnect:_,domNode:N,connectionMode:P,connectionRadius:L,lib:j,onConnectStart:z,cancelConnection:R,nodeLookup:H,rfId:C,panBy:A,updateConnection:I}=y.getState(),D=E.type==="target",k=(F,O)=>{f(!1),c==null||c(F,n,E.type,O)},S=F=>a==null?void 0:a(n,F),T=(F,O)=>{f(!0),d==null||d(v,n,E.type),z==null||z(F,O)};Xu.onPointerDown(v.nativeEvent,{autoPanOnConnect:_,connectionMode:P,connectionRadius:L,domNode:N,handleId:E.id,nodeId:E.nodeId,nodeLookup:H,isTarget:D,edgeUpdaterType:E.type,lib:j,flowId:C,cancelConnection:R,panBy:A,isValidConnection:(...F)=>{var O,W;return((W=(O=y.getState()).isValidConnection)==null?void 0:W.call(O,...F))??!0},onConnect:S,onConnectStart:T,onConnectEnd:(...F)=>{var O,W;return(W=(O=y.getState()).onConnectEnd)==null?void 0:W.call(O,...F)},onReconnectEnd:k,updateConnection:I,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},x=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),h=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),g=()=>m(!0),p=()=>m(!1);return M.jsxs(M.Fragment,{children:[(e===!0||e==="source")&&M.jsx(Nd,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:g,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&M.jsx(Nd,{position:u,centerX:i,centerY:s,radius:t,onMouseDown:h,onMouseEnter:g,onMouseOut:p,type:"target"})]})}function J2({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,rfId:y,edgeTypes:w,noPanClassName:x,onError:h,disableKeyboardA11y:g}){let p=ne(q=>q.edgeLookup.get(e));const v=ne(q=>q.defaultEdgeOptions);p=v?{...v,...p}:p;let E=p.type||"default",_=(w==null?void 0:w[E])||_d[E];_===void 0&&(h==null||h("011",kt.error011(E)),E="default",_=(w==null?void 0:w.default)||_d.default);const N=!!(p.focusable||t&&typeof p.focusable>"u"),P=typeof c<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),L=!!(p.selectable||r&&typeof p.selectable>"u"),j=$.useRef(null),[z,R]=$.useState(!1),[H,C]=$.useState(!1),A=he(),{zIndex:I,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:F,targetPosition:O}=ne($.useCallback(q=>{const Z=q.nodeLookup.get(p.source),ie=q.nodeLookup.get(p.target);if(!Z||!ie)return{zIndex:p.zIndex,...kd};const ue=IE({id:e,sourceNode:Z,targetNode:ie,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:q.connectionMode,onError:h});return{zIndex:EE({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:ie,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ue||kd}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),de),W=$.useMemo(()=>p.markerStart?`url('#${Uu(p.markerStart,y)}')`:void 0,[p.markerStart,y]),V=$.useMemo(()=>p.markerEnd?`url('#${Uu(p.markerEnd,y)}')`:void 0,[p.markerEnd,y]);if(p.hidden||D===null||k===null||S===null||T===null)return null;const U=q=>{var oe;const{addSelectedEdges:Z,unselectNodesAndEdges:ie,multiSelectionActive:ue}=A.getState();L&&(A.setState({nodesSelectionActive:!1}),p.selected&&ue?(ie({nodes:[],edges:[p]}),(oe=j.current)==null||oe.blur()):Z([e])),o&&o(q,p)},Y=i?q=>{i(q,{...p})}:void 0,Q=s?q=>{s(q,{...p})}:void 0,B=l?q=>{l(q,{...p})}:void 0,K=u?q=>{u(q,{...p})}:void 0,ee=a?q=>{a(q,{...p})}:void 0,J=q=>{var Z;if(!g&&Mg.includes(q.key)&&L){const{unselectNodesAndEdges:ie,addSelectedEdges:ue}=A.getState();q.key==="Escape"?((Z=j.current)==null||Z.blur(),ie({edges:[p]})):ue([e])}};return M.jsx("svg",{style:{zIndex:I},children:M.jsxs("g",{className:xe(["react-flow__edge",`react-flow__edge-${E}`,p.className,x,{selected:p.selected,animated:p.animated,inactive:!L&&!o,updating:z,selectable:L}]),onClick:U,onDoubleClick:Y,onContextMenu:Q,onMouseEnter:B,onMouseMove:K,onMouseLeave:ee,onKeyDown:N?J:void 0,tabIndex:N?0:void 0,role:p.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":N?`${cm}-${y}`:void 0,ref:j,...p.domAttributes,children:[!H&&M.jsx(_,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:L,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:F,targetPosition:O,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:W,markerEnd:V,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),P&&M.jsx(q2,{edge:p,isReconnectable:P,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:m,sourceX:D,sourceY:k,targetX:S,targetY:T,sourcePosition:F,targetPosition:O,setUpdateHover:R,setReconnecting:C})]})})}var ek=$.memo(J2);const tk=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Dm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:a,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:h,elementsSelectable:g,onError:p}=ne(tk,de),v=j2(t);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(W2,{defaultColor:e,rfId:n}),v.map(E=>M.jsx(ek,{id:E,edgesFocusable:x,edgesReconnectable:h,elementsSelectable:g,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,onClick:d,reconnectRadius:c,onDoubleClick:f,onReconnectStart:m,onReconnectEnd:y,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:w},E))]})}Dm.displayName="EdgeRenderer";const nk=$.memo(Dm),rk=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ok({children:e}){const t=ne(rk);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function ik(e){const t=Yo(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const sk=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function lk(e){const t=ne(sk),n=he();return $.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function uk(e){return e.connection.inProgress?{...e.connection,to:Uo(e.connection.to,e.transform)}:{...e.connection}}function ak(e){return uk}function ck(e){const t=ak();return ne(t,de)}const fk=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function dk({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:l,inProgress:u}=ne(fk,de);return!(i&&o&&u)?null:M.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:xe(["react-flow__connection",Ig(l)]),children:M.jsx(Om,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Om=({style:e,type:t=Gt.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:l,fromPosition:u,to:a,toNode:d,toHandle:c,toPosition:f,pointer:m}=ck();if(!o)return;if(n)return M.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:l,fromX:i.x,fromY:i.y,toX:a.x,toY:a.y,fromPosition:u,toPosition:f,connectionStatus:Ig(r),toNode:d,toHandle:c,pointer:m});let y="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:a.x,targetY:a.y,targetPosition:f};switch(t){case Gt.Bezier:[y]=Bg(w);break;case Gt.SimpleBezier:[y]=km(w);break;case Gt.Step:[y]=Wu({...w,borderRadius:0});break;case Gt.SmoothStep:[y]=Wu(w);break;default:[y]=Ug(w)}return M.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};Om.displayName="ConnectionLine";const hk={};function Md(e=hk){$.useRef(e),he(),$.useEffect(()=>{},[e])}function pk(){he(),$.useRef(!1),$.useEffect(()=>{},[])}function Fm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:f,onSelectionEnd:m,connectionLineType:y,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:h,selectionKeyCode:g,selectionOnDrag:p,selectionMode:v,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:N,deleteKeyCode:P,onlyRenderVisibleElements:L,elementsSelectable:j,defaultViewport:z,translateExtent:R,minZoom:H,maxZoom:C,preventScrolling:A,defaultMarkerColor:I,zoomOnScroll:D,zoomOnPinch:k,panOnScroll:S,panOnScrollSpeed:T,panOnScrollMode:F,zoomOnDoubleClick:O,panOnDrag:W,onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:Y,onPaneMouseLeave:Q,onPaneScroll:B,onPaneContextMenu:K,paneClickDistance:ee,nodeClickDistance:J,onEdgeContextMenu:q,onEdgeMouseEnter:Z,onEdgeMouseMove:ie,onEdgeMouseLeave:ue,reconnectRadius:oe,onReconnect:Pe,onReconnectStart:Vt,onReconnectEnd:Nt,noDragClassName:pn,noWheelClassName:zr,noPanClassName:Lr,disableKeyboardA11y:Ar,nodeExtent:tl,rfId:Xo,viewport:On,onViewportChange:Rr}){return Md(e),Md(t),pk(),ik(n),lk(On),M.jsx(T2,{onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:Y,onPaneMouseLeave:Q,onPaneContextMenu:K,onPaneScroll:B,paneClickDistance:ee,deleteKeyCode:P,selectionKeyCode:g,selectionOnDrag:p,selectionMode:v,onSelectionStart:f,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:N,elementsSelectable:j,zoomOnScroll:D,zoomOnPinch:k,zoomOnDoubleClick:O,panOnScroll:S,panOnScrollSpeed:T,panOnScrollMode:F,panOnDrag:W,defaultViewport:z,translateExtent:R,minZoom:H,maxZoom:C,onSelectionContextMenu:c,preventScrolling:A,noDragClassName:pn,noWheelClassName:zr,noPanClassName:Lr,disableKeyboardA11y:Ar,onViewportChange:Rr,isControlledViewport:!!On,children:M.jsxs(ok,{children:[M.jsx(nk,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:Pe,onReconnectStart:Vt,onReconnectEnd:Nt,onlyRenderVisibleElements:L,onEdgeContextMenu:q,onEdgeMouseEnter:Z,onEdgeMouseMove:ie,onEdgeMouseLeave:ue,reconnectRadius:oe,defaultMarkerColor:I,noPanClassName:Lr,disableKeyboardA11y:Ar,rfId:Xo}),M.jsx(dk,{style:w,type:y,component:x,containerStyle:h}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(F2,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:d,nodeClickDistance:J,onlyRenderVisibleElements:L,noPanClassName:Lr,noDragClassName:pn,disableKeyboardA11y:Ar,nodeExtent:tl,rfId:Xo}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Fm.displayName="GraphView";const gk=$.memo(Fm),Pd=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u=.5,maxZoom:a=2,nodeOrigin:d,nodeExtent:c,zIndexMode:f="basic"}={})=>{const m=new Map,y=new Map,w=new Map,x=new Map,h=r??t??[],g=n??e??[],p=d??[0,0],v=c??Io;Qg(w,x,h);const E=Yu(g,m,y,{nodeOrigin:p,nodeExtent:v,zIndexMode:f});let _=[0,0,1];if(s&&o&&i){const N=Bo(m,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:P,y:L,zoom:j}=Xs(N,o,i,u,a,(l==null?void 0:l.padding)??.1);_=[P,L,j]}return{rfId:"1",width:o??0,height:i??0,transform:_,nodes:g,nodesInitialized:E,nodeLookup:m,parentLookup:y,edges:h,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:a,translateExtent:Io,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:xr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:l,fitViewResolver:null,connection:{...Tg},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mE,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Pg,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},mk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:d,nodeExtent:c,zIndexMode:f})=>R_((m,y)=>{async function w(){const{nodeLookup:x,panZoom:h,fitViewOptions:g,fitViewResolver:p,width:v,height:E,minZoom:_,maxZoom:N}=y();h&&(await pE({nodes:x,width:v,height:E,panZoom:h,minZoom:_,maxZoom:N},g),p==null||p.resolve(!0),m({fitViewResolver:null}))}return{...Pd({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:x=>{const{nodeLookup:h,parentLookup:g,nodeOrigin:p,elevateNodesOnSelect:v,fitViewQueued:E,zIndexMode:_}=y(),N=Yu(x,h,g,{nodeOrigin:p,nodeExtent:c,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:_});E&&N?(w(),m({nodes:x,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):m({nodes:x,nodesInitialized:N})},setEdges:x=>{const{connectionLookup:h,edgeLookup:g}=y();Qg(h,g,x),m({edges:x})},setDefaultNodesAndEdges:(x,h)=>{if(x){const{setNodes:g}=y();g(x),m({hasDefaultNodes:!0})}if(h){const{setEdges:g}=y();g(h),m({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:h,nodeLookup:g,parentLookup:p,domNode:v,nodeOrigin:E,nodeExtent:_,debug:N,fitViewQueued:P,zIndexMode:L}=y(),{changes:j,updatedInternals:z}=FE(x,g,p,v,E,_,L);z&&(RE(g,p,{nodeOrigin:E,nodeExtent:_,zIndexMode:L}),P?(w(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(j==null?void 0:j.length)>0&&(N&&console.log("React Flow: trigger node changes",j),h==null||h(j)))},updateNodePositions:(x,h=!1)=>{const g=[];let p=[];const{nodeLookup:v,triggerNodeChanges:E,connection:_,updateConnection:N,onNodesChangeMiddlewareMap:P}=y();for(const[L,j]of x){const z=v.get(L),R=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(j!=null&&j.position)),H={id:L,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:h};if(z&&_.inProgress&&_.fromNode.id===z.id){const C=Rn(z,_.fromHandle,G.Left,!0);N({..._,from:C})}R&&z.parentId&&g.push({id:L,parentId:z.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),p.push(H)}if(g.length>0){const{parentLookup:L,nodeOrigin:j}=y(),z=oc(g,v,L,j);p.push(...z)}for(const L of P.values())p=L(p);E(p)},triggerNodeChanges:x=>{const{onNodesChange:h,setNodes:g,nodes:p,hasDefaultNodes:v,debug:E}=y();if(x!=null&&x.length){if(v){const _=hm(x,p);g(_)}E&&console.log("React Flow: trigger node changes",x),h==null||h(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:h,setEdges:g,edges:p,hasDefaultEdges:v,debug:E}=y();if(x!=null&&x.length){if(v){const _=pm(x,p);g(_)}E&&console.log("React Flow: trigger edge changes",x),h==null||h(x)}},addSelectedNodes:x=>{const{multiSelectionActive:h,edgeLookup:g,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:E}=y();if(h){const _=x.map(N=>yn(N,!0));v(_);return}v(nr(p,new Set([...x]),!0)),E(nr(g))},addSelectedEdges:x=>{const{multiSelectionActive:h,edgeLookup:g,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:E}=y();if(h){const _=x.map(N=>yn(N,!0));E(_);return}E(nr(g,new Set([...x]))),v(nr(p,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:h}={})=>{const{edges:g,nodes:p,nodeLookup:v,triggerNodeChanges:E,triggerEdgeChanges:_}=y(),N=x||p,P=h||g,L=[];for(const z of N){if(!z.selected)continue;const R=v.get(z.id);R&&(R.selected=!1),L.push(yn(z.id,!1))}const j=[];for(const z of P)z.selected&&j.push(yn(z.id,!1));E(L),_(j)},setMinZoom:x=>{const{panZoom:h,maxZoom:g}=y();h==null||h.setScaleExtent([x,g]),m({minZoom:x})},setMaxZoom:x=>{const{panZoom:h,minZoom:g}=y();h==null||h.setScaleExtent([g,x]),m({maxZoom:x})},setTranslateExtent:x=>{var h;(h=y().panZoom)==null||h.setTranslateExtent(x),m({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:h,triggerNodeChanges:g,triggerEdgeChanges:p,elementsSelectable:v}=y();if(!v)return;const E=h.reduce((N,P)=>P.selected?[...N,yn(P.id,!1)]:N,[]),_=x.reduce((N,P)=>P.selected?[...N,yn(P.id,!1)]:N,[]);g(E),p(_)},setNodeExtent:x=>{const{nodes:h,nodeLookup:g,parentLookup:p,nodeOrigin:v,elevateNodesOnSelect:E,nodeExtent:_,zIndexMode:N}=y();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(Yu(h,g,p,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:N}),m({nodeExtent:x}))},panBy:x=>{const{transform:h,width:g,height:p,panZoom:v,translateExtent:E}=y();return jE({delta:x,panZoom:v,transform:h,translateExtent:E,width:g,height:p})},setCenter:async(x,h,g)=>{const{width:p,height:v,maxZoom:E,panZoom:_}=y();if(!_)return Promise.resolve(!1);const N=typeof(g==null?void 0:g.zoom)<"u"?g.zoom:E;return await _.setViewport({x:p/2-x*N,y:v/2-h*N,zoom:N},{duration:g==null?void 0:g.duration,ease:g==null?void 0:g.ease,interpolate:g==null?void 0:g.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...Tg}})},updateConnection:x=>{m({connection:x})},reset:()=>m({...Pd()})}},Object.is);function jm({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:u,fitView:a,nodeOrigin:d,nodeExtent:c,zIndexMode:f,children:m}){const[y]=$.useState(()=>mk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,minZoom:s,maxZoom:l,fitViewOptions:u,nodeOrigin:d,nodeExtent:c,zIndexMode:f}));return M.jsx($_,{value:y,children:M.jsx(o2,{children:m})})}function yk({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:a,maxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m}){return $.useContext(Ks)?M.jsx(M.Fragment,{children:e}):M.jsx(jm,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:u,initialMinZoom:a,initialMaxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:m,children:e})}const vk={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function wk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:a,onMove:d,onMoveStart:c,onMoveEnd:f,onConnect:m,onConnectStart:y,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:h,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:N,onNodeDrag:P,onNodeDragStop:L,onNodesDelete:j,onEdgesDelete:z,onDelete:R,onSelectionChange:H,onSelectionDragStart:C,onSelectionDrag:A,onSelectionDragStop:I,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:S,onBeforeDelete:T,connectionMode:F,connectionLineType:O=Gt.Bezier,connectionLineStyle:W,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:Y="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:B=!1,selectionMode:K=zo.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:J=Ao()?"Meta":"Control",zoomActivationKeyCode:q=Ao()?"Meta":"Control",snapToGrid:Z,snapGrid:ie,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:oe,nodesDraggable:Pe,autoPanOnNodeFocus:Vt,nodesConnectable:Nt,nodesFocusable:pn,nodeOrigin:zr=fm,edgesFocusable:Lr,edgesReconnectable:Ar,elementsSelectable:tl=!0,defaultViewport:Xo=Q_,minZoom:On=.5,maxZoom:Rr=2,translateExtent:ac=Io,preventScrolling:n0=!0,nodeExtent:nl,defaultMarkerColor:r0="#b1b1b7",zoomOnScroll:o0=!0,zoomOnPinch:i0=!0,panOnScroll:s0=!1,panOnScrollSpeed:l0=.5,panOnScrollMode:u0=Cn.Free,zoomOnDoubleClick:a0=!0,panOnDrag:c0=!0,onPaneClick:f0,onPaneMouseEnter:d0,onPaneMouseMove:h0,onPaneMouseLeave:p0,onPaneScroll:g0,onPaneContextMenu:m0,paneClickDistance:y0=1,nodeClickDistance:v0=0,children:w0,onReconnect:x0,onReconnectStart:S0,onReconnectEnd:E0,onEdgeContextMenu:_0,onEdgeDoubleClick:k0,onEdgeMouseEnter:C0,onEdgeMouseMove:N0,onEdgeMouseLeave:M0,reconnectRadius:P0=10,onNodesChange:T0,onEdgesChange:I0,noDragClassName:z0="nodrag",noWheelClassName:L0="nowheel",noPanClassName:cc="nopan",fitView:fc,fitViewOptions:dc,connectOnClick:A0,attributionPosition:R0,proOptions:$0,defaultEdgeOptions:D0,elevateNodesOnSelect:O0=!0,elevateEdgesOnSelect:F0=!1,disableKeyboardA11y:hc=!1,autoPanOnConnect:j0,autoPanOnNodeDrag:H0,autoPanSpeed:V0,connectionRadius:b0,isValidConnection:B0,onError:W0,style:U0,id:pc,nodeDragThreshold:Y0,connectionDragThreshold:X0,viewport:Q0,onViewportChange:G0,width:K0,height:Z0,colorMode:q0="light",debug:J0,onScroll:Qo,ariaLabelConfig:ey,zIndexMode:gc="basic",...ty},ny){const rl=pc||"1",ry=q_(q0),oy=$.useCallback(mc=>{mc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Qo==null||Qo(mc)},[Qo]);return M.jsx("div",{"data-testid":"rf__wrapper",...ty,onScroll:oy,style:{...U0,...vk},ref:ny,className:xe(["react-flow",o,ry]),id:pc,role:"application",children:M.jsxs(yk,{nodes:e,edges:t,width:K0,height:Z0,fitView:fc,fitViewOptions:dc,minZoom:On,maxZoom:Rr,nodeOrigin:zr,nodeExtent:nl,zIndexMode:gc,children:[M.jsx(gk,{onInit:a,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:g,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:O,connectionLineStyle:W,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:Q,selectionOnDrag:B,selectionMode:K,deleteKeyCode:Y,multiSelectionKeyCode:J,panActivationKeyCode:ee,zoomActivationKeyCode:q,onlyRenderVisibleElements:ue,defaultViewport:Xo,translateExtent:ac,minZoom:On,maxZoom:Rr,preventScrolling:n0,zoomOnScroll:o0,zoomOnPinch:i0,zoomOnDoubleClick:a0,panOnScroll:s0,panOnScrollSpeed:l0,panOnScrollMode:u0,panOnDrag:c0,onPaneClick:f0,onPaneMouseEnter:d0,onPaneMouseMove:h0,onPaneMouseLeave:p0,onPaneScroll:g0,onPaneContextMenu:m0,paneClickDistance:y0,nodeClickDistance:v0,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:S,onReconnect:x0,onReconnectStart:S0,onReconnectEnd:E0,onEdgeContextMenu:_0,onEdgeDoubleClick:k0,onEdgeMouseEnter:C0,onEdgeMouseMove:N0,onEdgeMouseLeave:M0,reconnectRadius:P0,defaultMarkerColor:r0,noDragClassName:z0,noWheelClassName:L0,noPanClassName:cc,rfId:rl,disableKeyboardA11y:hc,nodeExtent:nl,viewport:Q0,onViewportChange:G0}),M.jsx(Z_,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:y,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:h,nodesDraggable:Pe,autoPanOnNodeFocus:Vt,nodesConnectable:Nt,nodesFocusable:pn,edgesFocusable:Lr,edgesReconnectable:Ar,elementsSelectable:tl,elevateNodesOnSelect:O0,elevateEdgesOnSelect:F0,minZoom:On,maxZoom:Rr,nodeExtent:nl,onNodesChange:T0,onEdgesChange:I0,snapToGrid:Z,snapGrid:ie,connectionMode:F,translateExtent:ac,connectOnClick:A0,defaultEdgeOptions:D0,fitView:fc,fitViewOptions:dc,onNodesDelete:j,onEdgesDelete:z,onDelete:R,onNodeDragStart:N,onNodeDrag:P,onNodeDragStop:L,onSelectionDrag:A,onSelectionDragStart:C,onSelectionDragStop:I,onMove:d,onMoveStart:c,onMoveEnd:f,noPanClassName:cc,nodeOrigin:zr,rfId:rl,autoPanOnConnect:j0,autoPanOnNodeDrag:H0,autoPanSpeed:V0,onError:W0,connectionRadius:b0,isValidConnection:B0,selectNodesOnDrag:oe,nodeDragThreshold:Y0,connectionDragThreshold:X0,onBeforeDelete:T,debug:J0,ariaLabelConfig:ey,zIndexMode:gc}),M.jsx(X_,{onSelectionChange:H}),w0,M.jsx(b_,{proOptions:$0,position:R0}),M.jsx(V_,{rfId:rl,disableKeyboardA11y:hc})]})})}var xk=gm(wk);function Sk(e){const[t,n]=$.useState(e),r=$.useCallback(o=>n(i=>hm(o,i)),[]);return[t,n,r]}function Ek(e){const[t,n]=$.useState(e),r=$.useCallback(o=>n(i=>pm(o,i)),[]);return[t,n,r]}function _k({dimensions:e,lineWidth:t,variant:n,className:r}){return M.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:xe(["react-flow__background-pattern",n,r])})}function kk({radius:e,className:t}){return M.jsx("circle",{cx:e,cy:e,r:e,className:xe(["react-flow__background-pattern","dots",t])})}var ln;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ln||(ln={}));const Ck={[ln.Dots]:1,[ln.Lines]:1,[ln.Cross]:6},Nk=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Hm({id:e,variant:t=ln.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:l,style:u,className:a,patternClassName:d}){const c=$.useRef(null),{transform:f,patternId:m}=ne(Nk,de),y=r||Ck[t],w=t===ln.Dots,x=t===ln.Cross,h=Array.isArray(n)?n:[n,n],g=[h[0]*f[2]||1,h[1]*f[2]||1],p=y*f[2],v=Array.isArray(i)?i:[i,i],E=x?[p,p]:g,_=[v[0]*f[2]||1+E[0]/2,v[1]*f[2]||1+E[1]/2],N=`${m}${e||""}`;return M.jsxs("svg",{className:xe(["react-flow__background",a]),style:{...u,...qs,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:c,"data-testid":"rf__background",children:[M.jsx("pattern",{id:N,x:f[0]%g[0],y:f[1]%g[1],width:g[0],height:g[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:w?M.jsx(kk,{radius:p/2,className:d}):M.jsx(_k,{dimensions:E,lineWidth:o,variant:t,className:d})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Hm.displayName="Background";const Mk=$.memo(Hm);function Pk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Tk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Ik(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function zk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Lk(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function xi({children:e,className:t,...n}){return M.jsx("button",{type:"button",className:xe(["react-flow__controls-button",t]),...n,children:e})}const Ak=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Vm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:u,className:a,children:d,position:c="bottom-left",orientation:f="vertical","aria-label":m}){const y=he(),{isInteractive:w,minZoomReached:x,maxZoomReached:h,ariaLabelConfig:g}=ne(Ak,de),{zoomIn:p,zoomOut:v,fitView:E}=Yo(),_=()=>{p(),i==null||i()},N=()=>{v(),s==null||s()},P=()=>{E(o),l==null||l()},L=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},j=f==="horizontal"?"horizontal":"vertical";return M.jsxs(Zs,{className:xe(["react-flow__controls",j,a]),position:c,style:e,"data-testid":"rf__controls","aria-label":m??g["controls.ariaLabel"],children:[t&&M.jsxs(M.Fragment,{children:[M.jsx(xi,{onClick:_,className:"react-flow__controls-zoomin",title:g["controls.zoomIn.ariaLabel"],"aria-label":g["controls.zoomIn.ariaLabel"],disabled:h,children:M.jsx(Pk,{})}),M.jsx(xi,{onClick:N,className:"react-flow__controls-zoomout",title:g["controls.zoomOut.ariaLabel"],"aria-label":g["controls.zoomOut.ariaLabel"],disabled:x,children:M.jsx(Tk,{})})]}),n&&M.jsx(xi,{className:"react-flow__controls-fitview",onClick:P,title:g["controls.fitView.ariaLabel"],"aria-label":g["controls.fitView.ariaLabel"],children:M.jsx(Ik,{})}),r&&M.jsx(xi,{className:"react-flow__controls-interactive",onClick:L,title:g["controls.interactive.ariaLabel"],"aria-label":g["controls.interactive.ariaLabel"],children:w?M.jsx(Lk,{}):M.jsx(zk,{})}),d]})}Vm.displayName="Controls";const Rk=$.memo(Vm);function $k({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:l,strokeWidth:u,className:a,borderRadius:d,shapeRendering:c,selected:f,onClick:m}){const{background:y,backgroundColor:w}=i||{},x=s||y||w;return M.jsx("rect",{className:xe(["react-flow__minimap-node",{selected:f},a]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:x,stroke:l,strokeWidth:u},shapeRendering:c,onClick:m?h=>m(h,e):void 0})}const Dk=$.memo($k),Ok=e=>e.nodes.map(t=>t.id),jl=e=>e instanceof Function?e:()=>e;function Fk({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=Dk,onClick:s}){const l=ne(Ok,de),u=jl(t),a=jl(e),d=jl(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:l.map(f=>M.jsx(Hk,{id:f,nodeColorFunc:u,nodeStrokeColorFunc:a,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:c},f))})}function jk({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:l,onClick:u}){const{node:a,x:d,y:c,width:f,height:m}=ne(y=>{const w=y.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:h,y:g}=w.internals.positionAbsolute,{width:p,height:v}=Ht(x);return{node:x,x:h,y:g,width:p,height:v}},de);return!a||a.hidden||!Og(a)?null:M.jsx(l,{x:d,y:c,width:f,height:m,style:a.style,selected:!!a.selected,className:r(a),color:t(a),borderRadius:o,strokeColor:n(a),strokeWidth:i,shapeRendering:s,onClick:u,id:a.id})}const Hk=$.memo(jk);var Vk=$.memo(Fk);const bk=200,Bk=150,Wk=e=>!e.hidden,Uk=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Dg(Bo(e.nodeLookup,{filter:Wk}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Yk="react-flow__minimap-desc";function bm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:a,maskStrokeColor:d,maskStrokeWidth:c,position:f="bottom-right",onClick:m,onNodeClick:y,pannable:w=!1,zoomable:x=!1,ariaLabel:h,inversePan:g,zoomStep:p=1,offsetScale:v=5}){const E=he(),_=$.useRef(null),{boundingRect:N,viewBB:P,rfId:L,panZoom:j,translateExtent:z,flowWidth:R,flowHeight:H,ariaLabelConfig:C}=ne(Uk,de),A=(e==null?void 0:e.width)??bk,I=(e==null?void 0:e.height)??Bk,D=N.width/A,k=N.height/I,S=Math.max(D,k),T=S*A,F=S*I,O=v*S,W=N.x-(T-N.width)/2-O,V=N.y-(F-N.height)/2-O,U=T+O*2,Y=F+O*2,Q=`${Yk}-${L}`,B=$.useRef(0),K=$.useRef();B.current=S,$.useEffect(()=>{if(_.current&&j)return K.current=QE({domNode:_.current,panZoom:j,getTransform:()=>E.getState().transform,getViewScale:()=>B.current}),()=>{var Z;(Z=K.current)==null||Z.destroy()}},[j]),$.useEffect(()=>{var Z;(Z=K.current)==null||Z.update({translateExtent:z,width:R,height:H,inversePan:g,pannable:w,zoomStep:p,zoomable:x})},[w,x,g,p,z,R,H]);const ee=m?Z=>{var oe;const[ie,ue]=((oe=K.current)==null?void 0:oe.pointer(Z))||[0,0];m(Z,{x:ie,y:ue})}:void 0,J=y?$.useCallback((Z,ie)=>{const ue=E.getState().nodeLookup.get(ie).internals.userNode;y(Z,ue)},[]):void 0,q=h??C["minimap.ariaLabel"];return M.jsx(Zs,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*S:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:xe(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:A,height:I,viewBox:`${W} ${V} ${U} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:_,onClick:ee,children:[q&&M.jsx("title",{id:Q,children:q}),M.jsx(Vk,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:l}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-O},${V-O}h${U+O*2}v${Y+O*2}h${-U-O*2}z
+ M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}bm.displayName="MiniMap";const Xk=$.memo(bm),Qk=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Gk={[Cr.Line]:"right",[Cr.Handle]:"bottom-right"};function Kk({nodeId:e,position:t,variant:n=Cr.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:a=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:m=!0,shouldResize:y,onResizeStart:w,onResize:x,onResizeEnd:h}){const g=wm(),p=typeof e=="string"?e:g,v=he(),E=$.useRef(null),_=n===Cr.Handle,N=ne($.useCallback(Qk(_&&m),[_,m]),de),P=$.useRef(null),L=t??Gk[n];$.useEffect(()=>{if(!(!E.current||!p))return P.current||(P.current=u_({domNode:E.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:z,transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A,domNode:I}=v.getState();return{nodeLookup:z,transform:R,snapGrid:H,snapToGrid:C,nodeOrigin:A,paneDomNode:I}},onChange:(z,R)=>{const{triggerNodeChanges:H,nodeLookup:C,parentLookup:A,nodeOrigin:I}=v.getState(),D=[],k={x:z.x,y:z.y},S=C.get(p);if(S&&S.expandParent&&S.parentId){const T=S.origin??I,F=z.width??S.measured.width??0,O=z.height??S.measured.height??0,W={id:S.id,parentId:S.parentId,rect:{width:F,height:O,...Fg({x:z.x??S.position.x,y:z.y??S.position.y},{width:F,height:O},S.parentId,C,T)}},V=oc([W],C,A,I);D.push(...V),k.x=z.x?Math.max(T[0]*F,z.x):void 0,k.y=z.y?Math.max(T[1]*O,z.y):void 0}if(k.x!==void 0&&k.y!==void 0){const T={id:p,type:"position",position:{...k}};D.push(T)}if(z.width!==void 0&&z.height!==void 0){const F={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};D.push(F)}for(const T of R){const F={...T,type:"position"};D.push(F)}H(D)},onEnd:({width:z,height:R})=>{const H={id:p,type:"dimensions",resizing:!1,dimensions:{width:z,height:R}};v.getState().triggerNodeChanges([H])}})),P.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:u,maxWidth:a,maxHeight:d},keepAspectRatio:c,resizeDirection:f,onResizeStart:w,onResize:x,onResizeEnd:h,shouldResize:y}),()=>{var z;(z=P.current)==null||z.destroy()}},[L,l,u,a,d,c,w,x,h,y]);const j=L.split("-");return M.jsx("div",{className:xe(["react-flow__resize-control","nodrag",...j,n,r]),ref:E,style:{...o,scale:N,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}$.memo(Kk);function Zk(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}const qk=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function un(e){const t=[];for(let n=0,r=e.length;nWe||e.height>We)&&(e.width>We&&e.height>We?e.width>e.height?(e.height*=We/e.width,e.width=We):(e.width*=We/e.height,e.height=We):e.width>We?(e.height*=We/e.width,e.width=We):(e.width*=We/e.height,e.height=We))}function Es(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function rC(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function oC(e,t,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${t} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(e),rC(o)}const Be=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Be(n,t)};function iC(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function sC(e,t){return Bm(t).map(n=>{const r=e.getPropertyValue(n),o=e.getPropertyPriority(n);return`${n}: ${r}${o?" !important":""};`}).join(" ")}function lC(e,t,n,r){const o=`.${e}:${t}`,i=n.cssText?iC(n):sC(n,r);return document.createTextNode(`${o}{${i}}`)}function Td(e,t,n,r){const o=window.getComputedStyle(e,n),i=o.getPropertyValue("content");if(i===""||i==="none")return;const s=qk();try{t.className=`${t.className} ${s}`}catch{return}const l=document.createElement("style");l.appendChild(lC(s,n,o,r)),t.appendChild(l)}function uC(e,t,n){Td(e,t,":before",n),Td(e,t,":after",n)}const Id="application/font-woff",zd="image/jpeg",aC={woff:Id,woff2:Id,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:zd,jpeg:zd,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function cC(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function sc(e){const t=cC(e).toLowerCase();return aC[t]||""}function fC(e){return e.split(/,/)[1]}function Gu(e){return e.search(/^(data:)/)!==-1}function dC(e,t){return`data:${t};base64,${e}`}async function Um(e,t,n){const r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise((i,s)=>{const l=new FileReader;l.onerror=s,l.onloadend=()=>{try{i(n({res:r,result:l.result}))}catch(u){s(u)}},l.readAsDataURL(o)})}const Hl={};function hC(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function lc(e,t,n){const r=hC(e,t,n.includeQueryParams);if(Hl[r]!=null)return Hl[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let o;try{const i=await Um(e,n.fetchRequestInit,({res:s,result:l})=>(t||(t=s.headers.get("Content-Type")||""),fC(l)));o=dC(i,t)}catch(i){o=n.imagePlaceholder||"";let s=`Failed to fetch resource: ${e}`;i&&(s=typeof i=="string"?i:i.message),s&&console.warn(s)}return Hl[r]=o,o}async function pC(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Es(t)}async function gC(e,t){if(e.currentSrc){const i=document.createElement("canvas"),s=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,s==null||s.drawImage(e,0,0,i.width,i.height);const l=i.toDataURL();return Es(l)}const n=e.poster,r=sc(n),o=await lc(n,r,t);return Es(o)}async function mC(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await el(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function yC(e,t){return Be(e,HTMLCanvasElement)?pC(e):Be(e,HTMLVideoElement)?gC(e,t):Be(e,HTMLIFrameElement)?mC(e,t):e.cloneNode(Ym(e))}const vC=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Ym=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function wC(e,t,n){var r,o;if(Ym(t))return t;let i=[];return vC(e)&&e.assignedNodes?i=un(e.assignedNodes()):Be(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?i=un(e.contentDocument.body.childNodes):i=un(((o=e.shadowRoot)!==null&&o!==void 0?o:e).childNodes),i.length===0||Be(e,HTMLVideoElement)||await i.reduce((s,l)=>s.then(()=>el(l,n)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function xC(e,t,n){const r=t.style;if(!r)return;const o=window.getComputedStyle(e);o.cssText?(r.cssText=o.cssText,r.transformOrigin=o.transformOrigin):Bm(n).forEach(i=>{let s=o.getPropertyValue(i);i==="font-size"&&s.endsWith("px")&&(s=`${Math.floor(parseFloat(s.substring(0,s.length-2)))-.1}px`),Be(e,HTMLIFrameElement)&&i==="display"&&s==="inline"&&(s="block"),i==="d"&&t.getAttribute("d")&&(s=`path(${t.getAttribute("d")})`),r.setProperty(i,s,o.getPropertyPriority(i))})}function SC(e,t){Be(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Be(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function EC(e,t){if(Be(e,HTMLSelectElement)){const n=t,r=Array.from(n.children).find(o=>e.value===o.getAttribute("value"));r&&r.setAttribute("selected","")}}function _C(e,t,n){return Be(t,Element)&&(xC(e,t,n),uC(e,t,n),SC(e,t),EC(e,t)),t}async function kC(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const r={};for(let i=0;iyC(r,t)).then(r=>wC(e,r,t)).then(r=>_C(e,r,t)).then(r=>kC(r,t))}const Xm=/url\((['"]?)([^'"]+?)\1\)/g,CC=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,NC=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function MC(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function PC(e){const t=[];return e.replace(Xm,(n,r,o)=>(t.push(o),n)),t.filter(n=>!Gu(n))}async function TC(e,t,n,r,o){try{const i=n?Zk(t,n):t,s=sc(t);let l;return o||(l=await lc(i,s,r)),e.replace(MC(t),`$1${l}$3`)}catch{}return e}function IC(e,{preferredFontFormat:t}){return t?e.replace(NC,n=>{for(;;){const[r,,o]=CC.exec(n)||[];if(!o)return"";if(o===t)return`src: ${r};`}}):e}function Qm(e){return e.search(Xm)!==-1}async function Gm(e,t,n){if(!Qm(e))return e;const r=IC(e,n);return PC(r).reduce((i,s)=>i.then(l=>TC(l,s,t,n)),Promise.resolve(r))}async function Vn(e,t,n){var r;const o=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(o){const i=await Gm(o,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function zC(e,t){await Vn("background",e,t)||await Vn("background-image",e,t),await Vn("mask",e,t)||await Vn("-webkit-mask",e,t)||await Vn("mask-image",e,t)||await Vn("-webkit-mask-image",e,t)}async function LC(e,t){const n=Be(e,HTMLImageElement);if(!(n&&!Gu(e.src))&&!(Be(e,SVGImageElement)&&!Gu(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,o=await lc(r,sc(r),t);await new Promise((i,s)=>{e.onload=i,e.onerror=t.onImageErrorHandler?(...u)=>{try{i(t.onImageErrorHandler(...u))}catch(a){s(a)}}:s;const l=e;l.decode&&(l.decode=i),l.loading==="lazy"&&(l.loading="eager"),n?(e.srcset="",e.src=o):e.href.baseVal=o})}async function AC(e,t){const r=un(e.childNodes).map(o=>Km(o,t));await Promise.all(r).then(()=>e)}async function Km(e,t){Be(e,Element)&&(await zC(e,t),await LC(e,t),await AC(e,t))}function RC(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(o=>{n[o]=r[o]}),e}const Ld={};async function Ad(e){let t=Ld[e];if(t!=null)return t;const r=await(await fetch(e)).text();return t={url:e,cssText:r},Ld[e]=t,t}async function Rd(e,t){let n=e.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async s=>{let l=s.replace(r,"$1");return l.startsWith("https://")||(l=new URL(l,e.url).href),Um(l,t.fetchRequestInit,({result:u})=>(n=n.replace(s,`url(${u})`),[s,u]))});return Promise.all(i).then(()=>n)}function $d(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=e.replace(n,"");const o=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=o.exec(r);if(u===null)break;t.push(u[0])}r=r.replace(o,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,s="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(s,"gi");for(;;){let u=i.exec(r);if(u===null){if(u=l.exec(r),u===null)break;i.lastIndex=l.lastIndex}else l.lastIndex=i.lastIndex;t.push(u[0])}return t}async function $C(e,t){const n=[],r=[];return e.forEach(o=>{if("cssRules"in o)try{un(o.cssRules||[]).forEach((i,s)=>{if(i.type===CSSRule.IMPORT_RULE){let l=s+1;const u=i.href,a=Ad(u).then(d=>Rd(d,t)).then(d=>$d(d).forEach(c=>{try{o.insertRule(c,c.startsWith("@import")?l+=1:o.cssRules.length)}catch(f){console.error("Error inserting rule from remote css",{rule:c,error:f})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(a)}})}catch(i){const s=e.find(l=>l.href==null)||document.styleSheets[0];o.href!=null&&r.push(Ad(o.href).then(l=>Rd(l,t)).then(l=>$d(l).forEach(u=>{s.insertRule(u,s.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",i)}}),Promise.all(r).then(()=>(e.forEach(o=>{if("cssRules"in o)try{un(o.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${o.href}`,i)}}),n))}function DC(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Qm(t.style.getPropertyValue("src")))}async function OC(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=un(e.ownerDocument.styleSheets),r=await $C(n,t);return DC(r)}function Zm(e){return e.trim().replace(/["']/g,"")}function FC(e){const t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{t.add(Zm(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(e),t}async function jC(e,t){const n=await OC(e,t),r=FC(e);return(await Promise.all(n.filter(i=>r.has(Zm(i.style.fontFamily))).map(i=>{const s=i.parentStyleSheet?i.parentStyleSheet.href:null;return Gm(i.cssText,s,t)}))).join(`
+`)}async function HC(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await jC(e,t);if(n){const r=document.createElement("style"),o=document.createTextNode(n);r.appendChild(o),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function VC(e,t={}){const{width:n,height:r}=Wm(e,t),o=await el(e,t,!0);return await HC(o,t),await Km(o,t),RC(o,t),await oC(o,n,r)}async function bC(e,t={}){const{width:n,height:r}=Wm(e,t),o=await VC(e,t),i=await Es(o),s=document.createElement("canvas"),l=s.getContext("2d"),u=t.pixelRatio||tC(),a=t.canvasWidth||n,d=t.canvasHeight||r;return s.width=a*u,s.height=d*u,t.skipAutoScale||nC(s),s.style.width=`${a}`,s.style.height=`${d}`,t.backgroundColor&&(l.fillStyle=t.backgroundColor,l.fillRect(0,0,s.width,s.height)),l.drawImage(i,0,0,s.width,s.height),s}async function BC(e,t={}){return(await bC(e,t)).toDataURL()}function WC(e,t){const n=Object.fromEntries(e.map(h=>[h.id,h])),r=h=>e.filter(g=>g.type===h),o=r("route");r("handler");const i=new Map;o.forEach(h=>{var g,p;i.set(h.id,{method:((g=h.data)==null?void 0:g.method)||"GET",path:((p=h.data)==null?void 0:p.path)||"/",middleware:[]})});const s=t.filter(h=>h.edgeType==="wraps"),l=new Map;s.forEach(h=>l.set(h.target,h.source)),o.forEach(h=>{var v;const g=[];let p=l.get(h.id);for(;p&&((v=n[p])==null?void 0:v.type)==="middleware";)g.unshift(n[p].data.name),p=l.get(p);g.length&&(i.get(h.id).middleware=g)});const u=new Map;t.filter(h=>h.edgeType==="extends").forEach(h=>{var v,E;const g=n[h.source],p=n[h.target];(v=g==null?void 0:g.data)!=null&&v.name&&((E=p==null?void 0:p.data)!=null&&E.name)&&u.set(g.data.name,p.data.name)});const d=t.filter(h=>h.edgeType==="handles"),c=new Map;d.forEach(h=>{var p;const g=n[h.target];if((p=g==null?void 0:g.data)!=null&&p.name){const v=[];let E=g.data.name;for(;E;)v.push(E),E=u.get(E);c.set(h.source,v)}}),o.forEach(h=>{c.has(h.id)||c.set(h.id,[])});const f=new Set;c.forEach(h=>h.forEach(g=>f.add(g)));const m=new Map;[...f].forEach(h=>{const g="class:"+h;m.set(g,{id:g,name:h,isAbstract:!0,routes:[],parentId:null,isLambda:!1})}),u.forEach((h,g)=>{const p="class:"+g,v="class:"+h;m.has(p)&&m.has(v)&&(m.get(p).parentId=v)}),c.forEach((h,g)=>{if(h.length===0){const p=i.get(g),v="class:Lambda:"+p.method+":"+encodeURIComponent(p.path);m.set(v,{id:v,name:"Lambda Handler",isAbstract:!1,isLambda:!0,method:p.method,path:p.path,routes:[{method:p.method,path:p.path,middleware:p.middleware}],parentId:null})}else{const v="class:"+h[0];if(m.has(v)){const E=m.get(v);E.isAbstract=!1;const _=i.get(g);E.routes.push({method:_.method,path:_.path,middleware:_.middleware})}}});const y=[...m.values()].map(h=>({id:h.id,type:"handler",data:{name:h.name,isAbstract:h.isAbstract,isLambda:h.isLambda,method:h.method,path:h.path,routes:h.routes,middleware:h.routes.length>0?[...new Set(h.routes.flatMap(g=>g.middleware))]:[]}})),w=new Set,x=[];return m.forEach((h,g)=>{if(h.parentId){const p=h.parentId+"->"+g;w.has(p)||(w.add(p),x.push({id:p,source:h.parentId,target:g,edgeType:"extends"}))}}),{nodes:y,edges:x}}const UC=60,qm=12,YC=48,Si=60,Dd=60,XC=220,QC=50,GC=260,KC=230,ZC=80;function Jm(e){var t;return(t=e.data)!=null&&t.isAbstract?XC:GC}function uc(e){var r,o,i,s,l;if((r=e.data)!=null&&r.isAbstract)return QC;const t=((i=(o=e.data)==null?void 0:o.routes)==null?void 0:i.length)||1,n=(((l=(s=e.data)==null?void 0:s.middleware)==null?void 0:l.length)||0)>0;return 53+t*22+(n?22:0)+20}function _s(e,t,n){const r=t.get(e)||[],o=uc(n[e]);if(!r.length)return o;const i=r.reduce((s,l,u)=>s+_s(l,t,n)+(u>0?qm:0),0);return Math.max(o,i)}function e0(e,t,n,r,o,i){const s=o[e],l=r.get(e)||[],u=uc(s),a=Jm(s),d=_s(e,r,o);if(i.set(e,{x:t,y:n+(d-u)/2}),l.length){const c=t+a+UC;let f=n;l.forEach(m=>{const y=_s(m,r,o);e0(m,c,f,r,o,i),f+=y+qm})}}function qC(e,t){const n=e.filter(w=>{var x;return(x=w.data)==null?void 0:x.isLambda}),r=e.filter(w=>{var x;return!((x=w.data)!=null&&x.isLambda)}),o=Object.fromEntries(r.map(w=>[w.id,w])),i=new Map,s=new Set;t.forEach(w=>{w.edgeType==="extends"&&(i.has(w.source)||i.set(w.source,[]),i.get(w.source).push(w.target),s.add(w.target))});const l=r.filter(w=>!s.has(w.id)),u=new Map;let a=Dd;l.forEach(w=>{const x=_s(w.id,i,o);e0(w.id,Si,a,i,o,u),a+=x+YC});let d=-1/0,c=-1/0,f=1/0;const m=r.map(w=>{const x=u.get(w.id)||{x:Si,y:Dd},h=x.x+Jm(w),g=x.y+uc(w);return h>d&&(d=h),g>c&&(c=g),x.y{m.push({..._,position:{x:v+N%x*h,y:E+Math.floor(N/x)*g}})})}const y=t.filter(w=>w.edgeType==="extends").map((w,x)=>({...w,id:w.id||`ext-${x}`,type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#2e3347",strokeWidth:1.5},markerEnd:{type:"arrowclosed",width:11,height:11,color:"#2e3347"},animated:!1}));return{nodes:m,edges:y}}const t0={opacity:0,width:6,height:6,pointerEvents:"none",border:"none",background:"transparent"},Vl=M.jsx(Mr,{type:"target",position:G.Left,style:t0}),bl=M.jsx(Mr,{type:"source",position:G.Right,style:t0}),Ei={GET:{bg:"#0d4429",color:"#4ade80"},POST:{bg:"#172554",color:"#60a5fa"},PUT:{bg:"#451a03",color:"#fb923c"},PATCH:{bg:"#2e1065",color:"#c084fc"},DELETE:{bg:"#450a0a",color:"#f87171"},OPTIONS:{bg:"#1c1917",color:"#a8a29e"},HEAD:{bg:"#1c1917",color:"#a8a29e"}},bn={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function JC({data:e,selected:t}){var n,r,o,i;if(e.isAbstract)return M.jsxs("div",{style:{background:"rgba(239,68,68,0.05)",border:t?"2px solid #60a5fa":"1px solid #ef4444",borderRadius:8,padding:"8px 14px",width:220,overflow:"hidden",boxSizing:"border-box",fontFamily:"system-ui, sans-serif"},children:[Vl,bl,M.jsx("div",{style:{fontSize:9,color:"#ef4444",fontWeight:700,letterSpacing:.5,marginBottom:3},children:"ABSTRACT"}),M.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e2e8f0",fontFamily:"monospace",...bn},children:e.name})]});if(e.isLambda){const s=e.method||"GET",l=e.path||"/",u=Ei[s]||Ei.OPTIONS,a=l.replace(/\{([^}]+)\}/g,'{$1}');return M.jsxs("div",{style:{background:"#1a1d27",border:t?"2px solid #60a5fa":"1px solid #3b82f6",borderRadius:8,padding:"10px 12px",width:230,overflow:"hidden",boxSizing:"border-box",fontFamily:"system-ui, sans-serif"},children:[Vl,bl,M.jsx("div",{style:{fontSize:9,color:"#60a5fa",fontWeight:700,letterSpacing:.5,marginBottom:7},children:"LAMBDA"}),M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,overflow:"hidden"},children:[M.jsx("span",{style:{background:u.bg,color:u.color,fontSize:9,fontWeight:700,padding:"2px 5px",borderRadius:3,fontFamily:"monospace",flexShrink:0},children:s}),M.jsx("span",{style:{fontSize:10,fontFamily:"monospace",color:"#8892a4",...bn},dangerouslySetInnerHTML:{__html:a}})]}),((n=e.middleware)==null?void 0:n.length)>0&&M.jsx("div",{style:{display:"flex",gap:3,flexWrap:"wrap",marginTop:7},children:e.middleware.map(d=>M.jsx("span",{style:{background:"#1f1a0e",color:"#f6ad55",fontSize:8,fontWeight:600,padding:"1px 4px",borderRadius:2,fontFamily:"monospace",...bn,maxWidth:"100%"},children:d},d))})]})}return M.jsxs("div",{style:{background:"#1a1d27",border:t?"2px solid #60a5fa":"1px solid #3b82f6",borderRadius:8,padding:"10px 12px",width:260,overflow:"hidden",boxSizing:"border-box",fontFamily:"system-ui, sans-serif"},children:[Vl,bl,M.jsxs("div",{style:{marginBottom:8},children:[M.jsx("div",{style:{fontSize:9,color:"#60a5fa",fontWeight:700,letterSpacing:.5,marginBottom:2},children:"HANDLER"}),M.jsx("div",{style:{fontSize:12,fontWeight:700,color:"#e2e8f0",fontFamily:"monospace",...bn},children:e.name})]}),M.jsx("div",{style:{height:1,background:"#2e3347",marginBottom:8}}),M.jsx("div",{style:{marginBottom:((r=e.middleware)==null?void 0:r.length)>0?8:0},children:(o=e.routes)==null?void 0:o.map((s,l)=>{const u=Ei[s.method]||Ei.OPTIONS,a=(s.path||"/").replace(/\{([^}]+)\}/g,'{$1}');return M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:l0&&M.jsx("div",{style:{display:"flex",gap:3,flexWrap:"wrap"},children:e.middleware.map(s=>M.jsx("span",{style:{background:"#1f1a0e",color:"#f6ad55",fontSize:8,fontWeight:600,padding:"1px 4px",borderRadius:2,fontFamily:"monospace",...bn,maxWidth:"100%"},children:s},s))})]})}const eN={handler:JC};function tN(e){const{getNodes:t}=Yo();$.useEffect(()=>{e.current=()=>{const n=t();if(!n.length)return;const r=Lg(n),o=60,i=Math.max(1920,r.width+o*2),s=Math.max(1080,r.height+o*2),l=Xs(r,i,s,.1,4,o);BC(document.querySelector(".react-flow__viewport"),{backgroundColor:"#0f1117",width:i,height:s,style:{width:i+"px",height:s+"px",transform:`translate(${l.x}px,${l.y}px) scale(${l.zoom})`}}).then(u=>{const a=document.createElement("a");a.download="flash-routes.png",a.href=u,a.click()}).catch(console.error)}},[t,e])}function nN({styledNodes:e,styledEdges:t,onNodesChange:n,onEdgesChange:r,onNodeMouseEnter:o,onNodeMouseLeave:i,showLambdas:s,searchQuery:l,exportRef:u}){const{fitView:a}=Yo();return tN(u),$.useEffect(()=>{setTimeout(()=>a({padding:.15,duration:300}),50)},[s,l,a]),M.jsxs(xk,{nodes:e,edges:t,onNodesChange:n,onEdgesChange:r,onNodeMouseEnter:o,onNodeMouseLeave:i,nodeTypes:eN,fitView:!0,fitViewOptions:{padding:.15},colorMode:"dark",minZoom:.03,maxZoom:2,panOnDrag:!0,panOnScroll:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,zoomOnDoubleClick:!0,children:[M.jsx(Mk,{color:"#161822",gap:32,size:1}),M.jsx(Rk,{showInteractive:!1,style:{background:"#12141c",border:"1px solid #1e2235"}}),M.jsx(Xk,{style:{background:"#12141c",border:"1px solid #1e2235"},maskColor:"rgba(0,0,0,0.5)",nodeColor:d=>{var c;return(c=d.data)!=null&&c.isAbstract?"#ef444499":"#3b82f666"}})]})}function rN(){const[e,t]=$.useState([]),[n,r]=$.useState([]),[o,i,s]=Sk([]),[l,u,a]=Ek([]),[d,c]=$.useState(!0),[f,m]=$.useState(null),[y,w]=$.useState(null),[x,h]=$.useState(null),[g,p]=$.useState({nodes:new Set,edges:new Set}),[v,E]=$.useState(!1),[_,N]=$.useState(""),[P,L]=$.useState(!1),j=$.useRef(null);$.useEffect(()=>{fetch("/routeviewer/data").then(S=>{if(!S.ok)throw new Error(S.statusText);return S.json()}).then(S=>{const T=S.nodes.filter(U=>U.type==="route").length,{nodes:F,edges:O}=WC(S.nodes,S.edges),{nodes:W,edges:V}=qC(F,O);t(W),r(V),w({routes:T}),c(!1)}).catch(S=>{m(S.message),c(!1)})},[]);const z=$.useMemo(()=>{const S=new Map;return n.forEach(T=>{T.edgeType==="extends"&&S.set(T.target,T.source)}),T=>{const F=new Set;let O=S.get(T);for(;O;)F.add(O),O=S.get(O);return F}},[n]);$.useEffect(()=>{const S=_.trim().toLowerCase(),T=new Set(e.filter(V=>{var U;return(U=V.data)==null?void 0:U.isLambda}).map(V=>V.id));let F=new Set(e.map(V=>V.id));if(S){const V=new Set(e.filter(Y=>{var Q,B;return(((Q=Y.data)==null?void 0:Q.name)||"").toLowerCase().includes(S)||(((B=Y.data)==null?void 0:B.routes)||[]).some(K=>K.path.toLowerCase().includes(S))}).map(Y=>Y.id)),U=new Set(V);V.forEach(Y=>z(Y).forEach(Q=>U.add(Q))),F=U}const O=e.filter(V=>T.has(V.id)&&!v?!1:F.has(V.id)),W=new Set(O.map(V=>V.id));i(O),u(n.filter(V=>W.has(V.source)&&W.has(V.target)))},[v,_,e,n,i,u,z]);const R=$.useCallback((S,T)=>{const F=new Map;l.forEach(U=>{U.edgeType==="extends"&&F.set(U.target,{pid:U.source,eid:U.id})});const O=new Set([T.id]),W=new Set,V=[T.id];for(;V.length;){const U=V.shift(),Y=F.get(U);Y&&!O.has(Y.pid)&&(W.add(Y.eid),O.add(Y.pid),V.push(Y.pid))}h(T.id),p({nodes:O,edges:W})},[l]),H=$.useCallback(()=>{h(null),p({nodes:new Set,edges:new Set})},[]),C=o.map(S=>({...S,style:{opacity:x&&!g.nodes.has(S.id)?.1:1,transition:"opacity 0.15s"}})),A=l.map(S=>{const T={type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#1e2235",strokeWidth:1.5},markerEnd:{type:Sr.ArrowClosed,width:10,height:10,color:"#1e2235"}};return x?g.edges.has(S.id)?{...S,type:"bezier",pathOptions:{curvature:.35},style:{stroke:"#60a5fa",strokeWidth:2.5},markerEnd:{type:Sr.ArrowClosed,width:13,height:13,color:"#60a5fa"}}:{...S,...T,style:{...T.style,opacity:.04}}:{...S,...T}}),I=e.filter(S=>{var T;return(T=S.data)==null?void 0:T.isLambda}).length,D=e.filter(S=>{var T;return!((T=S.data)!=null&&T.isLambda)}).length,k=$.useCallback(()=>{L(!0),setTimeout(()=>{var S;(S=j.current)==null||S.call(j),setTimeout(()=>L(!1),1200)},50)},[]);return M.jsxs("div",{style:{display:"flex",width:"100vw",height:"100vh",overflow:"hidden",background:"#0f1117"},children:[M.jsxs("aside",{style:{width:"240px",minWidth:"240px",flexShrink:0,display:"flex",flexDirection:"column",background:"#0c0e15",borderRight:"1px solid #1a1d2a",fontFamily:"system-ui, sans-serif",color:"#c8cfe0"},children:[M.jsx("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid #1a1d2a",display:"flex",alignItems:"center",gap:8},children:M.jsx("span",{style:{fontSize:15,fontWeight:700,letterSpacing:"-0.3px"},children:"⚡ Route Viewer"})}),M.jsxs("div",{style:{padding:"14px 14px",overflowY:"auto",flex:1},children:[M.jsxs(_i,{label:"SEARCH",children:[M.jsx("input",{type:"text",placeholder:"handler or path…",value:_,onChange:S=>N(S.target.value),style:{width:"100%",boxSizing:"border-box",background:"#12141e",border:"1px solid #1e2235",borderRadius:5,padding:"6px 9px",color:"#c8cfe0",fontSize:12,fontFamily:"monospace",outline:"none"}}),_&&M.jsxs("div",{style:{fontSize:11,color:"#4a5370",marginTop:5},children:[o.length," node",o.length!==1?"s":""," visible"]})]}),M.jsxs(_i,{label:"DISPLAY",children:[M.jsxs("label",{style:{display:"flex",alignItems:"center",gap:9,cursor:"pointer",fontSize:12},children:[M.jsx("input",{type:"checkbox",checked:v,onChange:S=>E(S.target.checked),style:{cursor:"pointer",accentColor:"#3b82f6"}}),M.jsx("span",{style:{color:"#8892a4"},children:"Show lambda handlers"})]}),M.jsxs("div",{style:{fontSize:11,color:"#343b54",marginTop:4,paddingLeft:21},children:[I," lambda",I!==1?"s":""]})]}),M.jsx(_i,{label:"STATS",children:[["Routes",(y==null?void 0:y.routes)||0],["Handlers",D],["Lambdas",I]].map(([S,T])=>M.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,marginBottom:5},children:[M.jsx("span",{style:{color:"#4a5370"},children:S}),M.jsx("span",{style:{color:"#e2e8f0",fontWeight:600,fontFamily:"monospace"},children:T})]},S))}),M.jsx(_i,{label:"LEGEND",children:[{dot:"#3b82f6",border:"#3b82f6",label:"Handler"},{dot:"#ef4444",border:"#ef4444",label:"Abstract"},{dot:"#f6ad55",border:"#f6ad55",label:"Middleware"}].map(({dot:S,label:T})=>M.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[M.jsx("div",{style:{width:9,height:9,borderRadius:2,background:S,flexShrink:0,opacity:.8}}),M.jsx("span",{style:{fontSize:12,color:"#4a5370"},children:T})]},T))}),M.jsxs("div",{style:{fontSize:11,color:"#2d3347",lineHeight:1.65,marginTop:4},children:["Hover a node to trace its ancestry.",M.jsx("br",{}),"Search filters nodes + parents."]})]}),M.jsx("div",{style:{padding:"12px 14px",borderTop:"1px solid #1a1d2a"},children:M.jsx("button",{onClick:k,disabled:P||d,style:{width:"100%",padding:"8px 0",background:P?"#1e2235":"#12141e",border:"1px solid #1e2235",borderRadius:6,color:P?"#4a5370":"#8892a4",fontSize:12,cursor:P?"default":"pointer",fontFamily:"system-ui, sans-serif",transition:"all 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:P?"⏳ Exporting…":"⬇ Export PNG"})})]}),M.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:[M.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"9px 18px",background:"#0c0e15",borderBottom:"1px solid #1a1d2a",flexShrink:0,zIndex:10},children:[M.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#e2e8f0",letterSpacing:"-0.2px"},children:"Flash Route Graph"}),M.jsx("span",{style:{marginLeft:"auto",display:"flex",gap:18,fontSize:11,color:"#2d3347",fontFamily:"system-ui"},children:[["#3b82f6","handler"],["#ef4444","abstract"],["#f6ad55","middleware"]].map(([S,T])=>M.jsxs("span",{style:{display:"flex",alignItems:"center",gap:5},children:[M.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:S,display:"inline-block",opacity:.8}}),T]},T))})]}),d&&M.jsx("div",{className:"center muted",children:"Loading…"}),f&&M.jsxs("div",{className:"center error",children:["Error: ",f]}),!d&&!f&&M.jsx("div",{style:{flex:1,position:"relative"},children:M.jsx(jm,{children:M.jsx(nN,{styledNodes:C,styledEdges:A,onNodesChange:s,onEdgesChange:a,onNodeMouseEnter:R,onNodeMouseLeave:H,showLambdas:v,searchQuery:_,exportRef:j})})})]})]})}function _i({label:e,children:t}){return M.jsxs("div",{style:{marginBottom:18},children:[M.jsx("div",{style:{fontSize:9,fontWeight:700,letterSpacing:1,color:"#272d42",marginBottom:8,fontFamily:"monospace"},children:e}),t]})}Kp(document.getElementById("root")).render(M.jsx($.StrictMode,{children:M.jsx(rN,{})}));
diff --git a/flash-extensions/flash-ext-view/pom.xml b/flash-extensions/flash-ext-view/pom.xml
new file mode 100644
index 0000000..dda326c
--- /dev/null
+++ b/flash-extensions/flash-ext-view/pom.xml
@@ -0,0 +1,44 @@
+
+
+ 4.0.0
+
+
+ dev.relism
+ flash-extensions
+ 1.0-SNAPSHOT
+
+
+ flash-ext-view
+
+
+
+ dev.relism
+ flash
+
+
+
+
+ org.thymeleaf
+ thymeleaf
+ 3.1.2.RELEASE
+ true
+
+
+
+ org.projectlombok
+ lombok
+
+
+ org.junit.jupiter
+ junit-jupiter
+
+
+
+
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Renderer.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Renderer.java
new file mode 100644
index 0000000..764d9e1
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Renderer.java
@@ -0,0 +1,98 @@
+package dev.relism.ext.view;
+
+import dev.relism.http.ContentType;
+import dev.relism.models.Response;
+
+/**
+ * Imperative view renderer — the programmatic counterpart to {@link View @View}.
+ *
+ * Retrieve once at boot time in {@link dev.relism.models.RequestHandler#onInit onInit()},
+ * cache in a private field, and call on the hot-path with zero lookup overhead:
+ *
+ *
{@code
+ * @Route(method = HttpMethod.GET, path = "/dashboard")
+ * public class DashboardHandler extends RequestHandler {
+ * private Renderer renderer;
+ * private DashboardService svc;
+ *
+ * @Override protected void onInit() {
+ * renderer = require(Renderer.class);
+ * svc = require(DashboardService.class);
+ * }
+ *
+ * @Override public Object handle(Request req, Response res) throws Exception {
+ * return renderer.view(res, "dashboard", Map.of("data", svc.stats()));
+ * }
+ * }
+ * }
+ *
+ * For lambda handlers, capture {@code Renderer} from the context at registration
+ * time — it is available immediately after {@code ViewExtension} is installed:
+ *
+ *
{@code
+ * app.install(new ViewExtension(engine));
+ * Renderer renderer = app.ctx().require(Renderer.class);
+ * app.get("/about", (req, res) -> renderer.view(res, "about"));
+ * }
+ *
+ * The underlying {@link ViewEngine} is thread-safe after construction — no
+ * synchronization is needed on the hot-path.
+ */
+public final class Renderer {
+
+ private final ViewEngine engine;
+
+ /** Package-private — constructed exclusively by {@link ViewExtension}. */
+ Renderer(ViewEngine engine) {
+ this.engine = engine;
+ }
+
+ // ── Rendering ────────────────────────────────────────────────────────────
+
+ /**
+ * Renders {@code template} with {@code model}, sets the {@code Content-Type}
+ * header to {@code type}, and returns the rendered string as the handler body.
+ */
+ public String view(Response res, String template, Object model, ContentType type) throws Exception {
+ res.setContentType(type);
+ return engine.render(template, model);
+ }
+
+ /**
+ * Renders {@code template} with {@code model} and sets
+ * {@code Content-Type: text/html}.
+ */
+ public String view(Response res, String template, Object model) throws Exception {
+ return view(res, template, model, ContentType.TEXT_HTML);
+ }
+
+ /** Renders {@code template} with a {@code null} model. */
+ public String view(Response res, String template) throws Exception {
+ return view(res, template, null);
+ }
+
+ // ── Template signal ───────────────────────────────────────────────────────
+
+ /**
+ * Creates a deferred {@link Template} signal that will be intercepted by the
+ * {@link View @View} middleware. Use this from handlers that carry {@code @View}
+ * but need to dynamically override the template name or supply a different model.
+ *
+ *
Does not render immediately — rendering happens in the middleware.
+ */
+ public Template template(String name, Object model) {
+ return Template.of(name, model);
+ }
+
+ /** Creates a {@link Template} signal with a {@code null} model. */
+ public Template template(String name) {
+ return Template.of(name);
+ }
+
+ // ── Escape hatch ─────────────────────────────────────────────────────────
+
+ /** Direct access to the underlying {@link ViewEngine} for advanced use cases. */
+ public ViewEngine engine() {
+ return engine;
+ }
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Template.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Template.java
new file mode 100644
index 0000000..69ac04e
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/Template.java
@@ -0,0 +1,62 @@
+package dev.relism.ext.view;
+
+/**
+ * Explicit render signal returned from a handler to override the template name
+ * and/or model chosen by {@link View @View}.
+ *
+ *
{@code Template} is a lightweight value object — it carries the template
+ * name and an optional model, but performs no rendering itself. The
+ * {@link ViewExtension}-injected middleware detects it at the call site and
+ * delegates to the {@link ViewEngine}.
+ *
+ *
Use {@code Template} when:
+ *
+ * - The handler is annotated with {@code @View} but needs to redirect to a
+ * different template dynamically (e.g. on validation failure).
+ * - A lambda handler or a handler without {@code @View} wants to
+ * trigger rendering without registering the annotation — pair with a
+ * {@link Renderer} captured at construction time.
+ *
+ *
+ * {@code
+ * // Inside a @View-annotated handler — overrides the default template on error
+ * public Object handle(Request req, Response res) {
+ * if (!valid) return Template.of("form-error", Map.of("errors", errors));
+ * return service.findAll(); // falls back to @View template
+ * }
+ *
+ * // Lambda handler — pair with Renderer captured from ctx at boot time
+ * Renderer renderer = ctx.require(Renderer.class);
+ * app.get("/page", (req, res) -> renderer.view(res, "page", model));
+ * }
+ */
+public final class Template {
+
+ private final String name;
+ private final Object model;
+
+ private Template(String name, Object model) {
+ this.name = name;
+ this.model = model;
+ }
+
+ /** Creates a {@code Template} signal with the given name and model. */
+ public static Template of(String name, Object model) {
+ return new Template(name, model);
+ }
+
+ /** Creates a {@code Template} signal with a {@code null} model. */
+ public static Template of(String name) {
+ return new Template(name, null);
+ }
+
+ /** The template name/path to render. */
+ public String name() {
+ return name;
+ }
+
+ /** The model to bind; may be {@code null}. */
+ public Object model() {
+ return model;
+ }
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ThymeleafEngine.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ThymeleafEngine.java
new file mode 100644
index 0000000..7a6967a
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ThymeleafEngine.java
@@ -0,0 +1,146 @@
+package dev.relism.ext.view;
+
+import org.thymeleaf.IEngineConfiguration;
+import org.thymeleaf.TemplateEngine;
+import org.thymeleaf.context.Context;
+import org.thymeleaf.context.IExpressionContext;
+import org.thymeleaf.linkbuilder.ILinkBuilder;
+import org.thymeleaf.templatemode.TemplateMode;
+import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
+
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * {@link ViewEngine} bridge for Thymeleaf 3.x.
+ *
+ * Package-private — instantiated exclusively by {@link ViewEngineType#THYMELEAF}.
+ *
+ *
Default configuration
+ *
+ * - Prefix : {@code /templates/} (classpath-relative)
+ * - Suffix : {@code .html}
+ * - Mode : {@link TemplateMode#HTML}
+ * - Encoding: UTF-8
+ * - Cache : enabled in production, disabled in dev mode
+ * ({@code flash.env=dev} or {@code FLASH_ENV=dev})
+ *
+ *
+ * Link building
+ * Thymeleaf's built-in {@code StandardLinkBuilder} requires an
+ * {@code IWebContext} (servlet context) to resolve context-relative paths
+ * ({@code @{/foo}}). Flash runs standalone, so this engine registers a custom
+ * {@link FlashLinkBuilder} that resolves {@code @{...}} expressions without a
+ * servlet context — path variables and query parameters are supported as usual.
+ *
+ * Model conventions
+ *
+ * - {@link Map} model → each entry is a named Thymeleaf variable.
+ * - Any other non-null value → registered under the key {@code "it"}.
+ * - {@code null} model → empty context.
+ *
+ */
+final class ThymeleafEngine implements ViewEngine {
+
+ private static final String PREFIX = "/templates/";
+ private static final String SUFFIX = ".html";
+ private static final String FRAGMENT = " :: content";
+
+ private final TemplateEngine engine;
+
+ ThymeleafEngine(boolean cacheEnabled) {
+ ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
+ resolver.setPrefix(PREFIX);
+ resolver.setSuffix(SUFFIX);
+ resolver.setTemplateMode(TemplateMode.HTML);
+ resolver.setCharacterEncoding("UTF-8");
+ resolver.setCacheable(cacheEnabled);
+
+ this.engine = new TemplateEngine();
+ this.engine.setTemplateResolver(resolver);
+ // Replace the default StandardLinkBuilder (which requires IWebContext)
+ // with our standalone-compatible link builder.
+ this.engine.addLinkBuilder(FlashLinkBuilder.INSTANCE);
+ }
+
+ @Override
+ public String render(String template, Object model, boolean fragment) {
+ Context ctx = new Context();
+ populateContext(ctx, model);
+ return engine.process(fragment ? template + FRAGMENT : template, ctx);
+ }
+
+ private static void populateContext(Context ctx, Object model) {
+ if (model instanceof Map, ?> map) {
+ map.forEach((k, v) -> ctx.setVariable(String.valueOf(k), v));
+ } else if (model != null) {
+ ctx.setVariable("it", model);
+ }
+ }
+
+ // ── Link builder ──────────────────────────────────────────────────────────
+
+ /**
+ * Standalone-compatible link builder for Thymeleaf's {@code @{...}} expressions.
+ *
+ * Thymeleaf's built-in {@code StandardLinkBuilder} requires an
+ * {@code IWebContext} (i.e. a servlet container) to resolve context-relative
+ * paths starting with {@code /}. This builder replicates that behaviour without
+ * the servlet dependency:
+ *
+ * - Path variables — {@code @{/posts/{id}(id=${post.id})}} → {@code /posts/abc}
+ * - Query params — {@code @{/search(q=${term})}} → {@code /search?q=hello}
+ * - Mixed — {@code @{/posts/{id}(id=x,p=2)}} → {@code /posts/x?p=2}
+ *
+ * Registered at order {@link Integer#MIN_VALUE} so it takes precedence over
+ * {@code StandardLinkBuilder} ({@code Integer.MAX_VALUE}).
+ */
+ private static final class FlashLinkBuilder implements ILinkBuilder {
+
+ static final FlashLinkBuilder INSTANCE = new FlashLinkBuilder();
+
+ @Override public String getName() { return "flash"; }
+ @Override public Integer getOrder() { return Integer.MIN_VALUE; }
+
+ @Override
+ public String buildLink(IExpressionContext ctx,
+ String base,
+ Map params) {
+ if (base == null) return "";
+ String url = expandPathVars(base, params);
+ return appendQueryString(url, base, params);
+ }
+
+ /** Substitutes {@code {key}} placeholders in the path with their encoded values. */
+ private static String expandPathVars(String base, Map params) {
+ if (params == null || params.isEmpty() || !base.contains("{")) return base;
+ String result = base;
+ for (var e : params.entrySet()) {
+ String placeholder = '{' + e.getKey() + '}';
+ if (result.contains(placeholder) && e.getValue() != null) {
+ result = result.replace(placeholder, encode(String.valueOf(e.getValue())));
+ }
+ }
+ return result;
+ }
+
+ /** Appends parameters that were NOT consumed as path variables as {@code ?k=v&…} pairs. */
+ private static String appendQueryString(String url, String base, Map params) {
+ if (params == null || params.isEmpty()) return url;
+ StringBuilder qs = new StringBuilder();
+ for (var e : params.entrySet()) {
+ if (base.contains('{' + e.getKey() + '}') || e.getValue() == null) continue;
+ qs.append(qs.isEmpty() ? '?' : '&')
+ .append(encode(e.getKey()))
+ .append('=')
+ .append(encode(String.valueOf(e.getValue())));
+ }
+ return qs.isEmpty() ? url : url + qs;
+ }
+
+ private static String encode(String s) {
+ return URLEncoder.encode(s, StandardCharsets.UTF_8).replace("+", "%20");
+ }
+ }
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/View.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/View.java
new file mode 100644
index 0000000..31e4dae
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/View.java
@@ -0,0 +1,75 @@
+package dev.relism.ext.view;
+
+import dev.relism.http.ContentType;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Declarative view binding for class-based handlers.
+ *
+ * When {@code ViewExtension} is installed, handlers annotated with {@code @View}
+ * receive an injected middleware that intercepts the handler's return value and
+ * passes it to the {@link ViewEngine} for rendering. The rendered string replaces
+ * the handler's return value as the response body, and {@link #contentType()} is
+ * written to the {@code Content-Type} header.
+ *
+ *
Return-value semantics
+ *
+ * - Return a {@link Template} — overrides both the template name and
+ * the model dynamically (e.g. redirect to a different template on error).
+ * - Return any other non-null value — used as the model; the template name
+ * comes from {@link #value()}.
+ * - Return {@code null} — renders {@link #value()} with a {@code null} model.
+ *
+ *
+ * {@code
+ * @Route(method = HttpMethod.GET, path = "/")
+ * @View("home")
+ * public class HomeHandler extends RequestHandler {
+ * private PostService posts;
+ * @Override protected void onInit() { posts = require(PostService.class); }
+ *
+ * @Override public Object handle(Request req, Response res) {
+ * return Map.of("posts", posts.findAll()); // model → home template
+ * }
+ * }
+ *
+ * // Dynamic template override via Template signal
+ * @View("list")
+ * public class ConditionalHandler extends RequestHandler {
+ * public Object handle(Request req, Response res) {
+ * if (something) return Template.of("error", Map.of("msg", "oops"));
+ * return data; // uses "list" template
+ * }
+ * }
+ * }
+ *
+ * The annotation is inspected via superclass traversal, so a base handler class
+ * can declare the view template and all concrete subclasses inherit it.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface View {
+
+ /**
+ * Template name or path passed to the {@link ViewEngine}.
+ * The exact format is engine-specific (e.g. {@code "home"}, {@code "views/home.html"}).
+ */
+ String value();
+
+ /**
+ * {@code Content-Type} written to the response.
+ * Defaults to {@link ContentType#TEXT_HTML}.
+ */
+ ContentType contentType() default ContentType.TEXT_HTML;
+
+ /**
+ * If {@code true}, instructs the {@link ViewEngine} to render only a named
+ * fragment inside the template rather than the full page.
+ * Useful for HTMX / partial-update patterns.
+ */
+ boolean fragment() default false;
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngine.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngine.java
new file mode 100644
index 0000000..5287713
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngine.java
@@ -0,0 +1,45 @@
+package dev.relism.ext.view;
+
+/**
+ * Contract for template engine integrations.
+ *
+ *
Implement this interface to plug any template engine (Thymeleaf, Jinjava,
+ * Mustache, FreeMarker, …) into the Flash view layer. A single instance is
+ * shared across all handlers, so implementations must be thread-safe.
+ *
+ *
{@code
+ * // Thymeleaf example
+ * ViewEngine thymeleaf = (template, model, fragment) -> {
+ * Context ctx = new Context();
+ * if (model instanceof Map,?> m) m.forEach((k, v) -> ctx.setVariable(k.toString(), v));
+ * else if (model != null) ctx.setVariable("model", model);
+ * return engine.process(fragment ? template + " :: fragment" : template, ctx);
+ * };
+ *
+ * app.install(new ViewExtension(thymeleaf));
+ * }
+ */
+@FunctionalInterface
+public interface ViewEngine {
+
+ /**
+ * Renders {@code template} with the supplied {@code model}.
+ *
+ * @param template the template name or path — engine-specific convention
+ * (e.g. {@code "views/home"}, {@code "home.html"})
+ * @param model the model object passed to the template; may be {@code null}
+ * @param fragment if {@code true}, only a named fragment inside the template
+ * should be rendered (Thymeleaf: {@code template :: fragment},
+ * Mustache: partial name, etc.)
+ * @return the rendered output string
+ * @throws Exception any rendering error — propagated as a 500 by the Flash runtime
+ */
+ String render(String template, Object model, boolean fragment) throws Exception;
+
+ /**
+ * Convenience overload — renders the full template ({@code fragment = false}).
+ */
+ default String render(String template, Object model) throws Exception {
+ return render(template, model, false);
+ }
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngineType.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngineType.java
new file mode 100644
index 0000000..b1bd71a
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewEngineType.java
@@ -0,0 +1,80 @@
+package dev.relism.ext.view;
+
+/**
+ * Managed template engine types supported out-of-the-box by {@link ViewExtension}.
+ *
+ * Pass one of these constants to {@link ViewExtension#ViewExtension(ViewEngineType)}
+ * for zero-boilerplate setup. The extension auto-configures the selected engine with
+ * sensible defaults and validates that the required library is on the runtime classpath,
+ * throwing a descriptive {@link IllegalStateException} at boot time if it is not.
+ *
+ *
{@code
+ * // Zero-boilerplate — Thymeleaf auto-configured with defaults
+ * app.install(new ViewExtension(ViewEngineType.THYMELEAF));
+ * }
+ *
+ * Dev mode
+ * Template caching is disabled when either:
+ *
+ * - the JVM property {@code flash.env} equals {@code dev} (case-insensitive), or
+ * - the environment variable {@code FLASH_ENV} equals {@code dev}.
+ *
+ * In all other cases caching is enabled (production default).
+ *
+ * Adding your own engine
+ * For unsupported engines, implement {@link ViewEngine} directly and use
+ * {@link ViewExtension#ViewExtension(ViewEngine)} instead.
+ */
+public enum ViewEngineType {
+
+ /**
+ * Thymeleaf 3.x — natural HTML templates with server-side rendering.
+ *
+ * Required dependency (add to your {@code pom.xml}):
+ *
{@code
+ *
+ * org.thymeleaf
+ * thymeleaf
+ * 3.1.2.RELEASE
+ *
+ * }
+ *
+ * Default resolver: classpath, prefix {@code /templates/}, suffix {@code .html},
+ * mode {@code HTML}, encoding UTF-8.
+ */
+ THYMELEAF;
+
+ // ── Factory ───────────────────────────────────────────────────────────────
+
+ /**
+ * Instantiates and configures the {@link ViewEngine} for this type.
+ * Called once at {@link ViewExtension#install} time — never on the hot-path.
+ *
+ * @param cacheEnabled whether the engine should cache compiled templates
+ * @throws IllegalStateException if the required library is not on the classpath
+ */
+ ViewEngine createEngine(boolean cacheEnabled) {
+ return switch (this) {
+ case THYMELEAF -> createThymeleaf(cacheEnabled);
+ };
+ }
+
+ // ── Engine factories ──────────────────────────────────────────────────────
+
+ private static ViewEngine createThymeleaf(boolean cacheEnabled) {
+ try {
+ return new ThymeleafEngine(cacheEnabled);
+ } catch (NoClassDefFoundError e) {
+ throw new IllegalStateException("""
+ Thymeleaf is not on the classpath. \
+ Add the following dependency to your pom.xml:
+
+
+ org.thymeleaf
+ thymeleaf
+ 3.1.2.RELEASE
+
+ """, e);
+ }
+ }
+}
diff --git a/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewExtension.java b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewExtension.java
new file mode 100644
index 0000000..458a462
--- /dev/null
+++ b/flash-extensions/flash-ext-view/src/main/java/dev/relism/ext/view/ViewExtension.java
@@ -0,0 +1,166 @@
+package dev.relism.ext.view;
+
+import dev.relism.extension.FlashContext;
+import dev.relism.extension.FlashExtension;
+import dev.relism.extension.FlashRegistrar;
+import dev.relism.http.ContentType;
+import dev.relism.routing.Middleware;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Installs the view layer into a Flash application.
+ *
+ * Managed mode (recommended)
+ * Pass a {@link ViewEngineType} — the extension auto-configures the engine,
+ * detects dev mode for cache settings, and validates classpath dependencies at boot:
+ * {@code
+ * app.install(new ViewExtension(ViewEngineType.THYMELEAF));
+ * }
+ *
+ * Manual mode (BYOE)
+ * Supply your own {@link ViewEngine} implementation for full control:
+ * {@code
+ * ViewEngine myEngine = (template, model, fragment) -> { ... };
+ * app.install(new ViewExtension(myEngine));
+ * }
+ *
+ * What gets installed
+ *
+ * - {@link ViewEngine} and {@link Renderer} are bound in the {@link FlashContext} —
+ * any handler can retrieve them via {@code require(Renderer.class)}.
+ * - An {@link dev.relism.extension.AnnotationProcessor} is registered: class-based
+ * handlers carrying {@link View @View} receive an injected rendering middleware
+ * that intercepts the handler return value, resolves the template + model, and
+ * delegates to the engine. No boilerplate required in the handler itself.
+ *
+ *
+ * Handler patterns
+ * {@code
+ * // Declarative — annotation drives template selection
+ * @Route(method = HttpMethod.GET, path = "/")
+ * @View("home")
+ * public class HomeHandler extends RequestHandler {
+ * public Object handle(Request req, Response res) {
+ * return Map.of("posts", service.findAll()); // model → home.html
+ * }
+ * }
+ *
+ * // Dynamic override via Template signal
+ * @View("list")
+ * public class ListHandler extends RequestHandler {
+ * public Object handle(Request req, Response res) {
+ * if (error) return Template.of("error", Map.of("msg", "oops"));
+ * return data; // falls back to list.html
+ * }
+ * }
+ *
+ * // Imperative — explicit render call (lambda-friendly)
+ * Renderer renderer = app.ctx().require(Renderer.class);
+ * app.get("/about", (req, res) -> renderer.view(res, "about"));
+ * }
+ *
+ * Dev mode / cache
+ * In managed mode, template caching is disabled when the JVM property
+ * {@code flash.env=dev} or the environment variable {@code FLASH_ENV=dev} is set.
+ *
+ * Cross-extension integration
+ * {@code
+ * ctx.optional(ViewEngine.class).ifPresent(engine -> { ... });
+ * }
+ */
+public final class ViewExtension implements FlashExtension {
+
+ private final ViewEngine engine;
+
+ // ── Constructors ──────────────────────────────────────────────────────────
+
+ /**
+ * Managed mode — auto-configures the engine selected by {@code type}.
+ *
+ * Template caching is enabled unless {@code flash.env=dev} (JVM property)
+ * or {@code FLASH_ENV=dev} (environment variable) is set.
+ *
+ * @param type the engine to use; must have its library on the runtime classpath
+ * @throws IllegalStateException at boot time if the library is missing
+ */
+ public ViewExtension(ViewEngineType type) {
+ this(type.createEngine(!isDevMode()));
+ }
+
+ /**
+ * Manual mode — use a pre-constructed {@link ViewEngine} implementation.
+ * Suitable for custom engines or engines that need non-default configuration.
+ *
+ * @param engine the engine implementation; must be thread-safe
+ */
+ public ViewExtension(ViewEngine engine) {
+ this.engine = Objects.requireNonNull(engine, "ViewEngine must not be null");
+ }
+
+ // ── FlashExtension ────────────────────────────────────────────────────────
+
+ @Override
+ public void install(FlashRegistrar app, FlashContext ctx) {
+ Renderer renderer = new Renderer(engine);
+ ctx.provide(ViewEngine.class, engine);
+ ctx.provide(Renderer.class, renderer);
+
+ ctx.addAnnotationProcessor(handlerClass -> {
+ View view = findView(handlerClass);
+ if (view == null) return List.of();
+
+ String defaultTemplate = view.value();
+ ContentType contentType = view.contentType();
+ boolean fragment = view.fragment();
+
+ // Injected once per handler at boot — zero overhead on the hot-path.
+ // Intercepts the return value: Template signal overrides name+model;
+ // any other value becomes the model for the annotation's template.
+ Middleware renderingMiddleware = next -> (req, res) -> {
+ Object result = next.handle(req, res);
+ String tpl;
+ Object model;
+ if (result instanceof Template t) {
+ tpl = t.name();
+ model = t.model();
+ } else {
+ tpl = defaultTemplate;
+ model = result;
+ }
+ res.setContentType(contentType);
+ return engine.render(tpl, model, fragment);
+ };
+
+ return List.of(renderingMiddleware);
+ });
+ }
+
+ // ── Helpers ───────────────────────────────────────────────────────────────
+
+ /**
+ * Walks the superclass chain to find {@link View @View}.
+ * Supports inheritance: a base handler can declare the view template and
+ * concrete subclasses inherit it without re-annotating.
+ */
+ private static View findView(Class> cls) {
+ while (cls != null && !cls.equals(Object.class)) {
+ View v = cls.getAnnotation(View.class);
+ if (v != null) return v;
+ cls = cls.getSuperclass();
+ }
+ return null;
+ }
+
+ /**
+ * Returns {@code true} when running in dev mode.
+ * Checks JVM property {@code flash.env} first, then env var {@code FLASH_ENV}.
+ */
+ private static boolean isDevMode() {
+ String prop = System.getProperty("flash.env");
+ if (prop != null) return "dev".equalsIgnoreCase(prop);
+ String env = System.getenv("FLASH_ENV");
+ return "dev".equalsIgnoreCase(env);
+ }
+}
diff --git a/flash-extensions/pom.xml b/flash-extensions/pom.xml
index c6d1f05..018fb52 100644
--- a/flash-extensions/pom.xml
+++ b/flash-extensions/pom.xml
@@ -18,6 +18,8 @@
flash-ext-openapi
flash-ext-oidc
flash-ext-routeviewer
+ flash-ext-view
+ flash-ext-limiter
diff --git a/flash/src/main/java/dev/relism/HttpServer.java b/flash/src/main/java/dev/relism/HttpServer.java
index 2e67475..30709b8 100644
--- a/flash/src/main/java/dev/relism/HttpServer.java
+++ b/flash/src/main/java/dev/relism/HttpServer.java
@@ -5,11 +5,12 @@ import dev.relism.http.ContentType;
import dev.relism.http.HttpStatus;
import dev.relism.models.*;
import dev.relism.extension.FlashConfiguration;
-import dev.relism.routing.GlobalRouter;
+import dev.relism.routing.AbstractRouter;
import lombok.extern.slf4j.Slf4j;
import java.io.*;
+import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
@@ -21,32 +22,32 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
- * Pure I/O transport layer. Owns the {@link ServerSocket}, the virtual-thread executor,
- * and the keep-alive accept loop. All routing is delegated to the {@link GlobalRouter}
- * supplied at construction time.
+ * Pure I/O transport layer. Owns the {@link ServerSocket}, the virtual-thread
+ * executor, and the keep-alive accept loop. Routing is delegated to a single
+ * {@link AbstractRouter}.
*
- * This class is package-private — use {@link dev.relism.extension.FlashApp} as the
- * single entry point for creating and configuring a Flash server.
+ *
Package-private : use {@link dev.relism.extension.FlashApp} as the single
+ * entry point.
*/
@Slf4j
class HttpServer implements ServerHandle {
private final FlashConfiguration configuration;
- private final ServerSocket serverSocket;
- private final GlobalRouter globalRouter;
- private final ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor();
- private final Set activeSockets = ConcurrentHashMap.newKeySet();
+ private final ServerSocket serverSocket;
+ private final AbstractRouter router;
+ private final ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor();
+ private final Set activeSockets = ConcurrentHashMap.newKeySet();
private volatile boolean stopped = false;
private final CompletableFuture readyFuture = new CompletableFuture<>();
- private static final byte[] HTTP_1_1 = "HTTP/1.1 ".getBytes(StandardCharsets.UTF_8);
- private static final byte[] CRLF = "\r\n".getBytes(StandardCharsets.UTF_8);
- private static final byte[] CONTENT_TYPE = "Content-Type: ".getBytes(StandardCharsets.UTF_8);
- private static final byte[] CONTENT_LENGTH = "Content-Length: ".getBytes(StandardCharsets.UTF_8);
- private static final byte[] CONNECTION_CLOSE = "Connection: close\r\n".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] HTTP_1_1 = "HTTP/1.1 ".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] CRLF = "\r\n".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] CONTENT_TYPE = "Content-Type: ".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] CONTENT_LENGTH = "Content-Length: ".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] CONNECTION_CLOSE = "Connection: close\r\n".getBytes(StandardCharsets.UTF_8);
private static final byte[] CONNECTION_KEEPALIVE = "Connection: keep-alive\r\n".getBytes(StandardCharsets.UTF_8);
- private static final byte[] TRANSFER_CHUNKED = "Transfer-Encoding: chunked\r\n".getBytes(StandardCharsets.UTF_8);
- private static final byte[] FINAL_CHUNK = "0\r\n\r\n".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] TRANSFER_CHUNKED = "Transfer-Encoding: chunked\r\n".getBytes(StandardCharsets.UTF_8);
+ private static final byte[] FINAL_CHUNK = "0\r\n\r\n".getBytes(StandardCharsets.UTF_8);
private static final byte[] UNKNOWN_STATUS_SUFFIX = " Unknown".getBytes(StandardCharsets.UTF_8);
private static final byte[][] DIGITS = new byte[10][1];
@@ -55,20 +56,12 @@ class HttpServer implements ServerHandle {
DIGITS[i] = String.valueOf(i).getBytes(StandardCharsets.UTF_8);
}
- /**
- * Creates the transport with a pre-built router. Called exclusively by
- * {@link dev.relism.extension.FlashApp}.
- *
- * @param configuration server configuration (port, host, buffer sizes)
- * @param globalRouter the fully-wired router to dispatch requests to
- */
- HttpServer(FlashConfiguration configuration, GlobalRouter globalRouter) throws IOException {
+ HttpServer(FlashConfiguration configuration, AbstractRouter router) throws IOException {
this.configuration = configuration;
this.serverSocket = new ServerSocket(configuration.getPort());
- this.globalRouter = globalRouter;
+ this.router = router;
}
- /** Returns a future that completes once the accept loop is running and the server is ready. */
@Override
public CompletableFuture start() {
Thread.ofPlatform().name("flash-accept-loop").daemon(false).start(this::run);
@@ -90,15 +83,10 @@ class HttpServer implements ServerHandle {
}
}
- /** Closes all active connections and shuts down the executor. Returns when complete. */
@Override
public CompletableFuture stop() {
stopped = true;
- try {
- serverSocket.close();
- } catch (IOException e) {
- log.error("Error closing server socket", e);
- }
+ try { serverSocket.close(); } catch (IOException e) { log.error("Error closing server socket", e); }
activeSockets.forEach(s -> { try { s.close(); } catch (IOException ignored) {} });
executorService.shutdown();
try {
@@ -111,7 +99,7 @@ class HttpServer implements ServerHandle {
return CompletableFuture.completedFuture(null);
}
- // ── Hot-path ──────────────────────────────────────────────────────────────
+ // ── Hot-path ─────────────────────────────────────────────────────────────
private void process(Socket socket) {
activeSockets.add(socket);
@@ -119,36 +107,32 @@ class HttpServer implements ServerHandle {
try (socket;
InputStream in = socket.getInputStream();
OutputStream out = new BufferedOutputStream(socket.getOutputStream())) {
- RequestParser parser = new RequestParser(configuration.getMaxHeaderBufferSize());
+ RequestParser parser = new RequestParser(
+ configuration.getMaxHeaderBufferSize(),
+ (InetSocketAddress) socket.getRemoteSocketAddress());
while (!stopped) {
Request request = parser.parse(in);
- if (request == null)
- break;
+ if (request == null) break;
boolean keepAlive = isKeepAlive(request);
-
Response response = new Response(200, ContentType.TEXT_PLAIN);
- RequestHandler handler = globalRouter.route(request);
+
+ RequestHandler handler = router.route(request);
+ if (handler == null) handler = router.getNotFoundHandler();
try {
Object result = handler.handle(request, response);
- if (result instanceof Response r)
- response = r;
- else if (result != null)
- response.setBody(result);
+ if (result instanceof Response r) response = r;
+ else if (result != null) response.setBody(result);
} catch (Exception ex) {
- Object result = globalRouter.resolveExceptionHandler(request).handle(ex, request, response);
- if (result instanceof Response r)
- response = r;
- else if (result != null)
- response.setBody(result);
+ Object result = router.getExceptionHandler().handle(ex, request, response);
+ if (result instanceof Response r) response = r;
+ else if (result != null) response.setBody(result);
}
writeResponse(out, response, keepAlive);
request.drain();
-
- if (!keepAlive)
- break;
+ if (!keepAlive) break;
}
} catch (IOException e) {
if (!stopped) {
@@ -170,11 +154,6 @@ class HttpServer implements ServerHandle {
|| request.headerEquals("Connection", "keep-alive");
}
- /**
- * Writes a complete HTTP response. The fixed-body path (the common case for simple handlers
- * like /plaintext) is kept inline; streaming and chunked bodies are delegated to
- * {@link #writeStreamingBody} so the JIT can optimise this method aggressively.
- */
private static void writeResponse(OutputStream out, Response response, boolean keepAlive) throws IOException {
out.write(HTTP_1_1);
byte[] statusBytes = response.getStatusBytes();
diff --git a/flash/src/main/java/dev/relism/RequestParser.java b/flash/src/main/java/dev/relism/RequestParser.java
index abbfe10..da08682 100644
--- a/flash/src/main/java/dev/relism/RequestParser.java
+++ b/flash/src/main/java/dev/relism/RequestParser.java
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.io.InputStream;
+import java.net.InetSocketAddress;
import java.util.Arrays;
/**
@@ -21,15 +22,18 @@ import java.util.Arrays;
public class RequestParser {
private static final int INITIAL_BUFFER_SIZE = 8192;
- private final int maxHeaderBufferSize;
- private final HeaderMap headerMap = new HeaderMap();
+ private final int maxHeaderBufferSize;
+ private final InetSocketAddress remoteAddress; // set once per connection, never changes
+ private final HeaderMap headerMap = new HeaderMap();
private byte[] buffer;
private int bufBase = 0; // absolute start of valid data in buffer
private int bufLen = 0; // number of valid bytes from bufBase
- public RequestParser() { this(64 * 1024); }
- public RequestParser(int maxHeaderBufferSize) {
+ public RequestParser() { this(64 * 1024, null); }
+ public RequestParser(int maxHeaderBufferSize) { this(maxHeaderBufferSize, null); }
+ public RequestParser(int maxHeaderBufferSize, InetSocketAddress remoteAddress) {
this.maxHeaderBufferSize = maxHeaderBufferSize;
+ this.remoteAddress = remoteAddress;
this.buffer = new byte[Math.min(INITIAL_BUFFER_SIZE, maxHeaderBufferSize)];
}
@@ -133,9 +137,9 @@ public class RequestParser {
RequestLine requestLine = new RequestLine(method, pathView, queryView, protocolView, headerMap);
if (isChunked) {
- return Request.forParsed(requestLine, new ChunkedInputStream(in, buffer, bodyStart, preBufLen), -1L, null, 0, 0);
+ return Request.forParsed(requestLine, new ChunkedInputStream(in, buffer, bodyStart, preBufLen), -1L, null, 0, 0, remoteAddress);
}
- return Request.forParsed(requestLine, in, contentLength, buffer, bodyStart, preBufLen);
+ return Request.forParsed(requestLine, in, contentLength, buffer, bodyStart, preBufLen, remoteAddress);
}
private static int findEndOfHeader(byte[] buf, int from, int len) {
diff --git a/flash/src/main/java/dev/relism/ServerHandle.java b/flash/src/main/java/dev/relism/ServerHandle.java
index bec752f..fa72622 100644
--- a/flash/src/main/java/dev/relism/ServerHandle.java
+++ b/flash/src/main/java/dev/relism/ServerHandle.java
@@ -1,26 +1,22 @@
package dev.relism;
import dev.relism.extension.FlashConfiguration;
-import dev.relism.routing.GlobalRouter;
+import dev.relism.routing.AbstractRouter;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
/**
- * Public handle to the underlying HTTP transport. Returned by {@link #create} so that
- * {@link dev.relism.extension.FlashApp} can start and stop the server without holding
- * a direct reference to the package-private {@link HttpServer}.
+ * Public handle to the underlying HTTP transport. Returned by {@link #create}
+ * so that {@link dev.relism.extension.FlashApp} can start and stop the server
+ * without holding a direct reference to the package-private {@link HttpServer}.
*/
public interface ServerHandle {
CompletableFuture start();
CompletableFuture stop();
- /**
- * Creates the HTTP transport. Called exclusively by
- * {@link dev.relism.extension.FlashApp}.
- */
- static ServerHandle create(FlashConfiguration config, GlobalRouter router) throws IOException {
+ static ServerHandle create(FlashConfiguration config, AbstractRouter router) throws IOException {
return new HttpServer(config, router);
}
}
diff --git a/flash/src/main/java/dev/relism/exceptions/DuplicateNamespaceException.java b/flash/src/main/java/dev/relism/exceptions/DuplicateNamespaceException.java
deleted file mode 100644
index 182898d..0000000
--- a/flash/src/main/java/dev/relism/exceptions/DuplicateNamespaceException.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package dev.relism.exceptions;
-
-public class DuplicateNamespaceException extends RuntimeException {
- public DuplicateNamespaceException(String namespace) {
- super("Router with namespace '" + namespace + "' is already registered.");
- }
-}
diff --git a/flash/src/main/java/dev/relism/exceptions/InitializationException.java b/flash/src/main/java/dev/relism/exceptions/InitializationException.java
new file mode 100644
index 0000000..5a5e084
--- /dev/null
+++ b/flash/src/main/java/dev/relism/exceptions/InitializationException.java
@@ -0,0 +1,18 @@
+package dev.relism.exceptions;
+
+/**
+ * Thrown at boot time when Flash detects a configuration or registration error.
+ *
+ * Fail-fast: a clear crash at startup is always preferable to a server that
+ * starts "empty" and silently drops routes.
+ */
+public class InitializationException extends RuntimeException {
+
+ public InitializationException(String message) {
+ super(message);
+ }
+
+ public InitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/flash/src/main/java/dev/relism/extension/AnnotationProcessor.java b/flash/src/main/java/dev/relism/extension/AnnotationProcessor.java
index 2744c71..7f0c81d 100644
--- a/flash/src/main/java/dev/relism/extension/AnnotationProcessor.java
+++ b/flash/src/main/java/dev/relism/extension/AnnotationProcessor.java
@@ -14,7 +14,7 @@ import java.util.List;
* valid — processors may also use the call purely for side effects
* (e.g. collecting OpenAPI metadata).
*
- *
Register processors via {@link ExtensionContext#addAnnotationProcessor}.
+ *
Register processors via {@link FlashContext#addAnnotationProcessor}.
*/
@FunctionalInterface
public interface AnnotationProcessor {
diff --git a/flash/src/main/java/dev/relism/extension/FlashApp.java b/flash/src/main/java/dev/relism/extension/FlashApp.java
index 69fb22f..9276c66 100644
--- a/flash/src/main/java/dev/relism/extension/FlashApp.java
+++ b/flash/src/main/java/dev/relism/extension/FlashApp.java
@@ -1,14 +1,15 @@
package dev.relism.extension;
import dev.relism.ServerHandle;
+import dev.relism.exceptions.InitializationException;
import dev.relism.http.HttpMethod;
import dev.relism.models.RequestHandler;
import dev.relism.models.SimpleHandler;
import dev.relism.routing.AbstractRouter;
-import dev.relism.routing.GlobalRouter;
import dev.relism.routing.Middleware;
import dev.relism.routing.Route;
import dev.relism.routing.RouteHandle;
+import dev.relism.routing.routers.fastpathrouter.FastPathRouterImpl;
import java.io.IOException;
import java.util.ArrayList;
@@ -16,98 +17,62 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
-import java.util.stream.Stream;
/**
- * Primary entry point for Flash. Creates and owns both the {@link GlobalRouter} and
- * the {@link HttpServer} (pure I/O transport). All route registration goes through
- * {@code FlashApp} or a {@link FlashScope} — never through the server or router directly.
+ * Single entry point for Flash. Owns one flat {@link FastPathRouterImpl} —
+ * all routes (app-level and scoped) compile into a single FSM at {@link #start()}.
*
- *
Create via the static factories:
- *
{@code
- * FlashApp app = FlashApp.create(8080);
- * FlashApp app = FlashApp.create(FlashConfiguration.builder().port(8080).build());
- * }
+ * Deferred routing
+ * Routes accumulate during the builder phase. At {@code start()}:
+ *
+ * - Global middlewares are prepended to every route
+ * - Annotation processors run for class-based handlers
+ * - Handlers are bound to the {@link FlashContext}
+ * - All routes compile into one FSM — zero prefix scanning at runtime
+ *
*
- * Install extensions, register routes, mount namespaces, then start:
*
{@code
* FlashApp.create(8080)
* .install(new JacksonExtension())
- * .install(new OidcExtension(config))
+ * .use(cors)
* .get("/ping", (req, res) -> "pong")
- * .get("/me", (req, res) -> ClaimsHolder.user().email()).with(oidc.protect())
- * .register(new HomePage()) // @Route + annotation processors applied
- * .scan("dev.example.handlers") // classpath scan, no-arg constructors
- * .mount("/api", scope -> {
- * scope.register(new UserHandler()); // @Authenticated works here
- * scope.get("/health", (req, res) -> "ok");
- * })
+ * .scan("dev.example.handlers")
+ * .mount("/api", scope -> scope.get("/health", (req, res) -> "ok"))
* .start();
* }
- *
- * Auto-flush
- * Calling any registration method returns a {@link RouteHandle}. Calling
- * {@link RouteHandle#with} is optional — if omitted, the route is registered
- * automatically before the next operation or at {@link #start()}. This means
- * trailing {@code .with()} calls are never required for routes with no middleware.
*/
public final class FlashApp implements FlashRegistrar {
- private final GlobalRouter router;
- private final ServerHandle server;
- private final ExtensionContext ctx = new ExtensionContext();
+ private final AbstractRouter router = new FastPathRouterImpl();
+ private final ServerHandle server;
+ private final FlashContext ctx = new FlashContext();
+ private final List globalMiddlewares = new ArrayList<>();
+ private final List deferredRoutes = new ArrayList<>();
- /** The last returned RouteHandle not yet registered — auto-flushed before the next operation. */
private RouteHandle> pending;
- /**
- * Global middlewares applied to every route, regardless of how it is registered
- * (lambda, class-based, or via {@link #scan}).
- * Accumulated via {@link #use}; applied outermost in the chain (before injected and
- * explicit middlewares).
- */
- private final List globalMiddlewares = new ArrayList<>();
-
private FlashApp(FlashConfiguration config) {
- this.router = new GlobalRouter();
try {
this.server = ServerHandle.create(config, router);
} catch (IOException e) {
- throw new RuntimeException("Failed to bind server socket on port " + config.getPort(), e);
+ throw new InitializationException("Failed to bind on port " + config.getPort(), e);
}
}
// ── Factories ─────────────────────────────────────────────────────────────
- /**
- * Creates a {@code FlashApp} listening on {@code port} with default configuration.
- *
- * @param port the TCP port to bind
- */
public static FlashApp create(int port) {
return create(FlashConfiguration.builder().port(port).build());
}
- /**
- * Creates a {@code FlashApp} with full server configuration.
- *
- * @param config server configuration (port, host, buffer sizes, etc.)
- */
public static FlashApp create(FlashConfiguration config) {
return new FlashApp(config);
}
// ── Pending flush ─────────────────────────────────────────────────────────
- /**
- * Registers any pending route (from the previous {@code get/post/register} call)
- * with no middleware if it has not already been committed via {@link RouteHandle#with}.
- */
private void flushPending() {
- if (pending != null) {
- pending.ensureRegistered();
- pending = null;
- }
+ if (pending != null) { pending.ensureRegistered(); pending = null; }
}
private RouteHandle
track(RouteHandle
handle) {
@@ -116,15 +81,8 @@ public final class FlashApp implements FlashRegistrar {
return handle;
}
- // ── FlashRegistrar — extension installation ───────────────────────────────
+ // ── Extension installation ────────────────────────────────────────────────
- /**
- * Installs an extension. Extensions receive this {@code FlashApp} as a
- * {@link FlashRegistrar} so they can register routes and expose services.
- *
- * @param ext the extension to install
- * @return {@code this} for chaining
- */
@Override
public FlashApp install(FlashExtension ext) {
flushPending();
@@ -132,34 +90,12 @@ public final class FlashApp implements FlashRegistrar {
return this;
}
- // ── Global middleware ──────────────────────────────────────────────────────
+ // ── Global middleware ─────────────────────────────────────────────────────
/**
- * Registers one or more global middlewares applied to every route on this app,
- * regardless of how the route is registered (lambda, class-based, or via {@link #scan}).
- *
- *
Global middlewares execute outermost — before annotation-injected middlewares
- * (e.g. {@code @Authenticated}) and before any explicit {@link RouteHandle#with} chain.
- * Execution order mirrors the declaration order: the first argument wraps everything else.
- *
- *
Must be called before {@link #start()}. Calling {@code use} after routes have already
- * been registered will not retroactively affect those routes.
- *
- *
{@code
- * Middleware cors = next -> (req, res) -> {
- * res.header("Access-Control-Allow-Origin", "*");
- * if (req.method() == HttpMethod.OPTIONS) { res.status(204); return null; }
- * return next.handle(req, res);
- * };
- *
- * FlashApp.create(8080)
- * .use(cors)
- * .scan("dev.example.handlers")
- * .start();
- * }
- *
- * @param middlewares one or more middlewares to apply globally
- * @return {@code this} for chaining
+ * Registers global middlewares applied to every route — including
+ * routes registered before this call and routes inside mounted scopes.
+ * Order-independent: resolved at {@link #start()}.
*/
public FlashApp use(Middleware... middlewares) {
flushPending();
@@ -167,182 +103,157 @@ public final class FlashApp implements FlashRegistrar {
return this;
}
- /**
- * Prepends global middlewares to an explicit per-route array.
- * Returns {@code explicit} unchanged when no global middlewares have been registered
- * (zero-allocation fast path).
- */
- private Middleware[] withGlobal(Middleware[] explicit) {
- if (globalMiddlewares.isEmpty()) return explicit;
- return Stream.concat(globalMiddlewares.stream(), Arrays.stream(explicit))
- .toArray(Middleware[]::new);
- }
+ // ── Route registration (deferred) ─────────────────────────────────────────
- // ── FlashRegistrar — route registration ───────────────────────────────────
+ @Override public RouteHandle get (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.GET, path, h); }
+ @Override public RouteHandle post (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.POST, path, h); }
+ @Override public RouteHandle put (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PUT, path, h); }
+ @Override public RouteHandle delete (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.DELETE, path, h); }
+ @Override public RouteHandle patch (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PATCH, path, h); }
+ @Override public RouteHandle options(String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.OPTIONS, path, h); }
+ @Override public RouteHandle head (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.HEAD, path, h); }
+ @Override public RouteHandle trace (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.TRACE, path, h); }
+ @Override public RouteHandle connect(String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.CONNECT, path, h); }
+ @Override public RouteHandle purge (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PURGE, path, h); }
- @Override public RouteHandle get (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.GET, path, h); }
- @Override public RouteHandle post (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.POST, path, h); }
- @Override public RouteHandle put (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PUT, path, h); }
- @Override public RouteHandle delete (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.DELETE, path, h); }
- @Override public RouteHandle patch (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PATCH, path, h); }
- @Override public RouteHandle options(String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.OPTIONS, path, h); }
- @Override public RouteHandle head (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.HEAD, path, h); }
- @Override public RouteHandle trace (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.TRACE, path, h); }
- @Override public RouteHandle connect(String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.CONNECT, path, h); }
- @Override public RouteHandle purge (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PURGE, path, h); }
+ private static final Middleware[] NO_MW = new Middleware[0];
- private RouteHandle routeLambda(HttpMethod method, String path, SimpleHandler.FunctionalHandler h) {
- return track(new RouteHandle<>(this, m -> {
- Middleware[] all = withGlobal(m);
- emit(method, path, null, List.of(), all);
- router.doRegister(method, path, h, all);
- }));
+ private RouteHandle lambda(HttpMethod method, String path, SimpleHandler.FunctionalHandler h) {
+ return track(new RouteHandle<>(this, mw ->
+ deferredRoutes.add(new RouteDefinition(method, path, new SimpleHandler(h), NO_MW, mw, false, ctx, "/"))));
}
/**
- * Begins registration of a class-based handler. The class must carry a
- * {@link Route @Route} annotation. All registered {@link AnnotationProcessor}s
- * are run (e.g. to inject {@code @Authenticated} / {@code @RolesAllowed} middleware).
- * Injected middlewares are prepended outermost to any explicit ones passed via
- * {@link RouteHandle#with}.
- *
- * Calling {@link RouteHandle#with} is optional — the route is registered
- * automatically before the next operation or at {@link #start()}.
+ * Registers a class-based handler annotated with {@link Route @Route}.
+ * App-level only — not part of {@link FlashRegistrar}.
*/
- @Override
public RouteHandle register(RequestHandler handler) {
- return track(new RouteHandle<>(this, explicit -> {
- List injected = ctx.processors().stream()
- .flatMap(p -> p.process(handler.getClass()).stream())
- .toList();
- Middleware[] all = Stream.concat(
- globalMiddlewares.stream(),
- Stream.concat(injected.stream(), Arrays.stream(explicit))
- ).toArray(Middleware[]::new);
- Route ann = handler.getClass().getAnnotation(Route.class);
- if (ann != null) emit(ann.method(), ann.path(), handler.getClass(), injected, withGlobal(explicit));
- router.doRegister(handler, all);
- }));
+ Route ann = handler.getClass().getAnnotation(Route.class);
+ if (ann == null)
+ throw new InitializationException(
+ handler.getClass().getName() + " is missing @Route");
+ return track(new RouteHandle<>(this, mw ->
+ deferredRoutes.add(new RouteDefinition(ann.method(), ann.path(), handler, NO_MW, mw, true, ctx, "/"))));
}
- /**
- * Scans {@code packageName} for classes that extend {@link RequestHandler} and
- * carry {@link Route @Route}. Each is instantiated via its no-arg constructor,
- * run through annotation processors, and registered.
- *
- * {@code
- * FlashApp.create(8080)
- * .install(new OidcExtension(config))
- * .scan("dev.example.handlers"); // @Authenticated / @RolesAllowed auto-applied
- * }
- */
@Override
public FlashApp scan(String packageName) {
flushPending();
- PackageScanner.findHandlers(packageName).forEach(cls -> register(instantiate(cls)).ensureRegistered());
+ PackageScanner.findHandlers(packageName).forEach(cls ->
+ register(instantiate(cls)).ensureRegistered());
return this;
}
- // ── Namespace mounting ────────────────────────────────────────────────────
+ // ── Namespace mounting (syntactic sugar — routes go into same flat router) ─
/**
- * Mounts a scoped sub-router under {@code namespace}. The {@code configure} consumer
- * receives a {@link FlashScope} that has its own child {@link ExtensionContext}
- * inheriting all parent services and annotation processors.
- *
- * Routes registered on the scope automatically get the namespace prefix prepended.
- * Annotation processors (e.g. from OIDC) apply identically inside the scope.
- *
- *
{@code
- * app.mount("/api", scope -> {
- * scope.register(new UserHandler()); // @Authenticated works
- * scope.get("/health", (req, res) -> "ok");
- * scope.scan("dev.example.api");
- * });
- * }
- *
- * @param namespace the path prefix (e.g. {@code "/api"})
- * @param configure consumer that registers routes on the scope
+ * Mounts a scoped group of routes under {@code namespace}. The scope is a
+ * pure builder — it prepends the namespace to each path and collects
+ * {@link RouteDefinition}s that merge into this app's single flat router.
*/
public FlashApp mount(String namespace, Consumer configure) {
flushPending();
- FlashScope scope = new FlashScope(new dev.relism.routing.routers.fastpathrouter.FastPathRouterImpl(),
- namespace, ctx);
+ FlashScope scope = new FlashScope(namespace, ctx);
configure.accept(scope);
scope.flush();
- router.mount(namespace, scope.router());
+ deferredRoutes.addAll(scope.routes());
return this;
}
- // ── FlashRegistrar — error handlers ──────────────────────────────────────
+ // ── Error handlers ────────────────────────────────────────────────────────
- @Override
public FlashApp onException(AbstractRouter.ExceptionHandler handler) {
flushPending();
router.onException(handler);
return this;
}
- @Override
public FlashApp onNotFound(SimpleHandler.FunctionalHandler handler) {
flushPending();
router.onNotFound(handler);
return this;
}
- // ── FlashRegistrar — context ──────────────────────────────────────────────
-
@Override
- public ExtensionContext ctx() {
- return ctx;
- }
+ public FlashContext ctx() { return ctx; }
// ── Lifecycle ─────────────────────────────────────────────────────────────
/**
- * Flushes any pending route registration and starts the HTTP server.
- *
- * @return a future that completes once the accept loop is running
+ * Compiles all deferred routes into the flat FSM router, then starts
+ * the HTTP transport. One pass, one router, zero prefix scanning.
*/
public CompletableFuture start() {
flushPending();
+ compile();
return server.start();
}
- /** Stops the HTTP server and closes all active connections. */
- public CompletableFuture stop() {
- return server.stop();
+ public CompletableFuture stop() { return server.stop(); }
+
+ // ── Compilation ──────────────────────────────────────────────────────────
+
+ /**
+ * Compiles all deferred routes. Middleware chain order:
+ * Global → Scope → Annotation (class-based only) → Explicit (.with).
+ */
+ private void compile() {
+ for (RouteDefinition def : deferredRoutes) {
+ List injected;
+ if (def.classBasedHandler()) {
+ injected = def.ctx().processors().stream()
+ .flatMap(p -> p.process(def.handler().getClass()).stream())
+ .toList();
+ def.handler().bind(def.ctx());
+ } else {
+ injected = List.of();
+ }
+
+ Middleware[] all = concat(globalMiddlewares, def.scopeMiddlewares(),
+ injected, def.explicitMiddlewares());
+ emitEvent(def, all);
+ router.doRegister(def.method(), def.path(), def.handler(), all);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void emitEvent(RouteDefinition def, Middleware[] allMiddlewares) {
+ List listeners = def.ctx().routeListeners();
+ if (listeners.isEmpty()) return;
+
+ List> chain = new ArrayList<>(allMiddlewares.length);
+ for (Middleware m : allMiddlewares)
+ chain.add((Class extends Middleware>) m.getClass());
+
+ Class> handlerClass = def.classBasedHandler() ? def.handler().getClass() : null;
+ RouteEvent event = new RouteEvent(def.method(), def.path(), def.namespace(),
+ "FlashApp", handlerClass, List.copyOf(chain));
+ listeners.forEach(l -> l.onRoute(event));
}
// ── Internals ─────────────────────────────────────────────────────────────
- @SuppressWarnings("unchecked")
+ private static Middleware[] concat(List global, Middleware[] scope,
+ List injected, Middleware[] explicit) {
+ int total = global.size() + scope.length + injected.size() + explicit.length;
+ if (total == 0) return NO_MW;
+ if (total == explicit.length && scope.length == 0) return explicit;
+ Middleware[] all = new Middleware[total];
+ int i = 0;
+ for (Middleware m : global) all[i++] = m;
+ for (Middleware m : scope) all[i++] = m;
+ for (Middleware m : injected) all[i++] = m;
+ System.arraycopy(explicit, 0, all, i, explicit.length);
+ return all;
+ }
+
private static RequestHandler instantiate(Class> cls) {
try {
return (RequestHandler) cls.getDeclaredConstructor().newInstance();
} catch (Exception e) {
- throw new RuntimeException("Failed to instantiate handler: " + cls.getName() +
+ throw new InitializationException(
+ "Failed to instantiate " + cls.getName() +
" — ensure it has a public no-arg constructor", e);
}
}
-
- /**
- * Emits a {@link RouteEvent} to all registered {@link RouteListener}s.
- * No-op if no listener has been registered (fast empty-list check).
- * Called once per route at boot time — never on the request hot-path.
- */
- @SuppressWarnings("unchecked")
- private void emit(HttpMethod method, String path, Class> handlerClass,
- List injected, Middleware[] explicit) {
- List listeners = ctx.routeListeners();
- if (listeners.isEmpty()) return;
- Middleware[] routerMws = router.routerMiddlewares();
- List> chain = new ArrayList<>(routerMws.length + injected.size() + explicit.length);
- for (Middleware m : routerMws) chain.add((Class extends Middleware>) m.getClass());
- for (Middleware m : injected) chain.add((Class extends Middleware>) m.getClass());
- for (Middleware m : explicit) chain.add((Class extends Middleware>) m.getClass());
- RouteEvent event = new RouteEvent(method, path, router.getNamespace(),
- router.getClass().getSimpleName(), handlerClass, List.copyOf(chain));
- listeners.forEach(l -> l.onRoute(event));
- }
}
diff --git a/flash/src/main/java/dev/relism/extension/ExtensionContext.java b/flash/src/main/java/dev/relism/extension/FlashContext.java
similarity index 54%
rename from flash/src/main/java/dev/relism/extension/ExtensionContext.java
rename to flash/src/main/java/dev/relism/extension/FlashContext.java
index c9200bd..0be26fd 100644
--- a/flash/src/main/java/dev/relism/extension/ExtensionContext.java
+++ b/flash/src/main/java/dev/relism/extension/FlashContext.java
@@ -4,46 +4,42 @@ import java.util.*;
import java.util.stream.Stream;
/**
- * Shared registry passed to every extension during {@link FlashExtension#install}.
- * Extensions use it in two ways:
+ * Central service registry and boot-time hook coordinator.
+ *
+ * Every handler, extension, and scope shares one (or a child of one) {@code FlashContext}.
+ * It provides three capabilities:
*
- * - Service sharing — provide/require typed objects (e.g. {@code ObjectMapper},
- * {@code OpenApiBuilder}) so extensions can build on each other.
- * - Annotation processing — register {@link AnnotationProcessor}s that
- * are invoked for every handler, injecting middleware derived from
- * annotations ({@code @RolesAllowed}, {@code @Authenticated}, etc.).
+ * - Service registry — typed {@link #provide}/{@link #require}/{@link #find}.
+ * - Annotation processors — middleware injection from handler annotations.
+ * - Route listeners — boot-time observation of the route graph.
*
*
- * A child context (created via {@link #child()}) inherits all services and processors
- * from its parent. Services provided and processors added on the child are scoped to it
- * and not visible in the parent or sibling scopes.
+ *
A child context (via {@link #child()}) inherits parent services and processors.
+ * Services provided on the child are scoped and invisible to the parent.
*/
-public class ExtensionContext {
+public class FlashContext {
- private final ExtensionContext parent;
+ private final FlashContext parent;
private final Map, Object> registry = new LinkedHashMap<>();
private final List processors = new ArrayList<>();
private final List routeListeners = new ArrayList<>();
- public ExtensionContext() {
+ public FlashContext() {
this.parent = null;
}
- private ExtensionContext(ExtensionContext parent) {
+ private FlashContext(FlashContext parent) {
this.parent = parent;
}
- /**
- * Creates a child context that inherits this context's services and processors.
- * Services provided and processors added on the child do not affect the parent.
- */
- public ExtensionContext child() {
- return new ExtensionContext(this);
+ /** Creates a child context that inherits this context's services and processors. */
+ public FlashContext child() {
+ return new FlashContext(this);
}
// ── Service registry ─────────────────────────────────────────────────────
- /** Stores {@code instance} under {@code type} for retrieval by other extensions. */
+ /** Stores {@code instance} under {@code type} for retrieval via {@link #require} or {@link #find}. */
public void provide(Class type, T instance) {
registry.put(type, instance);
}
@@ -51,7 +47,8 @@ public class ExtensionContext {
/**
* Retrieves the service registered under {@code type}.
* Checks own scope first, then the parent chain.
- * Throws {@link IllegalStateException} if not found — install order matters.
+ *
+ * @throws IllegalStateException if not found
*/
@SuppressWarnings("unchecked")
public T require(Class type) {
@@ -59,12 +56,12 @@ public class ExtensionContext {
if (val == null && parent != null) val = parent.find(type).orElse(null);
if (val == null)
throw new IllegalStateException(
- "Extension dependency not found: " + type.getSimpleName() +
- " — install the required extension first");
+ "Service not found: " + type.getSimpleName() +
+ " — provide it via FlashContext.provide() or install the required extension");
return val;
}
- /** Returns the service under {@code type}, or empty if not installed in this scope or any parent. */
+ /** Returns the service under {@code type}, or empty if not provided in this scope or any parent. */
@SuppressWarnings("unchecked")
public Optional find(Class type) {
T val = (T) registry.get(type);
@@ -72,21 +69,26 @@ public class ExtensionContext {
return parent != null ? parent.find(type) : Optional.empty();
}
+ /**
+ * Returns the service registered under {@code type} as an {@link Optional},
+ * or {@link Optional#empty()} if not present in this scope or any parent.
+ *
+ * Semantically identical to {@link #find} — prefer this name for expressive call sites
+ * ({@code ctx.optional(ViewEngine.class).ifPresent(...)}). Respects the parent-first
+ * scope hierarchy: own registry is checked first, then the parent chain.
+ */
+ public Optional optional(Class type) {
+ return find(type);
+ }
+
// ── Annotation processors ────────────────────────────────────────────────
- /**
- * Registers an {@link AnnotationProcessor}. Called by extensions during
- * {@link FlashExtension#install}. Processors are invoked in registration order
- * (parent processors first, then own).
- */
+ /** Registers an {@link AnnotationProcessor}. Processors run once per class-based handler at boot. */
public void addAnnotationProcessor(AnnotationProcessor processor) {
processors.add(processor);
}
- /**
- * Returns all processors visible from this context: parent processors first,
- * then processors added directly to this context.
- */
+ /** All processors visible from this context: parent-first, then own. */
List processors() {
if (parent == null) return Collections.unmodifiableList(processors);
List parentProcessors = parent.processors();
@@ -96,22 +98,12 @@ public class ExtensionContext {
// ── Route listeners ──────────────────────────────────────────────────────
- /**
- * Registers a {@link RouteListener} that will be notified once for every route
- * registered on this context's {@link dev.relism.extension.FlashApp} or any
- * {@link dev.relism.extension.FlashScope} that inherits from it.
- *
- * Call this inside {@link FlashExtension#install} to observe all routes.
- * If no listener is registered the emission path is a no-op.
- */
+ /** Registers a boot-time {@link RouteListener}. Zero overhead on the request hot-path. */
public void addRouteListener(RouteListener listener) {
routeListeners.add(listener);
}
- /**
- * Returns all route listeners visible from this context: parent listeners first,
- * then listeners added directly to this context.
- */
+ /** All route listeners visible from this context: parent-first, then own. */
List routeListeners() {
if (parent == null) return Collections.unmodifiableList(routeListeners);
List parentListeners = parent.routeListeners();
diff --git a/flash/src/main/java/dev/relism/extension/FlashExtension.java b/flash/src/main/java/dev/relism/extension/FlashExtension.java
index 5dd7199..d2535ef 100644
--- a/flash/src/main/java/dev/relism/extension/FlashExtension.java
+++ b/flash/src/main/java/dev/relism/extension/FlashExtension.java
@@ -3,17 +3,17 @@ package dev.relism.extension;
/**
* Contract for all Flash extensions. An extension receives a {@link FlashRegistrar}
* (either a {@link FlashApp} or a {@link FlashScope}) so it can register routes and
- * expose shared services via {@link ExtensionContext}.
+ * expose shared services via {@link FlashContext}.
*
* Extensions work identically whether installed at the top-level app or inside a
* mounted scope:
*
*
{@code
* public class RateLimitExtension implements FlashExtension {
- * public void install(FlashRegistrar app, ExtensionContext ctx) {
+ * public void install(FlashRegistrar app, FlashContext ctx) {
* RateLimiter limiter = new RateLimiter(100);
* ctx.provide(RateLimiter.class, limiter);
- * app.onException((ex, req, res) -> { ... });
+ * app.get("/rate-info", (req, res) -> limiter.info());
* }
* }
*
@@ -28,5 +28,5 @@ package dev.relism.extension;
*/
@FunctionalInterface
public interface FlashExtension {
- void install(FlashRegistrar app, ExtensionContext ctx);
+ void install(FlashRegistrar app, FlashContext ctx);
}
diff --git a/flash/src/main/java/dev/relism/extension/FlashRegistrar.java b/flash/src/main/java/dev/relism/extension/FlashRegistrar.java
index f573f6f..7943a0c 100644
--- a/flash/src/main/java/dev/relism/extension/FlashRegistrar.java
+++ b/flash/src/main/java/dev/relism/extension/FlashRegistrar.java
@@ -1,23 +1,17 @@
package dev.relism.extension;
-import dev.relism.models.RequestHandler;
import dev.relism.models.SimpleHandler;
-import dev.relism.routing.AbstractRouter;
import dev.relism.routing.RouteHandle;
/**
* Common registration surface shared by {@link FlashApp} and {@link FlashScope}.
*
- * {@link FlashExtension#install} receives a {@code FlashRegistrar} so that extensions
+ *
{@link FlashExtension#install} receives a {@code FlashRegistrar} so extensions
* work identically whether installed at the top-level app or inside a mounted scope.
*
- *
Route registration follows the auto-flush pattern: calling any registration method
- * without a subsequent {@link RouteHandle#with} is equivalent to calling
- * {@code .with()} with no arguments — the route is registered with no middleware.
- *
*
{@code
* // In an extension:
- * public void install(FlashRegistrar app, ExtensionContext ctx) {
+ * public void install(FlashRegistrar app, FlashContext ctx) {
* app.get("/health", (req, res) -> "ok");
* app.get("/secured", (req, res) -> user()).with(oidc.protect());
* }
@@ -25,11 +19,9 @@ import dev.relism.routing.RouteHandle;
*/
public interface FlashRegistrar {
- // ── Extension installation ────────────────────────────────────────────────
-
FlashRegistrar install(FlashExtension ext);
- // ── Route registration ────────────────────────────────────────────────────
+ // ── Lambda route registration ────────────────────────────────────────────
RouteHandle> get (String path, SimpleHandler.FunctionalHandler h);
RouteHandle> post (String path, SimpleHandler.FunctionalHandler h);
@@ -43,29 +35,13 @@ public interface FlashRegistrar {
RouteHandle> purge (String path, SimpleHandler.FunctionalHandler h);
/**
- * Begins registration of a class-based handler. The class must carry a
- * {@link dev.relism.routing.Route @Route} annotation. Annotation processors
- * (e.g. {@code @Authenticated}, {@code @RolesAllowed}) are applied automatically.
- *
- * Calling {@link RouteHandle#with} is optional — the route is registered
- * automatically before the next operation or at {@code start()}.
- */
- RouteHandle> register(RequestHandler h);
-
- /**
- * Scans {@code packageName} for classes that extend {@link RequestHandler} and
- * carry {@link dev.relism.routing.Route @Route}. Each is instantiated via its
+ * Scans {@code packageName} for classes that extend
+ * {@link dev.relism.models.RequestHandler} and carry
+ * {@link dev.relism.routing.Route @Route}. Each is instantiated via its
* no-arg constructor, run through annotation processors, and registered.
*/
FlashRegistrar scan(String packageName);
- // ── Error handlers ────────────────────────────────────────────────────────
-
- FlashRegistrar onException(AbstractRouter.ExceptionHandler h);
- FlashRegistrar onNotFound(SimpleHandler.FunctionalHandler h);
-
- // ── Context access ────────────────────────────────────────────────────────
-
- /** Returns the {@link ExtensionContext} for this registrar (app or scope). */
- ExtensionContext ctx();
+ /** Returns the {@link FlashContext} for this registrar. */
+ FlashContext ctx();
}
diff --git a/flash/src/main/java/dev/relism/extension/FlashScope.java b/flash/src/main/java/dev/relism/extension/FlashScope.java
index ba40e42..ed36729 100644
--- a/flash/src/main/java/dev/relism/extension/FlashScope.java
+++ b/flash/src/main/java/dev/relism/extension/FlashScope.java
@@ -1,62 +1,43 @@
package dev.relism.extension;
+import dev.relism.exceptions.InitializationException;
import dev.relism.http.HttpMethod;
import dev.relism.models.RequestHandler;
import dev.relism.models.SimpleHandler;
-import dev.relism.routing.AbstractRouter;
+import dev.relism.routing.Middleware;
import dev.relism.routing.PathUtils;
import dev.relism.routing.Route;
import dev.relism.routing.RouteHandle;
-import dev.relism.routing.Middleware;
-import java.io.File;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Enumeration;
import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.stream.Stream;
/**
- * Scoped registration context for a mounted sub-router namespace.
- *
- *
Obtained via {@link FlashApp#mount(String, java.util.function.Consumer)}.
- * A scope has its own child {@link ExtensionContext} that inherits all services and
- * annotation processors from the parent app, so extensions like {@code @Authenticated}
- * and {@code @RolesAllowed} work identically inside a scope.
- *
- *
Extensions installed on a scope are scoped to that namespace and not visible
- * in the parent or sibling scopes.
+ * Scoped builder for namespace-prefixed routes. Pure syntactic sugar —
+ * does not own a router. Collected routes merge into {@link FlashApp}'s
+ * single flat router at {@link FlashApp#start()}.
*
*
{@code
* app.mount("/api", scope -> {
- * scope.install(new RateLimitExtension());
- * scope.register(new UserHandler()); // @Authenticated auto-injected
- * scope.get("/health", (req, res) -> "ok");
+ * scope.use(authMiddleware);
+ * scope.get("/health", (req, res) -> "ok"); // → GET /api/health
* scope.scan("dev.example.api.handlers");
* });
* }
*/
public final class FlashScope implements FlashRegistrar {
- private final AbstractRouter router;
- private final String namespace;
- private final ExtensionContext ctx;
+ private final String namespace;
+ private final FlashContext ctx;
+ private final List scopeMiddlewares = new ArrayList<>();
+ private final List deferredRoutes = new ArrayList<>();
+
+ private static final Middleware[] NO_MW = new Middleware[0];
- /** Pending RouteHandle awaiting .with() — auto-flushed before each new registration. */
private RouteHandle> pending;
- /**
- * Package-private — only {@link FlashApp} creates scopes.
- *
- * @param router the sub-router that will receive routes registered on this scope
- * @param namespace the namespace prefix (e.g. {@code "/api"})
- * @param parentCtx the parent app's ExtensionContext — a child is created from it
- */
- FlashScope(AbstractRouter router, String namespace, ExtensionContext parentCtx) {
- this.router = router;
+ FlashScope(String namespace, FlashContext parentCtx) {
this.namespace = namespace;
this.ctx = parentCtx.child();
}
@@ -64,10 +45,7 @@ public final class FlashScope implements FlashRegistrar {
// ── Pending flush ─────────────────────────────────────────────────────────
private void flushPending() {
- if (pending != null) {
- pending.ensureRegistered();
- pending = null;
- }
+ if (pending != null) { pending.ensureRegistered(); pending = null; }
}
private RouteHandle
track(RouteHandle
handle) {
@@ -76,12 +54,20 @@ public final class FlashScope implements FlashRegistrar {
return handle;
}
- // ── FlashRegistrar — extension installation ───────────────────────────────
+ // ── Scope middleware ──────────────────────────────────────────────────────
/**
- * Installs an extension scoped to this namespace.
- * The extension registers routes and services on this scope only.
+ * Adds middlewares applied to every route in this scope.
+ * Combined at compile time in order: Global → Scope → Annotation → Explicit.
*/
+ public FlashScope use(Middleware... middlewares) {
+ flushPending();
+ scopeMiddlewares.addAll(Arrays.asList(middlewares));
+ return this;
+ }
+
+ // ── Extension installation ────────────────────────────────────────────────
+
@Override
public FlashScope install(FlashExtension ext) {
flushPending();
@@ -89,128 +75,73 @@ public final class FlashScope implements FlashRegistrar {
return this;
}
- // ── FlashRegistrar — route registration ───────────────────────────────────
+ // ── Route registration (deferred) ─────────────────────────────────────────
- @Override public RouteHandle get (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.GET, path, h); }
- @Override public RouteHandle post (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.POST, path, h); }
- @Override public RouteHandle put (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PUT, path, h); }
- @Override public RouteHandle delete (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.DELETE, path, h); }
- @Override public RouteHandle patch (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PATCH, path, h); }
- @Override public RouteHandle options(String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.OPTIONS, path, h); }
- @Override public RouteHandle head (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.HEAD, path, h); }
- @Override public RouteHandle trace (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.TRACE, path, h); }
- @Override public RouteHandle connect(String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.CONNECT, path, h); }
- @Override public RouteHandle purge (String path, SimpleHandler.FunctionalHandler h) { return routeLambda(HttpMethod.PURGE, path, h); }
+ @Override public RouteHandle get (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.GET, path, h); }
+ @Override public RouteHandle post (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.POST, path, h); }
+ @Override public RouteHandle put (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PUT, path, h); }
+ @Override public RouteHandle delete (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.DELETE, path, h); }
+ @Override public RouteHandle patch (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PATCH, path, h); }
+ @Override public RouteHandle options(String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.OPTIONS, path, h); }
+ @Override public RouteHandle head (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.HEAD, path, h); }
+ @Override public RouteHandle trace (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.TRACE, path, h); }
+ @Override public RouteHandle connect(String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.CONNECT, path, h); }
+ @Override public RouteHandle purge (String path, SimpleHandler.FunctionalHandler h) { return lambda(HttpMethod.PURGE, path, h); }
- private RouteHandle routeLambda(HttpMethod method, String path, SimpleHandler.FunctionalHandler h) {
- return track(new RouteHandle<>(this, m -> {
- String full = ns(path);
- emit(method, full, null, List.of(), m);
- router.doRegister(method, full, h, m);
- }));
+ private RouteHandle lambda(HttpMethod method, String path, SimpleHandler.FunctionalHandler h) {
+ String full = ns(path);
+ Middleware[] scopeMw = snapshotScopeMiddlewares();
+ return track(new RouteHandle<>(this, mw ->
+ deferredRoutes.add(new RouteDefinition(method, full, new SimpleHandler(h), scopeMw, mw, false, ctx, namespace))));
}
/**
- * Begins registration of a class-based handler. Annotation processors from the
- * parent app and any installed on this scope are applied. The {@link Route @Route}
- * path is prepended with this scope's namespace automatically.
- *
- * Calling {@link RouteHandle#with} is optional — the route is registered
- * automatically before the next operation or when the scope consumer returns.
+ * Registers a class-based handler annotated with {@link Route @Route}.
+ * Not part of {@link FlashRegistrar} — scope-only convenience.
*/
- @Override
- public RouteHandle register(RequestHandler handler) {
- return track(new RouteHandle<>(this, explicit -> {
- List injected = ctx.processors().stream()
- .flatMap(p -> p.process(handler.getClass()).stream())
- .toList();
- Middleware[] all = injected.isEmpty()
- ? explicit
- : Stream.concat(injected.stream(), Arrays.stream(explicit)).toArray(Middleware[]::new);
- Route annotation = handler.getClass().getAnnotation(Route.class);
- if (annotation != null) {
- String full = ns(annotation.path());
- emit(annotation.method(), full, handler.getClass(), injected, explicit);
- router.doRegister(annotation.method(), full, (RequestHandler) handler, all);
- }
- }));
+ RouteHandle register(RequestHandler handler) {
+ Route ann = handler.getClass().getAnnotation(Route.class);
+ if (ann == null)
+ throw new InitializationException(
+ handler.getClass().getName() + " is missing @Route");
+ String full = ns(ann.path());
+ Middleware[] scopeMw = snapshotScopeMiddlewares();
+ return track(new RouteHandle<>(this, mw ->
+ deferredRoutes.add(new RouteDefinition(ann.method(), full, handler, scopeMw, mw, true, ctx, namespace))));
}
- /**
- * Scans {@code packageName} for {@link RequestHandler} subclasses annotated with
- * {@link Route @Route}. Each is instantiated via its no-arg constructor and registered
- * with this scope's namespace prefix and annotation processors applied.
- */
@Override
public FlashScope scan(String packageName) {
flushPending();
- PackageScanner.findHandlers(packageName).forEach(cls -> register(instantiate(cls)).ensureRegistered());
+ PackageScanner.findHandlers(packageName).forEach(cls ->
+ register(instantiate(cls)).ensureRegistered());
return this;
}
@Override
- public FlashScope onException(AbstractRouter.ExceptionHandler h) {
- flushPending();
- router.onException(h);
- return this;
- }
+ public FlashContext ctx() { return ctx; }
- @Override
- public FlashScope onNotFound(SimpleHandler.FunctionalHandler h) {
- flushPending();
- router.onNotFound(h);
- return this;
- }
+ // ── Internals (called by FlashApp.mount) ──────────────────────────────────
- @Override
- public ExtensionContext ctx() {
- return ctx;
- }
+ void flush() { flushPending(); }
- // ── Internals ─────────────────────────────────────────────────────────────
+ List routes() { return deferredRoutes; }
- /** Ensures any pending route is registered when the scope consumer returns. */
- void flush() {
- flushPending();
- }
-
- /** Returns the sub-router for GlobalRouter to mount. */
- AbstractRouter router() {
- return router;
- }
-
- /** Prepends this scope's namespace to the given path. */
private String ns(String path) {
return namespace + PathUtils.sanitize(path);
}
- @SuppressWarnings("unchecked")
+ private Middleware[] snapshotScopeMiddlewares() {
+ return scopeMiddlewares.isEmpty() ? NO_MW : scopeMiddlewares.toArray(NO_MW);
+ }
+
private static RequestHandler instantiate(Class> cls) {
try {
return (RequestHandler) cls.getDeclaredConstructor().newInstance();
} catch (Exception e) {
- throw new RuntimeException("Failed to instantiate handler: " + cls.getName() +
+ throw new InitializationException(
+ "Failed to instantiate " + cls.getName() +
" — ensure it has a public no-arg constructor", e);
}
}
-
- /**
- * Emits a {@link RouteEvent} to all {@link RouteListener}s visible from this scope's context.
- * Parent-level listeners (registered on the app) are included via context inheritance.
- * No-op if no listener has been registered. Never called on the request hot-path.
- */
- @SuppressWarnings("unchecked")
- private void emit(HttpMethod method, String path, Class> handlerClass,
- List injected, Middleware[] explicit) {
- List listeners = ctx.routeListeners();
- if (listeners.isEmpty()) return;
- Middleware[] routerMws = router.routerMiddlewares();
- List> chain = new ArrayList<>(routerMws.length + injected.size() + explicit.length);
- for (Middleware m : routerMws) chain.add((Class extends Middleware>) m.getClass());
- for (Middleware m : injected) chain.add((Class extends Middleware>) m.getClass());
- for (Middleware m : explicit) chain.add((Class extends Middleware>) m.getClass());
- RouteEvent event = new RouteEvent(method, path, namespace,
- router.getClass().getSimpleName(), handlerClass, List.copyOf(chain));
- listeners.forEach(l -> l.onRoute(event));
- }
}
diff --git a/flash/src/main/java/dev/relism/extension/PackageScanner.java b/flash/src/main/java/dev/relism/extension/PackageScanner.java
index 21031e1..fb6126c 100644
--- a/flash/src/main/java/dev/relism/extension/PackageScanner.java
+++ b/flash/src/main/java/dev/relism/extension/PackageScanner.java
@@ -1,5 +1,6 @@
package dev.relism.extension;
+import dev.relism.exceptions.InitializationException;
import dev.relism.models.RequestHandler;
import dev.relism.routing.Route;
@@ -15,6 +16,10 @@ import java.util.jar.JarFile;
* Minimal classpath scanner used by {@link FlashApp#scan} and {@link FlashScope#scan}.
* Finds all classes in a package that extend {@link RequestHandler} and carry {@link Route @Route}.
* Supports both exploded directories (development) and fat JARs (deployment).
+ *
+ * Fail-fast: if the package does not exist, contains no handlers, or a handler
+ * class cannot be loaded, an {@link InitializationException} is thrown immediately.
+ * A clear crash at boot is always preferable to a server that starts "empty".
*/
final class PackageScanner {
@@ -22,55 +27,84 @@ final class PackageScanner {
/**
* Returns all {@link RequestHandler} subclasses in {@code packageName} that carry
- * {@link Route @Route} and have a public no-arg constructor.
+ * {@link Route @Route}.
+ *
+ * @throws InitializationException if the package is empty, does not exist, or a
+ * handler class fails to load
*/
static List> findHandlers(String packageName) {
+ if (packageName == null || packageName.isBlank())
+ throw new InitializationException("scan() called with null or blank package name");
+
String resourcePath = packageName.replace('.', '/');
ClassLoader cl = Thread.currentThread().getContextClassLoader();
List> result = new ArrayList<>();
+ List errors = new ArrayList<>();
+ boolean packageFound = false;
+
try {
Enumeration