From 5e344f53664814ff5c92977e0b921e1ee1577e02 Mon Sep 17 00:00:00 2001 From: Dat Nguyen Date: Mon, 15 Jun 2026 09:21:28 +0700 Subject: [PATCH] refactor: use dbterd 1.28 built-in json ERD target --- .claude/agents/docs-dev.md | 11 +- .claude/design_patterns.md | 62 +++++- .claude/skills/spa-site/SKILL.md | 7 +- dbdocs/extract/erd.py | 153 +++++++++------ dbdocs/extract/erd_json.py | 80 -------- dbdocs/site/bundle/assets/graph/index.js | 14 +- frontend/test/e2e/spa.spec.ts | 22 +++ pyproject.toml | 5 +- tests/unit/extract/test_erd_json.py | 70 ------- tests/unit/site/test_builder.py | 228 +++++++++++++++++++++-- uv.lock | 18 +- 11 files changed, 416 insertions(+), 254 deletions(-) delete mode 100644 dbdocs/extract/erd_json.py delete mode 100644 tests/unit/extract/test_erd_json.py diff --git a/.claude/agents/docs-dev.md b/.claude/agents/docs-dev.md index 5daa070..28f4c37 100644 --- a/.claude/agents/docs-dev.md +++ b/.claude/agents/docs-dev.md @@ -20,11 +20,12 @@ mkdocs-material, mike, or Jinja2 templating — those are gone. - `dbdocs/cli/main.py` — the click command group and subcommands (`generate`, `serve`, `deploy`). - `dbdocs/extract/` — derive doc data from artifacts: `nodes` (models/sources/ - seeds/snapshots → display records + nav tree), `erd` + `erd_json` (structured - ERD `{nodes, edges}` via a dbterd `json` target adapter — not Mermaid text; the - SPA renders it with React Flow), `graph` (the node-level DAG), `column_lineage` - + `_sqlglot_lineage` (column-level lineage via sqlglot), and the `health/` - sub-package (the always-built Health Check section from `run_results.json`). + seeds/snapshots → display records + nav tree), `erd` (structured ERD + `{nodes, edges}` via dbterd's built-in `json` target ≥ 1.28.0 — not Mermaid + text; the SPA renders it with React Flow), `graph` (the node-level DAG), + `column_lineage` + `_sqlglot_lineage` (column-level lineage via sqlglot), and + the `health/` sub-package (the always-built Health Check section from + `run_results.json`). - `dbdocs/site/` — `builder` (assemble the one data dict + write the site), `inject` (`strip_marker` removes the `` placeholder — the data is external, not inlined), `deploy` (hand-rolled versioning), and the diff --git a/.claude/design_patterns.md b/.claude/design_patterns.md index 1426a91..3eb6492 100644 --- a/.claude/design_patterns.md +++ b/.claude/design_patterns.md @@ -32,21 +32,24 @@ authoritative; grep it. - [Windowed graph rendering](#windowed-graph-rendering) - [Theory](#theory-7) - [Example](#example-7) - - [Bundled SPA directory resolution](#bundled-spa-directory-resolution) + - [ERD from dbterd's built-in json target](#erd-from-dbterds-built-in-json-target) - [Theory](#theory-8) - [Example](#example-8) - - [Versioned deploy without mike](#versioned-deploy-without-mike) + - [Bundled SPA directory resolution](#bundled-spa-directory-resolution) - [Theory](#theory-9) - [Example](#example-9) - - [Click group entrypoint](#click-group-entrypoint) + - [Versioned deploy without mike](#versioned-deploy-without-mike) - [Theory](#theory-10) - [Example](#example-10) - - [Singleton colored logger](#singleton-colored-logger) + - [Click group entrypoint](#click-group-entrypoint) - [Theory](#theory-11) - [Example](#example-11) - - [Always-built artifact-derived data-dict section (Health Check)](#always-built-artifact-derived-data-dict-section-health-check) + - [Singleton colored logger](#singleton-colored-logger) - [Theory](#theory-12) - [Example](#example-12) + - [Always-built artifact-derived data-dict section (Health Check)](#always-built-artifact-derived-data-dict-section-health-check) + - [Theory](#theory-13) + - [Example](#example-13) ## Pipeline-stage package layout @@ -354,6 +357,55 @@ const dagKeep = useMemo(() => { - `frontend/src/components/GraphApp.tsx` — `MAX_UNFOCUSED_DAG_NODES`, `dagKeep`, `erdNodeEmpty` - `dbdocs/site/builder.py` / `dbdocs/extract/erd.py` — `erd_algo` (metadata) +## ERD from dbterd's built-in json target + +### Theory + +The SPA renders its ERD with React Flow, which needs structured node/edge data +— not the diagram *text* dbterd's other targets emit. dbterd ≥ 1.28 ships a +**built-in, schema-validated `json` target** that emits `{nodes, edges, +metadata}`; `build_erd(target="json")` forces it, and `build_erd_data` maps that +into the SPA's `{nodes, edges}`. Do **not** reintroduce a custom +`@register_target("json")` adapter — dbterd owns this contract now. Two dbterd +quirks `build_erd_data` patches (verify after any dbterd bump with +`task frontend:e2e`): + +1. **Short-name edge ids.** With `entity_name_format` configured, dbterd emits + edge `from_id`/`to_id` as the *formatted entity name* (e.g. `orders`), not the + full unique_id (e.g. `model.jaffle_shop.orders`). `_resolve_edge_id` resolves + those back through a `name_to_id` map (built from each node's `name`) so the + SPA's `source`/`target` always reference a valid node `id`. An id already in + `node_ids` passes through untouched (the no-`entity_name_format` case). +2. **Missing FK flags.** Some algos (e.g. `model_contract`) don't set + `is_foreign_key` on node columns even when those columns appear in FK edges. + `_backfill_fk_flags` sets `is_foreign_key=True` on any column named in an + edge's `from_columns` (the FK/child side), indexed by node id so it's O(1) per + column per edge. + +**SPA edge direction:** `source` = the referenced/parent side (dbterd `to_id`), +`target` = the FK/child side (dbterd `from_id`). The graph bundle's per-column +connector handles (`buildErdFlow` in `frontend/src/lib/data.ts`) resolve each +handle against whichever endpoint actually owns the named column (`owned(...)`), +so a join whose FK/PK columns differ in name still lands on the right rows. + +### Example + +```python +# dbdocs/extract/erd.py — official {nodes, edges}; resolve short names + back-fill FK flags +payload = json.loads(erd.get_erd()) +raw_nodes = payload.get("nodes", []) +nodes = [_build_node(n) for n in raw_nodes] +node_ids = {n["id"] for n in nodes} +name_to_id = {n.get("name"): n["id"] for n in raw_nodes if n.get("name")} +edges = [_build_edge(e, i, node_ids, name_to_id) for i, e in enumerate(payload.get("edges", []))] +_backfill_fk_flags(nodes, edges) +return {"nodes": nodes, "edges": edges} +``` + +- `dbdocs/extract/erd.py` — `def build_erd` (forces `target="json"`), `def build_erd_data`, `def _build_node`, `def _build_edge`, `def _resolve_edge_id`, `def _backfill_fk_flags` +- `frontend/src/lib/data.ts` — `buildErdFlow` (consumes `source`/`target`/`from_columns`/`to_columns`/`is_foreign_key`; `owned()` picks the handle column each endpoint owns) +- `pyproject.toml` — `dbterd>=1.28` (the built-in `json` target floor) + ## Bundled SPA directory resolution ### Theory diff --git a/.claude/skills/spa-site/SKILL.md b/.claude/skills/spa-site/SKILL.md index c9230b8..94b026a 100644 --- a/.claude/skills/spa-site/SKILL.md +++ b/.claude/skills/spa-site/SKILL.md @@ -95,10 +95,9 @@ SPA loads (via `data.js`, which fetches `dbdocs-data.json.gz` and exposes it on entities with their columns (`is_primary_key` / `is_foreign_key` flags), `edges` are foreign-key relationships — all keyed by dbt `unique_id`. Built by `dbdocs/extract/erd.py` (`build_erd` / `build_erd_data`), which runs dbterd's - `json` target — a custom `@register_target("json")` adapter in - `dbdocs/extract/erd_json.py` that emits `{tables, relationships}`. The React - Flow bundle derives all three graph surfaces (full DAG, global ERD, per-node - ERD) from `lineage` + `erd`. + built-in `json` target (dbterd ≥ 1.28.0; emits `{nodes, edges, metadata}`). + The React Flow bundle derives all three graph surfaces (full DAG, global ERD, + per-node ERD) from `lineage` + `erd`. ## Payload (external gzip — `dbdocs/site/inject.py` + `builder.generate`) diff --git a/dbdocs/extract/erd.py b/dbdocs/extract/erd.py index 5ae19f9..fecb679 100644 --- a/dbdocs/extract/erd.py +++ b/dbdocs/extract/erd.py @@ -1,19 +1,21 @@ -"""Structured ERD data via dbterd's ``json`` target. - -dbterd's built-in targets emit diagram text; the SPA renders its ERD with React -Flow, which needs structured node/edge data. We register a ``json`` target -(:mod:`dbdocs.extract.erd_json`) and parse its ``{tables, relationships}`` output -into the SPA's ``{nodes, edges}`` — entities with columns (PK/FK flags) and -foreign-key edges between them, all keyed by dbt unique_id. +"""Structured ERD data via dbterd's official ``json`` target. + +dbterd 1.28.0 ships a built-in, schema-validated ``json`` target that emits +``{nodes, edges, metadata}``. Each node carries ``id`` (the dbt unique_id), +``name``, ``schema_name``, ``database``, ``resource_type``, and ``columns`` +(with ``data_type``, ``is_primary_key``, ``is_foreign_key``). Each edge carries +``id``, ``from_id`` (FK/child side), ``to_id`` (referenced/parent side), +``from_columns``, ``to_columns``, ``label``, and ``cardinality``. + +``build_erd_data`` maps that shape into the SPA's ``{nodes, edges}`` — the +React Flow bundle reads ``nodes`` (entities + column flags) and ``edges`` +(FK relationships, ``source``/``target`` keyed by dbt unique_id). """ import json from dbterd.api import DbtErd, default -# Importing the module registers the "json" target with dbterd's PluginRegistry. -from dbdocs.extract import erd_json # noqa: F401 - def erd_algo(dbterd_options: "dict | None" = None) -> str: """The dbterd algorithm that detected the ERD relationships. @@ -46,66 +48,103 @@ def build_erd(dbterd_options: "dict | None" = None, artifacts_dir: "str | None" def build_erd_data(erd: DbtErd) -> dict: - """Parse the json target into ``{"nodes": [...], "edges": [...]}``. - - Nodes are entities (with columns, ``is_primary_key``/``is_foreign_key`` flags - and the resolved dbt unique_id); edges are foreign-key relationships between - them. dbterd's relationships reference tables by *name*, so we map those back - to unique_ids via each table's ``node_name``. + """Parse dbterd's official ``{nodes, edges}`` payload into the SPA shape. + + dbterd's ``json`` target emits nodes keyed by dbt unique_id (``id`` field). + When ``entity_name_format`` is configured, dbterd emits edge ``from_id`` / + ``to_id`` as the formatted entity name (e.g. ``orders``) rather than the + full unique_id (e.g. ``model.jaffle_shop.orders``). A ``name_to_id`` map + resolves those short names back to the node id before building edges, so the + SPA's ``source``/``target`` always reference a valid node ``id``. + + Some dbterd algos (e.g. ``model_contract``) do not set ``is_foreign_key`` + on node columns even when those columns appear in FK edges. After building + edges, any column named in an edge's ``from_columns`` (the FK/child side) + has its ``is_foreign_key`` flag back-filled to ``True`` on the target node. + + SPA edge direction: ``source`` is the referenced (parent) side, ``target`` + is the FK (child) side — matching dbterd's ``to_id`` and ``from_id`` + respectively. """ payload = json.loads(erd.get_erd()) - tables = payload.get("tables", []) - relationships = payload.get("relationships", []) - - # table name (as dbterd refers to it in relationships) → dbt unique_id. - name_to_id = {t["name"]: (t.get("node_name") or t["name"]) for t in tables} - - edges, fk_columns = _build_edges(relationships, name_to_id) - nodes = [_build_node(t, fk_columns.get(t.get("node_name") or t["name"], set())) for t in tables] + raw_nodes = payload.get("nodes", []) + raw_edges = payload.get("edges", []) + nodes = [_build_node(n) for n in raw_nodes] + node_ids = {n["id"] for n in nodes} + # Count occurrences first; ambiguous names (more than one node) are excluded + # so a collision can't silently resolve to the wrong node. + name_counts: dict[str, int] = {} + for n in raw_nodes: + nm = n.get("name") + if nm: + name_counts[nm] = name_counts.get(nm, 0) + 1 + name_to_id = { + n.get("name"): n["id"] + for n in raw_nodes + if n.get("name") and name_counts[n.get("name")] == 1 + } + edges = [_build_edge(e, i, node_ids, name_to_id) for i, e in enumerate(raw_edges)] + _backfill_fk_flags(nodes, edges) return {"nodes": nodes, "edges": edges} -def _build_edges(relationships: list, name_to_id: dict) -> "tuple[list, dict]": - """Map relationships → edges and collect each node's FK column names.""" - edges = [] - fk_columns: dict = {} - for index, rel in enumerate(relationships): - parent_name, child_name = rel["table_map"] - parent_cols, child_cols = rel["column_map"] - source = name_to_id.get(parent_name, parent_name) - target = name_to_id.get(child_name, child_name) - # The child side holds the foreign key columns. - fk_columns.setdefault(target, set()).update(child_cols) - edges.append( - { - "id": rel.get("name") or f"e{index}", - "source": source, - "target": target, - "from_columns": list(parent_cols), - "to_columns": list(child_cols), - "label": rel.get("relationship_label"), - "type": rel.get("type", ""), - } - ) - return edges, fk_columns - +def _backfill_fk_flags(nodes: "list[dict]", edges: "list[dict]") -> None: + """Set is_foreign_key=True on columns named in each edge's from_columns. -def _build_node(table: dict, fk_cols: set) -> dict: - node_id = table.get("node_name") or table["name"] + Keyed by node id so the lookup is O(1) per column per edge. + """ + nodes_by_id = {n["id"]: n for n in nodes} + for edge in edges: + target_node = nodes_by_id.get(edge["target"]) + if target_node is None: + continue + fk_cols = {c.lower() for c in edge.get("from_columns", [])} + if not fk_cols: + continue + for col in target_node["columns"]: + if col["name"].lower() in fk_cols: + col["is_foreign_key"] = True + + +def _build_node(node: dict) -> dict: return { - "id": node_id, - "label": table["name"], - "database": table.get("database") or "", - "schema": table.get("schema") or "", - "resource_type": table.get("resource_type") or "model", + "id": node["id"], + "label": node.get("name") or "", + "database": node.get("database") or "", + "schema": node.get("schema_name") or "", + "resource_type": node.get("resource_type") or "model", "columns": [ { "name": c["name"], "type": c.get("data_type") or "", "description": c.get("description") or "", "is_primary_key": bool(c.get("is_primary_key")), - "is_foreign_key": c["name"] in fk_cols, + "is_foreign_key": bool(c.get("is_foreign_key")), } - for c in table.get("columns", []) + for c in node.get("columns", []) ], } + + +def _resolve_edge_id(raw: str, node_ids: "set[str]", name_to_id: "dict[str, str]") -> str: + # If raw is already a valid node id, keep it (the no-entity_name_format case). + # Otherwise resolve through the name→id map built from node labels. + if raw in node_ids: + return raw + return name_to_id.get(raw, raw) + + +def _build_edge(edge: dict, index: int, node_ids: "set[str]", name_to_id: "dict[str, str]") -> dict: + # from_id is the FK/child side; to_id is the referenced/parent side. + # SPA convention: source = parent (to_id), target = child (from_id). + raw_from = edge.get("from_id") or "" + raw_to = edge.get("to_id") or "" + return { + "id": edge.get("id") or f"e{index}", + "source": _resolve_edge_id(raw_to, node_ids, name_to_id), + "target": _resolve_edge_id(raw_from, node_ids, name_to_id), + "from_columns": edge.get("from_columns") or [], + "to_columns": edge.get("to_columns") or [], + "label": edge.get("label") or "", + "type": edge.get("cardinality") or "", + } diff --git a/dbdocs/extract/erd_json.py b/dbdocs/extract/erd_json.py deleted file mode 100644 index d9ccfba..0000000 --- a/dbdocs/extract/erd_json.py +++ /dev/null @@ -1,80 +0,0 @@ -"""A dbterd ``json`` target adapter: structured tables + relationships. - -dbterd's built-in targets emit diagram *text* (Mermaid, DBML, …). The dbdocs SPA -renders its ERD with React Flow, which needs structured node/edge data, not a -diagram string. Registering this adapter makes ``DbtErd(target="json").get_erd()`` -return a JSON document of ``{tables, relationships}`` that ``erd.build_erd_data`` -turns into the SPA's ``{nodes, edges}``. - -The ``Table``/``Column``/``Ref`` → dict serializers are pure and tested in -isolation; the adapter is the thin dbterd-contract shell over them. -""" - -import json -from typing import Any - -from dbterd.core.adapters.target import BaseTargetAdapter -from dbterd.core.models import Column, Ref, Table -from dbterd.core.registry.decorators import register_target - - -def column_to_dict(column: Column) -> dict: - """A dbterd ``Column`` as a plain dict (name, type, description, PK flag).""" - return { - "name": column.name, - "data_type": column.data_type, - "description": column.description, - "is_primary_key": bool(getattr(column, "is_primary_key", False)), - } - - -def table_to_dict(table: Table) -> dict: - """A dbterd ``Table`` as a plain dict, keyed for ERD rendering.""" - return { - "name": table.name, - "database": table.database, - "schema": table.schema, - "resource_type": table.resource_type, - "node_name": table.node_name, - "raw_sql": table.raw_sql, - "description": table.description, - "label": table.label, - "columns": [column_to_dict(c) for c in (table.columns or [])], - } - - -def relationship_to_dict(ref: Ref) -> dict: - """A dbterd ``Ref`` as a plain dict: endpoints + the joined columns.""" - parent, child = ref.table_map - parent_cols, child_cols = ref.column_map - return { - "name": ref.name, - "type": ref.type, - "table_map": [parent, child], - "column_map": [list(parent_cols), list(child_cols)], - "relationship_label": getattr(ref, "relationship_label", None), - } - - -@register_target("json", description="Structured JSON of tables and relationships") -class JsonAdapter(BaseTargetAdapter): - """Emit dbterd tables + relationships as one structured JSON document.""" - - file_extension = ".json" - default_filename = "output.json" - - def build_erd(self, tables: list, relationships: list, **kwargs: Any) -> str: - payload = { - "tables": [table_to_dict(t) for t in tables], - "relationships": [relationship_to_dict(r) for r in relationships], - } - return json.dumps(payload) - - def format_table(self, table: Table, **kwargs: Any) -> str: - return json.dumps(table_to_dict(table)) - - def format_relationship(self, relationship: Ref, **kwargs: Any) -> str: - return json.dumps(relationship_to_dict(relationship)) - - def get_rel_symbol(self, relationship_type: str) -> str: - return "" diff --git a/dbdocs/site/bundle/assets/graph/index.js b/dbdocs/site/bundle/assets/graph/index.js index 2eec9aa..f5948a6 100644 --- a/dbdocs/site/bundle/assets/graph/index.js +++ b/dbdocs/site/bundle/assets/graph/index.js @@ -22,7 +22,7 @@ var sP=Object.defineProperty;var lP=(zt,_t,Ot)=>_t in zt?sP(zt,_t,{enumerable:!0 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(M,N){var P=M.length;M.push(N);e:for(;0>>1,O=M[A];if(0>>1;Ao(X,P))qo(Q,X)?(M[A]=Q,M[q]=P,A=q):(M[A]=X,M[B]=P,A=B);else if(qo(Q,P))M[A]=Q,M[q]=P,A=q;else break e}}return N}function o(M,N){var P=M.sortIndex-N.sortIndex;return P!==0?P:M.id-N.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=[],c=1,f=null,d=3,g=!1,m=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(M){for(var N=n(a);N!==null;){if(N.callback===null)r(a);else if(N.startTime<=M)r(a),N.sortIndex=N.expirationTime,t(u,N);else break;N=n(a)}}function v(M){if(w=!1,h(M),!m)if(n(u)!==null)m=!0,L(E);else{var N=n(a);N!==null&&z(v,N.startTime-M)}}function E(M,N){m=!1,w&&(w=!1,p(C),C=-1),g=!0;var P=d;try{for(h(N),f=n(u);f!==null&&(!(f.expirationTime>N)||M&&!T());){var A=f.callback;if(typeof A=="function"){f.callback=null,d=f.priorityLevel;var O=A(f.expirationTime<=N);N=e.unstable_now(),typeof O=="function"?f.callback=O:f===n(u)&&r(u),h(N)}else r(u);f=n(u)}if(f!==null)var U=!0;else{var B=n(a);B!==null&&z(v,B.startTime-N),U=!1}return U}finally{f=null,d=P,g=!1}}var _=!1,k=null,C=-1,b=5,j=-1;function T(){return!(e.unstable_now()-jM||125A?(M.sortIndex=P,t(a,M),n(u)===null&&M===n(a)&&(w?(p(C),C=-1):w=!0,z(v,P-A))):(M.sortIndex=O,t(u,M),m||g||(m=!0,L(E))),M},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(M){var N=d;return function(){var P=d;d=N;try{return M.apply(this,arguments)}finally{d=P}}}})(zc),$c.exports=zc;var oy=$c.exports;/** + */(function(e){function t(M,N){var P=M.length;M.push(N);e:for(;0>>1,O=M[A];if(0>>1;Ao(X,P))qo(Q,X)?(M[A]=Q,M[q]=P,A=q):(M[A]=X,M[B]=P,A=B);else if(qo(Q,P))M[A]=Q,M[q]=P,A=q;else break e}}return N}function o(M,N){var P=M.sortIndex-N.sortIndex;return P!==0?P:M.id-N.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=[],f=1,c=null,d=3,g=!1,m=!1,w=!1,x=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(M){for(var N=n(a);N!==null;){if(N.callback===null)r(a);else if(N.startTime<=M)r(a),N.sortIndex=N.expirationTime,t(u,N);else break;N=n(a)}}function v(M){if(w=!1,h(M),!m)if(n(u)!==null)m=!0,L(E);else{var N=n(a);N!==null&&z(v,N.startTime-M)}}function E(M,N){m=!1,w&&(w=!1,p(C),C=-1),g=!0;var P=d;try{for(h(N),c=n(u);c!==null&&(!(c.expirationTime>N)||M&&!T());){var A=c.callback;if(typeof A=="function"){c.callback=null,d=c.priorityLevel;var O=A(c.expirationTime<=N);N=e.unstable_now(),typeof O=="function"?c.callback=O:c===n(u)&&r(u),h(N)}else r(u);c=n(u)}if(c!==null)var U=!0;else{var B=n(a);B!==null&&z(v,B.startTime-N),U=!1}return U}finally{c=null,d=P,g=!1}}var _=!1,k=null,C=-1,b=5,j=-1;function T(){return!(e.unstable_now()-jM||125A?(M.sortIndex=P,t(a,M),n(u)===null&&M===n(a)&&(w?(p(C),C=-1):w=!0,z(v,P-A))):(M.sortIndex=O,t(u,M),m||g||(m=!0,L(E))),M},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(M){var N=d;return function(){var P=d;d=N;try{return M.apply(this,arguments)}finally{d=P}}}})(zc),$c.exports=zc;var oy=$c.exports;/** * @license React * react-dom.production.min.js * @@ -34,10 +34,10 @@ var sP=Object.defineProperty;var lP=(zt,_t,Ot)=>_t in zt?sP(zt,_t,{enumerable:!0 `+vl+e}var wl=!1;function xl(e,t){if(!e||wl)return"";wl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(a){var r=a}Reflect.construct(e,[],t)}else{try{t.call()}catch(a){r=a}e.call(t.prototype)}else{try{throw Error()}catch(a){r=a}e()}}catch(a){if(a&&r&&typeof a.stack=="string"){for(var o=a.stack.split(` `),i=r.stack.split(` `),s=o.length-1,l=i.length-1;1<=s&&0<=l&&o[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(o[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||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{wl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wr(e):""}function cy(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=xl(e.type,!1),e;case 11:return e=xl(e.type.render,!1),e;case 1:return e=xl(e.type,!0),e;default:return""}}function El(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 nr:return"Fragment";case tr:return"Portal";case hl:return"Profiler";case dl:return"StrictMode";case gl:return"Suspense";case ml:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jc:return(e.displayName||"Context")+".Consumer";case Dc:return(e._context.displayName||"Context")+".Provider";case pl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yl:return t=e.displayName||null,t!==null?t:El(e.type)||"Memo";case en:t=e._payload,e=e._init;try{return El(e(t))}catch{}}return null}function fy(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 El(t);case 8:return t===dl?"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 tn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dy(e){var t=Hc(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 oi(e){e._valueTracker||(e._valueTracker=dy(e))}function Bc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Hc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ii(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 _l(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Uc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=tn(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 Wc(e,t){t=t.checked,t!=null&&fl(e,"checked",t,!1)}function Sl(e,t){Wc(e,t);var n=tn(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,tn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yc(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"||ii(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=si.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gr={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},hy=["Webkit","ms","Moz","O"];Object.keys(Gr).forEach(function(e){hy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gr[t]=Gr[e]})});function qc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Gr.hasOwnProperty(e)&&Gr[e]?(""+t).trim():t+"px"}function Jc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=qc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var py=pe({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 Ml(e,t){if(t){if(py[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(H(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(H(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(H(61))}if(t.style!=null&&typeof t.style!="object")throw Error(H(62))}}function Il(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 Pl=null;function Ll(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tl=null,or=null,ir=null;function ef(e){if(e=yo(e)){if(typeof Tl!="function")throw Error(H(280));var t=e.stateNode;t&&(t=Pi(t),Tl(e.stateNode,e.type,t))}}function tf(e){or?ir?ir.push(e):ir=[e]:or=e}function nf(){if(or){var e=or,t=ir;if(ir=or=null,ef(e),t)for(e=0;e>>=0,e===0?32:31-(Ny(e)/Cy|0)|0}var fi=64,di=4194304;function qr(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 hi(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=qr(l):(i&=s,i!==0&&(r=qr(i)))}else s=n&~o,s!==0?r=qr(s):i!==0&&(r=qr(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 Jr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-lt(t),e[t]=n}function Ly(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=lo),Tf=" ",bf=!1;function $f(e,t){switch(e){case"keyup":return ov.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ur=!1;function sv(e,t){switch(e){case"compositionend":return zf(t);case"keypress":return t.which!==32?null:(bf=!0,Tf);case"textInput":return e=t.data,e===Tf&&bf?null:e;default:return null}}function lv(e,t){if(ur)return e==="compositionend"||!Ql&&$f(e,t)?(e=Nf(),vi=Bl=ln=null,ur=!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=Vf(n)}}function Bf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uf(){for(var e=window,t=ii();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ii(e.document)}return t}function ql(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 mv(e){var t=Uf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bf(n.ownerDocument.documentElement,n)){if(r!==null&&ql(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=Hf(n,i);var s=Hf(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,ar=null,Jl=null,fo=null,eu=!1;function Wf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;eu||ar==null||ar!==ii(r)||(r=ar,"selectionStart"in r&&ql(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}),fo&&co(fo,r)||(fo=r,r=Ci(Jl,"onSelect"),0pr||(e.current=du[pr],du[pr]=null,pr--)}function ue(e,t){pr++,du[pr]=e.current,e.current=t}var fn={},Te=cn(fn),je=cn(!1),In=fn;function gr(e,t){var n=e.type.contextTypes;if(!n)return fn;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 Fe(e){return e=e.childContextTypes,e!=null}function Li(){ce(je),ce(Te)}function sd(e,t,n){if(Te.current!==fn)throw Error(H(168));ue(Te,t),ue(je,n)}function ld(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(H(108,fy(e)||"Unknown",o));return pe({},n,r)}function Ti(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fn,In=Te.current,ue(Te,e),ue(je,je.current),!0}function ud(e,t,n){var r=e.stateNode;if(!r)throw Error(H(169));n?(e=ld(e,t,In),r.__reactInternalMemoizedMergedChildContext=e,ce(je),ce(Te),ue(Te,e)):ce(je),ue(je,n)}var jt=null,bi=!1,hu=!1;function ad(e){jt===null?jt=[e]:jt.push(e)}function Iv(e){bi=!0,ad(e)}function dn(){if(!hu&&jt!==null){hu=!0;var e=0,t=se;try{var n=jt;for(se=1;e>=s,o-=s,Ft=1<<32-lt(t)+o|n<C?(b=k,k=null):b=k.sibling;var j=d(p,k,h[C],v);if(j===null){k===null&&(k=b);break}e&&k&&j.alternate===null&&t(p,k),y=i(j,y,C),_===null?E=j:_.sibling=j,_=j,k=b}if(C===h.length)return n(p,k),fe&&Ln(p,C),E;if(k===null){for(;CC?(b=k,k=null):b=k.sibling;var T=d(p,k,j.value,v);if(T===null){k===null&&(k=b);break}e&&k&&T.alternate===null&&t(p,k),y=i(T,y,C),_===null?E=T:_.sibling=T,_=T,k=b}if(j.done)return n(p,k),fe&&Ln(p,C),E;if(k===null){for(;!j.done;C++,j=h.next())j=f(p,j.value,v),j!==null&&(y=i(j,y,C),_===null?E=j:_.sibling=j,_=j);return fe&&Ln(p,C),E}for(k=r(p,k);!j.done;C++,j=h.next())j=g(k,p,C,j.value,v),j!==null&&(e&&j.alternate!==null&&k.delete(j.key===null?C:j.key),y=i(j,y,C),_===null?E=j:_.sibling=j,_=j);return e&&k.forEach(function(R){return t(p,R)}),fe&&Ln(p,C),E}function x(p,y,h,v){if(typeof h=="object"&&h!==null&&h.type===nr&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case ri:e:{for(var E=h.key,_=y;_!==null;){if(_.key===E){if(E=h.type,E===nr){if(_.tag===7){n(p,_.sibling),y=o(_,h.props.children),y.return=p,p=y;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===en&&gd(E)===_.type){n(p,_.sibling),y=o(_,h.props),y.ref=vo(p,_,h),y.return=p,p=y;break e}n(p,_);break}else t(p,_);_=_.sibling}h.type===nr?(y=Dn(h.props.children,p.mode,v,h.key),y.return=p,p=y):(v=ss(h.type,h.key,h.props,null,p.mode,v),v.ref=vo(p,y,h),v.return=p,p=v)}return s(p);case tr:e:{for(_=h.key;y!==null;){if(y.key===_)if(y.tag===4&&y.stateNode.containerInfo===h.containerInfo&&y.stateNode.implementation===h.implementation){n(p,y.sibling),y=o(y,h.children||[]),y.return=p,p=y;break e}else{n(p,y);break}else t(p,y);y=y.sibling}y=ca(h,p.mode,v),y.return=p,p=y}return s(p);case en:return _=h._init,x(p,y,_(h._payload),v)}if(Yr(h))return m(p,y,h,v);if(Ur(h))return w(p,y,h,v);Ri(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,y!==null&&y.tag===6?(n(p,y.sibling),y=o(y,h),y.return=p,p=y):(n(p,y),y=aa(h,p.mode,v),y.return=p,p=y),s(p)):n(p,y)}return x}var wr=md(!0),yd=md(!1),Ai=cn(null),Di=null,xr=null,wu=null;function xu(){wu=xr=Di=null}function Eu(e){var t=Ai.current;ce(Ai),e._currentValue=t}function _u(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 Er(e,t){Di=e,wu=xr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ve=!0),e.firstContext=null)}function tt(e){var t=e._currentValue;if(wu!==e)if(e={context:e,memoizedValue:t,next:null},xr===null){if(Di===null)throw Error(H(308));xr=e,Di.dependencies={lanes:0,firstContext:e}}else xr=xr.next=e;return t}var Tn=null;function Su(e){Tn===null?Tn=[e]:Tn.push(e)}function vd(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Su(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ht(e,r)}function Ht(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 hn=!1;function ku(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function wd(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 Bt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,oe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ht(e,n)}return o=r.interleaved,o===null?(t.next=t,Su(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ht(e,n)}function ji(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,Dl(e,n)}}function xd(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 Fi(e,t,n,r){var o=e.updateQueue;hn=!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 c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==s&&(l===null?c.firstBaseUpdate=a:l.next=a,c.lastBaseUpdate=u))}if(i!==null){var f=o.baseState;s=0,c=a=u=null,l=i;do{var d=l.lane,g=l.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,w=l;switch(d=t,g=n,w.tag){case 1:if(m=w.payload,typeof m=="function"){f=m.call(g,f,d);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=w.payload,d=typeof m=="function"?m.call(g,f,d):m,d==null)break e;f=pe({},f,d);break e;case 2:hn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=o.effects,d===null?o.effects=[l]:d.push(l))}else g={eventTime:g,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(a=c=g,u=f):c=c.next=g,s|=d;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;d=l,l=d.next,d.next=null,o.lastBaseUpdate=d,o.shared.pending=null}}while(!0);if(c===null&&(u=f),o.baseState=u,o.firstBaseUpdate=a,o.lastBaseUpdate=c,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);zn|=s,e.lanes=s,e.memoizedState=f}}function Ed(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Pu.transition;Pu.transition={};try{e(!1),t()}finally{se=n,Pu.transition=r}}function Fd(){return nt().memoizedState}function bv(e,t,n){var r=vn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vd(e))Hd(t,n);else if(n=vd(e,t,n,r),n!==null){var o=De();ht(n,e,r,o),Bd(n,t,r)}}function $v(e,t,n){var r=vn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vd(e))Hd(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,ut(l,s)){var u=t.interleaved;u===null?(o.next=o,Su(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=vd(e,t,o,r),n!==null&&(o=De(),ht(n,e,r,o),Bd(n,t,r))}}function Vd(e){var t=e.alternate;return e===me||t!==null&&t===me}function Hd(e,t){_o=Bi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dl(e,n)}}var Yi={readContext:tt,useCallback:be,useContext:be,useEffect:be,useImperativeHandle:be,useInsertionEffect:be,useLayoutEffect:be,useMemo:be,useReducer:be,useRef:be,useState:be,useDebugValue:be,useDeferredValue:be,useTransition:be,useMutableSource:be,useSyncExternalStore:be,useId:be,unstable_isNewReconciler:!1},zv={readContext:tt,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:tt,useEffect:bd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ui(4194308,4,Od.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ui(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ui(4,2,e,t)},useMemo:function(e,t){var n=Ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ct();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=bv.bind(null,me,e),[r.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:Ld,useDebugValue:Ru,useDeferredValue:function(e){return Ct().memoizedState=e},useTransition:function(){var e=Ld(!1),t=e[0];return e=Tv.bind(null,e[1]),Ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=me,o=Ct();if(fe){if(n===void 0)throw Error(H(407));n=n()}else{if(n=t(),Me===null)throw Error(H(349));$n&30||Nd(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,bd(Md.bind(null,r,i,e),[e]),r.flags|=2048,No(9,Cd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ct(),t=Me.identifierPrefix;if(fe){var n=Vt,r=Ft;n=(r&~(1<<32-lt(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{wl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Wr(e):""}function cy(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=xl(e.type,!1),e;case 11:return e=xl(e.type.render,!1),e;case 1:return e=xl(e.type,!0),e;default:return""}}function El(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 nr:return"Fragment";case tr:return"Portal";case hl:return"Profiler";case dl:return"StrictMode";case gl:return"Suspense";case ml:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jc:return(e.displayName||"Context")+".Consumer";case Dc:return(e._context.displayName||"Context")+".Provider";case pl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yl:return t=e.displayName||null,t!==null?t:El(e.type)||"Memo";case en:t=e._payload,e=e._init;try{return El(e(t))}catch{}}return null}function fy(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 El(t);case 8:return t===dl?"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 tn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dy(e){var t=Hc(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 oi(e){e._valueTracker||(e._valueTracker=dy(e))}function Bc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Hc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ii(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 _l(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Uc(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=tn(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 Wc(e,t){t=t.checked,t!=null&&fl(e,"checked",t,!1)}function Sl(e,t){Wc(e,t);var n=tn(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,tn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Yc(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"||ii(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=si.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gr={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},hy=["Webkit","ms","Moz","O"];Object.keys(Gr).forEach(function(e){hy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gr[t]=Gr[e]})});function qc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Gr.hasOwnProperty(e)&&Gr[e]?(""+t).trim():t+"px"}function Jc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=qc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var py=pe({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 Ml(e,t){if(t){if(py[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(H(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(H(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(H(61))}if(t.style!=null&&typeof t.style!="object")throw Error(H(62))}}function Il(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 Pl=null;function Ll(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tl=null,or=null,ir=null;function ef(e){if(e=yo(e)){if(typeof Tl!="function")throw Error(H(280));var t=e.stateNode;t&&(t=Pi(t),Tl(e.stateNode,e.type,t))}}function tf(e){or?ir?ir.push(e):ir=[e]:or=e}function nf(){if(or){var e=or,t=ir;if(ir=or=null,ef(e),t)for(e=0;e>>=0,e===0?32:31-(Ny(e)/Cy|0)|0}var fi=64,di=4194304;function qr(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 hi(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=qr(l):(i&=s,i!==0&&(r=qr(i)))}else s=n&~o,s!==0?r=qr(s):i!==0&&(r=qr(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 Jr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-lt(t),e[t]=n}function Ly(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=lo),Tf=" ",bf=!1;function $f(e,t){switch(e){case"keyup":return ov.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ur=!1;function sv(e,t){switch(e){case"compositionend":return zf(t);case"keypress":return t.which!==32?null:(bf=!0,Tf);case"textInput":return e=t.data,e===Tf&&bf?null:e;default:return null}}function lv(e,t){if(ur)return e==="compositionend"||!Ql&&$f(e,t)?(e=Nf(),vi=Bl=ln=null,ur=!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=Vf(n)}}function Bf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Bf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uf(){for(var e=window,t=ii();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ii(e.document)}return t}function ql(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 mv(e){var t=Uf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Bf(n.ownerDocument.documentElement,n)){if(r!==null&&ql(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=Hf(n,i);var s=Hf(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,ar=null,Jl=null,fo=null,eu=!1;function Wf(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;eu||ar==null||ar!==ii(r)||(r=ar,"selectionStart"in r&&ql(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}),fo&&co(fo,r)||(fo=r,r=Ci(Jl,"onSelect"),0pr||(e.current=du[pr],du[pr]=null,pr--)}function ue(e,t){pr++,du[pr]=e.current,e.current=t}var fn={},Te=cn(fn),je=cn(!1),In=fn;function gr(e,t){var n=e.type.contextTypes;if(!n)return fn;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 Fe(e){return e=e.childContextTypes,e!=null}function Li(){ce(je),ce(Te)}function sd(e,t,n){if(Te.current!==fn)throw Error(H(168));ue(Te,t),ue(je,n)}function ld(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(H(108,fy(e)||"Unknown",o));return pe({},n,r)}function Ti(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fn,In=Te.current,ue(Te,e),ue(je,je.current),!0}function ud(e,t,n){var r=e.stateNode;if(!r)throw Error(H(169));n?(e=ld(e,t,In),r.__reactInternalMemoizedMergedChildContext=e,ce(je),ce(Te),ue(Te,e)):ce(je),ue(je,n)}var jt=null,bi=!1,hu=!1;function ad(e){jt===null?jt=[e]:jt.push(e)}function Iv(e){bi=!0,ad(e)}function dn(){if(!hu&&jt!==null){hu=!0;var e=0,t=se;try{var n=jt;for(se=1;e>=s,o-=s,Ft=1<<32-lt(t)+o|n<C?(b=k,k=null):b=k.sibling;var j=d(p,k,h[C],v);if(j===null){k===null&&(k=b);break}e&&k&&j.alternate===null&&t(p,k),y=i(j,y,C),_===null?E=j:_.sibling=j,_=j,k=b}if(C===h.length)return n(p,k),fe&&Ln(p,C),E;if(k===null){for(;CC?(b=k,k=null):b=k.sibling;var T=d(p,k,j.value,v);if(T===null){k===null&&(k=b);break}e&&k&&T.alternate===null&&t(p,k),y=i(T,y,C),_===null?E=T:_.sibling=T,_=T,k=b}if(j.done)return n(p,k),fe&&Ln(p,C),E;if(k===null){for(;!j.done;C++,j=h.next())j=c(p,j.value,v),j!==null&&(y=i(j,y,C),_===null?E=j:_.sibling=j,_=j);return fe&&Ln(p,C),E}for(k=r(p,k);!j.done;C++,j=h.next())j=g(k,p,C,j.value,v),j!==null&&(e&&j.alternate!==null&&k.delete(j.key===null?C:j.key),y=i(j,y,C),_===null?E=j:_.sibling=j,_=j);return e&&k.forEach(function(R){return t(p,R)}),fe&&Ln(p,C),E}function x(p,y,h,v){if(typeof h=="object"&&h!==null&&h.type===nr&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case ri:e:{for(var E=h.key,_=y;_!==null;){if(_.key===E){if(E=h.type,E===nr){if(_.tag===7){n(p,_.sibling),y=o(_,h.props.children),y.return=p,p=y;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===en&&gd(E)===_.type){n(p,_.sibling),y=o(_,h.props),y.ref=vo(p,_,h),y.return=p,p=y;break e}n(p,_);break}else t(p,_);_=_.sibling}h.type===nr?(y=Dn(h.props.children,p.mode,v,h.key),y.return=p,p=y):(v=ss(h.type,h.key,h.props,null,p.mode,v),v.ref=vo(p,y,h),v.return=p,p=v)}return s(p);case tr:e:{for(_=h.key;y!==null;){if(y.key===_)if(y.tag===4&&y.stateNode.containerInfo===h.containerInfo&&y.stateNode.implementation===h.implementation){n(p,y.sibling),y=o(y,h.children||[]),y.return=p,p=y;break e}else{n(p,y);break}else t(p,y);y=y.sibling}y=ca(h,p.mode,v),y.return=p,p=y}return s(p);case en:return _=h._init,x(p,y,_(h._payload),v)}if(Yr(h))return m(p,y,h,v);if(Ur(h))return w(p,y,h,v);Ri(p,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,y!==null&&y.tag===6?(n(p,y.sibling),y=o(y,h),y.return=p,p=y):(n(p,y),y=aa(h,p.mode,v),y.return=p,p=y),s(p)):n(p,y)}return x}var wr=md(!0),yd=md(!1),Ai=cn(null),Di=null,xr=null,wu=null;function xu(){wu=xr=Di=null}function Eu(e){var t=Ai.current;ce(Ai),e._currentValue=t}function _u(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 Er(e,t){Di=e,wu=xr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ve=!0),e.firstContext=null)}function tt(e){var t=e._currentValue;if(wu!==e)if(e={context:e,memoizedValue:t,next:null},xr===null){if(Di===null)throw Error(H(308));xr=e,Di.dependencies={lanes:0,firstContext:e}}else xr=xr.next=e;return t}var Tn=null;function Su(e){Tn===null?Tn=[e]:Tn.push(e)}function vd(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Su(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ht(e,r)}function Ht(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 hn=!1;function ku(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function wd(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 Bt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function pn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,oe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ht(e,n)}return o=r.interleaved,o===null?(t.next=t,Su(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ht(e,n)}function ji(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,Dl(e,n)}}function xd(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 Fi(e,t,n,r){var o=e.updateQueue;hn=!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 f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==s&&(l===null?f.firstBaseUpdate=a:l.next=a,f.lastBaseUpdate=u))}if(i!==null){var c=o.baseState;s=0,f=a=u=null,l=i;do{var d=l.lane,g=l.eventTime;if((r&d)===d){f!==null&&(f=f.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,w=l;switch(d=t,g=n,w.tag){case 1:if(m=w.payload,typeof m=="function"){c=m.call(g,c,d);break e}c=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=w.payload,d=typeof m=="function"?m.call(g,c,d):m,d==null)break e;c=pe({},c,d);break e;case 2:hn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=o.effects,d===null?o.effects=[l]:d.push(l))}else g={eventTime:g,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(a=f=g,u=c):f=f.next=g,s|=d;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;d=l,l=d.next,d.next=null,o.lastBaseUpdate=d,o.shared.pending=null}}while(!0);if(f===null&&(u=c),o.baseState=u,o.firstBaseUpdate=a,o.lastBaseUpdate=f,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);zn|=s,e.lanes=s,e.memoizedState=c}}function Ed(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Pu.transition;Pu.transition={};try{e(!1),t()}finally{se=n,Pu.transition=r}}function Fd(){return nt().memoizedState}function bv(e,t,n){var r=vn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vd(e))Hd(t,n);else if(n=vd(e,t,n,r),n!==null){var o=De();ht(n,e,r,o),Bd(n,t,r)}}function $v(e,t,n){var r=vn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vd(e))Hd(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,ut(l,s)){var u=t.interleaved;u===null?(o.next=o,Su(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=vd(e,t,o,r),n!==null&&(o=De(),ht(n,e,r,o),Bd(n,t,r))}}function Vd(e){var t=e.alternate;return e===me||t!==null&&t===me}function Hd(e,t){_o=Bi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dl(e,n)}}var Yi={readContext:tt,useCallback:be,useContext:be,useEffect:be,useImperativeHandle:be,useInsertionEffect:be,useLayoutEffect:be,useMemo:be,useReducer:be,useRef:be,useState:be,useDebugValue:be,useDeferredValue:be,useTransition:be,useMutableSource:be,useSyncExternalStore:be,useId:be,unstable_isNewReconciler:!1},zv={readContext:tt,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:tt,useEffect:bd,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ui(4194308,4,Od.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ui(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ui(4,2,e,t)},useMemo:function(e,t){var n=Ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ct();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=bv.bind(null,me,e),[r.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:Ld,useDebugValue:Ru,useDeferredValue:function(e){return Ct().memoizedState=e},useTransition:function(){var e=Ld(!1),t=e[0];return e=Tv.bind(null,e[1]),Ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=me,o=Ct();if(fe){if(n===void 0)throw Error(H(407));n=n()}else{if(n=t(),Me===null)throw Error(H(349));$n&30||Nd(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,bd(Md.bind(null,r,i,e),[e]),r.flags|=2048,No(9,Cd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ct(),t=Me.identifierPrefix;if(fe){var n=Vt,r=Ft;n=(r&~(1<<32-lt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=So++,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[kt]=t,e[mo]=r,ah(e,t,!1,!1),t.stateNode=e;e:{switch(s=Il(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;oCr&&(t.flags|=128,r=!0,Co(i,!1),t.lanes=4194304)}else{if(!r)if(e=Vi(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Co(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!fe)return $e(t),null}else 2*ve()-i.renderingStartTime>Cr&&n!==1073741824&&(t.flags|=128,r=!0,Co(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=ge.current,ue(ge,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return sa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(H(156,t.tag))}function Hv(e,t){switch(gu(t),t.tag){case 1:return Fe(t.type)&&Li(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _r(),ce(je),ce(Te),Iu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cu(t),null;case 13:if(ce(ge),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(H(340));vr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(ge),null;case 4:return _r(),null;case 10:return Eu(t.type._context),null;case 22:case 23:return sa(),null;case 24:return null;default:return null}}var Ki=!1,ze=!1,Bv=typeof WeakSet=="function"?WeakSet:Set,Y=null;function kr(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 Gu(e,t,n){try{n()}catch(r){ye(e,t,r)}}var dh=!1;function Uv(e,t){if(su=mi,e=Uf(),ql(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,c=0,f=e,d=null;t:for(;;){for(var g;f!==n||o!==0&&f.nodeType!==3||(l=s+o),f!==i||r!==0&&f.nodeType!==3||(u=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(g=f.firstChild)!==null;)d=f,f=g;for(;;){if(f===e)break t;if(d===n&&++a===o&&(l=s),d===i&&++c===r&&(u=s),(g=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=g}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(lu={focusedElem:e,selectionRange:n},mi=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var w=m.memoizedProps,x=m.memoizedState,p=t.stateNode,y=p.getSnapshotBeforeUpdate(t.elementType===t.type?w:ct(t.type,w),x);p.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(H(163))}}catch(v){ye(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return m=dh,dh=!1,m}function Mo(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&&Gu(t,n,i)}o=o.next}while(o!==r)}}function Zi(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 Qu(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 hh(e){var t=e.alternate;t!==null&&(e.alternate=null,hh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[mo],delete t[fu],delete t[Cv],delete t[Mv])),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 ph(e){return e.tag===5||e.tag===3||e.tag===4}function gh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ph(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 Ku(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=Ii));else if(r!==4&&(e=e.child,e!==null))for(Ku(e,t,n),e=e.sibling;e!==null;)Ku(e,t,n),e=e.sibling}function Zu(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(Zu(e,t,n),e=e.sibling;e!==null;)Zu(e,t,n),e=e.sibling}var Pe=null,ft=!1;function gn(e,t,n){for(n=n.child;n!==null;)mh(e,t,n),n=n.sibling}function mh(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(ci,n)}catch{}switch(n.tag){case 5:ze||kr(n,t);case 6:var r=Pe,o=ft;Pe=null,gn(e,t,n),Pe=r,ft=o,Pe!==null&&(ft?(e=Pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Pe.removeChild(n.stateNode));break;case 18:Pe!==null&&(ft?(e=Pe,n=n.stateNode,e.nodeType===8?cu(e.parentNode,n):e.nodeType===1&&cu(e,n),oo(e)):cu(Pe,n.stateNode));break;case 4:r=Pe,o=ft,Pe=n.stateNode.containerInfo,ft=!0,gn(e,t,n),Pe=r,ft=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)&&Gu(n,t,s),o=o.next}while(o!==r)}gn(e,t,n);break;case 1:if(!ze&&(kr(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)}gn(e,t,n);break;case 21:gn(e,t,n);break;case 22:n.mode&1?(ze=(r=ze)||n.memoizedState!==null,gn(e,t,n),ze=r):gn(e,t,n);break;default:gn(e,t,n)}}function yh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Bv),t.forEach(function(r){var o=Jv.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function dt(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*Yv(r/1960))-r,10e?16:e,yn===null)var r=!1;else{if(e=yn,yn=null,ns=0,oe&6)throw Error(H(331));var o=oe;for(oe|=4,Y=e.current;Y!==null;){var i=Y,s=i.child;if(Y.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uve()-ea?Rn(e,0):Ju|=n),Be(e,t)}function Lh(e,t){t===0&&(e.mode&1?(t=di,di<<=1,!(di&130023424)&&(di=4194304)):t=1);var n=De();e=Ht(e,t),e!==null&&(Jr(e,t,n),Be(e,n))}function qv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lh(e,n)}function Jv(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(H(314))}r!==null&&r.delete(t),Lh(e,n)}var Th;Th=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||je.current)Ve=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ve=!1,Fv(e,t,n);Ve=!!(e.flags&131072)}else Ve=!1,fe&&t.flags&1048576&&cd(t,zi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Qi(e,t),e=t.pendingProps;var o=gr(t,Te.current);Er(t,n),o=Tu(null,t,r,e,o,n);var i=bu();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,Fe(r)?(i=!0,Ti(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ku(t),o.updater=Xi,t.stateNode=o,o._reactInternals=t,Du(t,r,e,n),t=Hu(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&pu(t),Ae(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Qi(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=tw(r),e=ct(r,e),o){case 0:t=Vu(null,t,r,e,n);break e;case 1:t=rh(null,t,r,e,n);break e;case 11:t=qd(null,t,r,e,n);break e;case 14:t=Jd(null,t,r,ct(r.type,e),n);break e}throw Error(H(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),Vu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),rh(e,t,r,o,n);case 3:e:{if(oh(t),e===null)throw Error(H(387));r=t.pendingProps,i=t.memoizedState,o=i.element,wd(e,t),Fi(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=Sr(Error(H(423)),t),t=ih(e,t,r,n,o);break e}else if(r!==o){o=Sr(Error(H(424)),t),t=ih(e,t,r,n,o);break e}else for(Qe=an(t.stateNode.containerInfo.firstChild),Ge=t,fe=!0,at=null,n=yd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vr(),r===o){t=Ut(e,t,n);break e}Ae(e,t,r,n)}t=t.child}return t;case 5:return _d(t),e===null&&yu(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,uu(r,o)?s=null:i!==null&&uu(r,i)&&(t.flags|=32),nh(e,t),Ae(e,t,s,n),t.child;case 6:return e===null&&yu(t),null;case 13:return sh(e,t,n);case 4:return Nu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=wr(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:ct(r,o),qd(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,ue(Ai,r._currentValue),r._currentValue=s,i!==null)if(ut(i.value,s)){if(i.children===o.children&&!je.current){t=Ut(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=Bt(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var c=a.pending;c===null?u.next=u:(u.next=c.next,c.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),_u(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(H(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),_u(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,Er(t,n),o=tt(o),r=r(o),t.flags|=1,Ae(e,t,r,n),t.child;case 14:return r=t.type,o=ct(r,t.pendingProps),o=ct(r.type,o),Jd(e,t,r,o,n);case 15:return eh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),Qi(e,t),t.tag=1,Fe(r)?(e=!0,Ti(t)):e=!1,Er(t,n),Wd(t,r,o),Du(t,r,o,n),Hu(null,t,r,!0,e,n);case 19:return uh(e,t,n);case 22:return th(e,t,n)}throw Error(H(156,t.tag))};function bh(e,t){return ff(e,t)}function ew(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 ot(e,t,n,r){return new ew(e,t,n,r)}function ua(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tw(e){if(typeof e=="function")return ua(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pl)return 11;if(e===yl)return 14}return 2}function xn(e,t){var n=e.alternate;return n===null?(n=ot(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 ss(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")ua(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case nr:return Dn(n.children,o,i,t);case dl:s=8,o|=8;break;case hl:return e=ot(12,n,t,o|2),e.elementType=hl,e.lanes=i,e;case gl:return e=ot(13,n,t,o),e.elementType=gl,e.lanes=i,e;case ml:return e=ot(19,n,t,o),e.elementType=ml,e.lanes=i,e;case Fc:return ls(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dc:s=10;break e;case jc:s=9;break e;case pl:s=11;break e;case yl:s=14;break e;case en:s=16,r=null;break e}throw Error(H(130,e==null?e:typeof e,""))}return t=ot(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Dn(e,t,n,r){return e=ot(7,e,r,t),e.lanes=n,e}function ls(e,t,n,r){return e=ot(22,e,r,t),e.elementType=Fc,e.lanes=n,e.stateNode={isHidden:!1},e}function aa(e,t,n){return e=ot(6,e,null,t),e.lanes=n,e}function ca(e,t,n){return t=ot(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nw(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 fa(e,t,n,r,o,i,s,l,u){return e=new nw(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ot(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ku(i),e}function rw(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dh)}catch(e){console.error(e)}}Dh(),bc.exports=We;var uw=bc.exports,jh,Fh=uw;jh=Fh.createRoot,Fh.hydrateRoot;function Ee(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function ps(){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}})}gs.prototype=ps.prototype={constructor:gs,on:function(e,t){var n=this._,r=cw(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)),Hh.hasOwnProperty(t)?{space:Hh[t],local:e}:e}function dw(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ga&&t.documentElement.namespaceURI===ga?t.createElement(e):t.createElementNS(n,e)}}function hw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bh(e){var t=ms(e);return(t.local?hw:dw)(t)}function pw(){}function ma(e){return e==null?pw:function(){return this.querySelector(e)}}function gw(e){typeof e!="function"&&(e=ma(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=h&&(h=y+1);!(E=x[h])&&++h=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Fw(e){e||(e=Vw);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function Hw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bw(){return Array.from(this)}function Uw(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?t1:typeof t=="function"?r1:n1)(e,t,n??"")):Ir(this.node(),e)}function Ir(e,t){return e.style.getPropertyValue(t)||Gh(e).getComputedStyle(e,null).getPropertyValue(t)}function i1(e){return function(){delete this[e]}}function s1(e,t){return function(){this[e]=t}}function l1(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function u1(e,t){return arguments.length>1?this.each((t==null?i1:typeof t=="function"?l1:s1)(e,t)):this.node()[e]}function Qh(e){return e.trim().split(/^|\s+/)}function ya(e){return e.classList||new Kh(e)}function Kh(e){this._node=e,this._names=Qh(e.getAttribute("class")||"")}Kh.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 Zh(e,t){for(var n=ya(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 wa(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:l,dx:u,dy:a,dispatch:c}){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:c}})}wa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Y1(e){return!e.ctrlKey&&!e.button}function X1(){return this.parentNode}function G1(e,t){return t??{x:e.x,y:e.y}}function Q1(){return navigator.maxTouchPoints||"ontouchstart"in this}function rp(){var e=Y1,t=X1,n=G1,r=Q1,o={},i=ps("start","drag","end"),s=0,l,u,a,c,f=0;function d(v){v.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",p,W1).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(v,E){if(!(c||!e.call(this,v,E))){var _=h(this,t.call(this,v,E),v,E,"mouse");_&&(qe(v.view).on("mousemove.drag",m,$o).on("mouseup.drag",w,$o),tp(v.view),va(v),a=!1,l=v.clientX,u=v.clientY,_("start",v))}}function m(v){if(Pr(v),!a){var E=v.clientX-l,_=v.clientY-u;a=E*E+_*_>f}o.mouse("drag",v)}function w(v){qe(v.view).on("mousemove.drag mouseup.drag",null),np(v.view,a),Pr(v),o.mouse("end",v)}function x(v,E){if(e.call(this,v,E)){var _=v.changedTouches,k=t.call(this,v,E),C=_.length,b,j;for(b=0;b>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xs(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xs(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=Z1.exec(e))?new Ue(t[1],t[2],t[3],1):(t=q1.exec(e))?new Ue(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=J1.exec(e))?xs(t[1],t[2],t[3],t[4]):(t=ex.exec(e))?xs(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tx.exec(e))?fp(t[1],t[2]/100,t[3]/100,1):(t=nx.exec(e))?fp(t[1],t[2]/100,t[3]/100,t[4]):ip.hasOwnProperty(e)?up(ip[e]):e==="transparent"?new Ue(NaN,NaN,NaN,0):null}function up(e){return new Ue(e>>16&255,e>>8&255,e&255,1)}function xs(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ue(e,t,n,r)}function ix(e){return e instanceof zo||(e=jn(e)),e?(e=e.rgb(),new Ue(e.r,e.g,e.b,e.opacity)):new Ue}function Ea(e,t,n,r){return arguments.length===1?ix(e):new Ue(e,t,n,r??1)}function Ue(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}xa(Ue,Ea,op(zo,{brighter(e){return e=e==null?ws:Math.pow(ws,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ue(Fn(this.r),Fn(this.g),Fn(this.b),Es(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:ap,formatHex:ap,formatHex8:sx,formatRgb:cp,toString:cp}));function ap(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function sx(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn((isNaN(this.opacity)?1:this.opacity)*255)}`}function cp(){const e=Es(this.opacity);return`${e===1?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${e===1?")":`, ${e})`}`}function Es(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return e=Fn(e),(e<16?"0":"")+e.toString(16)}function fp(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new gt(e,t,n,r)}function dp(e){if(e instanceof gt)return new gt(e.h,e.s,e.l,e.opacity);if(e instanceof zo||(e=jn(e)),!e)return new gt;if(e instanceof gt)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 gt(s,l,u,e.opacity)}function lx(e,t,n,r){return arguments.length===1?dp(e):new gt(e,t,n,r??1)}function gt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}xa(gt,lx,op(zo,{brighter(e){return e=e==null?ws:Math.pow(ws,e),new gt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new gt(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 Ue(_a(e>=240?e-240:e+120,o,r),_a(e,o,r),_a(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new gt(hp(this.h),_s(this.s),_s(this.l),Es(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=Es(this.opacity);return`${e===1?"hsl(":"hsla("}${hp(this.h)}, ${_s(this.s)*100}%, ${_s(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hp(e){return e=(e||0)%360,e<0?e+360:e}function _s(e){return Math.max(0,Math.min(1,e||0))}function _a(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 Sa=e=>()=>e;function ux(e,t){return function(n){return e+n*t}}function ax(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 cx(e){return(e=+e)==1?pp:function(t,n){return n-t?ax(t,n,e):Sa(isNaN(t)?n:t)}}function pp(e,t){var n=t-e;return n?ux(e,n):Sa(isNaN(e)?t:e)}const Ss=function e(t){var n=cx(t);function r(o,i){var s=n((o=Ea(o)).r,(i=Ea(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),a=pp(o.opacity,i.opacity);return function(c){return o.r=s(c),o.g=l(c),o.b=u(c),o.opacity=a(c),o+""}}return r.gamma=e,r}(1);function fx(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:Pt(r,o)})),n=Na.lastIndex;return n180?c+=360:c-a>180&&(a+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Pt(a,c)})):c&&f.push(o(f)+"rotate("+c+r)}function l(a,c,f,d){a!==c?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Pt(a,c)}):c&&f.push(o(f)+"skewX("+c+r)}function u(a,c,f,d,g,m){if(a!==f||c!==d){var w=g.push(o(g)+"scale(",null,",",null,")");m.push({i:w-4,x:Pt(a,f)},{i:w-2,x:Pt(c,d)})}else(f!==1||d!==1)&&g.push(o(g)+"scale("+f+","+d+")")}return function(a,c){var f=[],d=[];return a=e(a),c=e(c),i(a.translateX,a.translateY,c.translateX,c.translateY,f,d),s(a.rotate,c.rotate,f,d),l(a.skewX,c.skewX,f,d),u(a.scaleX,a.scaleY,c.scaleX,c.scaleY,f,d),a=c=null,function(g){for(var m=-1,w=d.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Tr}function Sp(){Hn=(Ms=Vo.now())+Is,Tr=Do=0;try{Cx()}finally{Tr=0,Ix(),Hn=0}}function Mx(){var e=Vo.now(),t=e-Ms;t>xp&&(Is-=t,Ms=e)}function Ix(){for(var e,t=Cs,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:Cs=n);Fo=e,Ia(r)}function Ia(e){if(!Tr){Do&&(Do=clearTimeout(Do));var t=e-Hn;t>24?(e<1/0&&(Do=setTimeout(Sp,e-Vo.now()-Is)),jo&&(jo=clearInterval(jo))):(jo||(Ms=Vo.now(),jo=setInterval(Mx,xp)),Tr=1,Ep(Sp))}}function kp(e,t,n){var r=new Ps;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Px=ps("start","end","cancel","interrupt"),Lx=[],Np=0,Cp=1,Pa=2,Ls=3,Mp=4,La=5,Ts=6;function bs(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Tx(e,n,{name:t,index:r,group:o,on:Px,tween:Lx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Np})}function Ta(e,t){var n=mt(e,t);if(n.state>Np)throw new Error("too late; already scheduled");return n}function Lt(e,t){var n=mt(e,t);if(n.state>Ls)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 Tx(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=_p(i,0,n.time);function i(a){n.state=Cp,n.timer.restart(s,n.delay,n.time),n.delay<=a&&s(a-n.delay)}function s(a){var c,f,d,g;if(n.state!==Cp)return u();for(c in r)if(g=r[c],g.name===n.name){if(g.state===Ls)return kp(s);g.state===Mp?(g.state=Ts,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[c]):+cPa&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function lE(e,t,n){var r,o,i=sE(t)?Ta:Lt;return function(){var s=i(this,e),l=s.on;l!==r&&(o=(r=l).copy()).on(t,n),s.on=o}}function uE(e,t){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(e):this.each(lE(n,e,t))}function aE(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function cE(){return this.on("end.remove",aE(this._id))}function fE(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ma(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 Gt(e,t,n){this.k=e,this.x=t,this.y=n}Gt.prototype={constructor:Gt,scale:function(e){return e===1?this:new Gt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Gt(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 Os=new Gt(1,0,0);Tp.prototype=Gt.prototype;function Tp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Os;return e.__zoom}function $a(e){e.stopImmediatePropagation()}function Ho(e){e.preventDefault(),e.stopImmediatePropagation()}function AE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function DE(){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 bp(){return this.__zoom||Os}function jE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function FE(){return navigator.maxTouchPoints||"ontouchstart"in this}function VE(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 $p(){var e=AE,t=DE,n=VE,r=jE,o=FE,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Ns,a=ps("start","zoom","end"),c,f,d,g=500,m=150,w=0,x=10;function p(S){S.property("__zoom",bp).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",b).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",T).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(S,$,L,z){var M=S.selection?S.selection():S;M.property("__zoom",bp),S!==M?E(S,$,L,z):M.interrupt().each(function(){_(this,arguments).event(z).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},p.scaleBy=function(S,$,L,z){p.scaleTo(S,function(){var M=this.__zoom.k,N=typeof $=="function"?$.apply(this,arguments):$;return M*N},L,z)},p.scaleTo=function(S,$,L,z){p.transform(S,function(){var M=t.apply(this,arguments),N=this.__zoom,P=L==null?v(M):typeof L=="function"?L.apply(this,arguments):L,A=N.invert(P),O=typeof $=="function"?$.apply(this,arguments):$;return n(h(y(N,O),P,A),M,s)},L,z)},p.translateBy=function(S,$,L,z){p.transform(S,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),s)},null,z)},p.translateTo=function(S,$,L,z,M){p.transform(S,function(){var N=t.apply(this,arguments),P=this.__zoom,A=z==null?v(N):typeof z=="function"?z.apply(this,arguments):z;return n(Os.translate(A[0],A[1]).scale(P.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof L=="function"?-L.apply(this,arguments):-L),N,s)},z,M)};function y(S,$){return $=Math.max(i[0],Math.min(i[1],$)),$===S.k?S:new Gt($,S.x,S.y)}function h(S,$,L){var z=$[0]-L[0]*S.k,M=$[1]-L[1]*S.k;return z===S.x&&M===S.y?S:new Gt(S.k,z,M)}function v(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function E(S,$,L,z){S.on("start.zoom",function(){_(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(z).end()}).tween("zoom",function(){var M=this,N=arguments,P=_(M,N).event(z),A=t.apply(M,N),O=L==null?v(A):typeof L=="function"?L.apply(M,N):L,U=Math.max(A[1][0]-A[0][0],A[1][1]-A[0][1]),B=M.__zoom,X=typeof $=="function"?$.apply(M,N):$,q=u(B.invert(O).concat(U/B.k),X.invert(O).concat(U/X.k));return function(Q){if(Q===1)Q=X;else{var F=q(Q),W=U/F[2];Q=new Gt(W,O[0]-F[0]*W,O[1]-F[1]*W)}P.zoom(null,Q)}})}function _(S,$,L){return!L&&S.__zooming||new k(S,$)}function k(S,$){this.that=S,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,$),this.taps=0}k.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,$){return this.mouse&&S!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var $=qe(this.that).datum();a.call(S,this.that,new RE(S,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:a}),$)}};function C(S,...$){if(!e.apply(this,arguments))return;var L=_(this,$).event(S),z=this.__zoom,M=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),N=pt(S);if(L.wheel)(L.mouse[0][0]!==N[0]||L.mouse[0][1]!==N[1])&&(L.mouse[1]=z.invert(L.mouse[0]=N)),clearTimeout(L.wheel);else{if(z.k===M)return;L.mouse=[N,z.invert(N)],$s(this),L.start()}Ho(S),L.wheel=setTimeout(P,m),L.zoom("mouse",n(h(y(z,M),L.mouse[0],L.mouse[1]),L.extent,s));function P(){L.wheel=null,L.end()}}function b(S,...$){if(d||!e.apply(this,arguments))return;var L=S.currentTarget,z=_(this,$,!0).event(S),M=qe(S.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",U,!0),N=pt(S,L),P=S.clientX,A=S.clientY;tp(S.view),$a(S),z.mouse=[N,this.__zoom.invert(N)],$s(this),z.start();function O(B){if(Ho(B),!z.moved){var X=B.clientX-P,q=B.clientY-A;z.moved=X*X+q*q>w}z.event(B).zoom("mouse",n(h(z.that.__zoom,z.mouse[0]=pt(B,L),z.mouse[1]),z.extent,s))}function U(B){M.on("mousemove.zoom mouseup.zoom",null),np(B.view,z.moved),Ho(B),z.event(B).end()}}function j(S,...$){if(e.apply(this,arguments)){var L=this.__zoom,z=pt(S.changedTouches?S.changedTouches[0]:S,this),M=L.invert(z),N=L.k*(S.shiftKey?.5:2),P=n(h(y(L,N),z,M),t.apply(this,$),s);Ho(S),l>0?qe(this).transition().duration(l).call(E,P,z,S):qe(this).call(p.transform,P,z,S)}}function T(S,...$){if(e.apply(this,arguments)){var L=S.touches,z=L.length,M=_(this,$,S.changedTouches.length===z).event(S),N,P,A,O;for($a(S),P=0;P`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Bo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],zp=["Enter"," ","Escape"],Op={"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 br;(function(e){e.Strict="strict",e.Loose="loose"})(br||(br={}));var Bn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Bn||(Bn={}));var Uo;(function(e){e.Partial="partial",e.Full="full"})(Uo||(Uo={}));const Rp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var En;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(En||(En={}));var Rs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rs||(Rs={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Ap={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Dp(e){return e===null?null:e?"valid":"invalid"}const jp=e=>"id"in e&&"source"in e&&"target"in e,HE=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),Wo=(e,t=[0,0])=>{const{width:n,height:r}=Qt(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},BE=(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?js(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return As(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ds(n)},Yo=(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=As(n,js(o)),r=!0)}),r?Ds(n):{x:0,y:0,width:0,height:0}},Oa=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const l={...Or(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const a of e.values()){const{measured:c,selectable:f=!0,hidden:d=!1}=a;if(s&&!f||d)continue;const g=c.width??a.width??a.initialWidth??null,m=c.height??a.height??a.initialHeight??null,w=Xo(l,zr(a)),x=(g??0)*(m??0),p=i&&w>0;(!a.internals.handleBounds||p||w>=x||a.dragging)&&u.push(a)}return u},UE=(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 WE(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 YE({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const l=WE(e,s),u=Yo(l),a=Da(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}),!0}function Fp({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},c=s.origin??r;let f=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!l)i==null||i("005",yt.error005());else{const g=l.measured.width,m=l.measured.height;g&&m&&(f=[[u,a],[u+g,a+m]])}else l&&Wn(s.extent)&&(f=[[s.extent[0][0]+u,s.extent[0][1]+a],[s.extent[1][0]+u,s.extent[1][1]+a]]);const d=Wn(f)?Un(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",yt.error015())),{position:{x:d.x-u+(s.measured.width??0)*c[0],y:d.y-a+(s.measured.height??0)*c[1]},positionAbsolute:d}}async function XE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const g=i.has(d.id),m=!g&&d.parentId&&s.find(w=>w.id===d.parentId);(g||m)&&s.push(d)}const l=new Set(t.map(d=>d.id)),u=r.filter(d=>d.deletable!==!1),c=UE(s,u);for(const d of u)l.has(d.id)&&!c.find(m=>m.id===d.id)&&c.push(d);if(!o)return{edges:c,nodes:s};const f=await o({nodes:s,edges:c});return typeof f=="boolean"?f?{edges:c,nodes:s}:{edges:[],nodes:[]}:f}const $r=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Un=(e={x:0,y:0},t,n)=>({x:$r(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:$r(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Vp(e,t,n){const{width:r,height:o}=Qt(n),{x:i,y:s}=n.internals.positionAbsolute;return Un(e,[[i,s],[i+r,s+o]],t)}const Hp=(e,t,n)=>en?-$r(Math.abs(e-n),1,t)/t:0,Ra=(e,t,n=15,r=40)=>{const o=Hp(e.x,r,t.width-r)*n,i=Hp(e.y,r,t.height-r)*n;return[o,i]},As=(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)}),Aa=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ds=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),zr=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=za(e)?e.internals.positionAbsolute:Wo(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}},js=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=za(e)?e.internals.positionAbsolute:Wo(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)}},Bp=(e,t)=>Ds(As(Aa(e),Aa(t))),Xo=(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)},Up=e=>vt(e.width)&&vt(e.height)&&vt(e.x)&&vt(e.y),vt=e=>!isNaN(e)&&isFinite(e),Wp=(e,t)=>(n,r)=>{},Go=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Or=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Go(l,s):l},Rr=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ar(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(`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=Ar(e,n),o=Ar(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ar(e.top??e.y??0,n),o=Ar(e.bottom??e.y??0,n),i=Ar(e.left??e.x??0,t),s=Ar(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 QE(e,t,n,r,o,i){const{x:s,y:l}=Rr(e,[t,n,r]),{x:u,y:a}=Rr({x:e.x+e.width,y:e.y+e.height},[t,n,r]),c=o-u,f=i-a;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(c),bottom:Math.floor(f)}}const Da=(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),c=$r(a,r,o),f=e.x+e.width/2,d=e.y+e.height/2,g=t/2-f*c,m=n/2-d*c,w=QE(e,g,m,c,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:g-x.left+x.right,y:m-x.top+x.bottom,zoom:c}},Qo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Wn(e){return e!=null&&e!=="parent"}function Qt(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 Yp(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 Xp(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 Gp(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function KE(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ZE(e){return{...Op,...e||{}}}function Ko(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=wt(e),l=Or({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:u,y:a}=n?Go(l,t):l;return{xSnapped:u,ySnapped:a,...l}}const ja=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qp=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},qE=["INPUT","SELECT","TEXTAREA"];function Kp(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:qE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Zp=e=>"clientX"in e,wt=(e,t)=>{var i,s;const n=Zp(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)}},qp=(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 Jp({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,c=Math.abs(u-e),f=Math.abs(a-t);return[u,a,c,f]}function Fs(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eg({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case G.Left:return[t-Fs(t-r,i),n];case G.Right:return[t+Fs(r-t,i),n];case G.Top:return[t,n-Fs(n-o,i)];case G.Bottom:return[t,n+Fs(o-n,i)]}}function tg({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[l,u]=eg({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[a,c]=eg({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[f,d,g,m]=Jp({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:a,targetControlY:c});return[`M${e},${t} C${l},${u} ${a},${c} ${r},${o}`,f,d,g,m]}function ng({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n0}const t_=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,n_=(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)),r_=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",yt.error006()),t;const r=n.getEdgeId||t_;let o;return jp(e)?o={...e}:o={...e,id:r(e)},n_(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function rg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,l]=ng({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,l]}const og={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},o_=({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 i_({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const l=og[t],u=og[r],a={x:e.x+l.x*i,y:e.y+l.y*i},c={x:n.x+u.x*i,y:n.y+u.y*i},f=o_({source:a,sourcePosition:t,target:c}),d=f.x!==0?"x":"y",g=f[d];let m=[],w,x;const p={x:0,y:0},y={x:0,y:0},[,,h,v]=ng({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[d]*u[d]===-1){d==="x"?(w=o.x??a.x+(c.x-a.x)*s,x=o.y??(a.y+c.y)/2):(w=o.x??(a.x+c.x)/2,x=o.y??a.y+(c.y-a.y)*s);const C=[{x:w,y:a.y},{x:w,y:c.y}],b=[{x:a.x,y:x},{x:c.x,y:x}];l[d]===g?m=d==="x"?C:b:m=d==="x"?b:C}else{const C=[{x:a.x,y:c.y}],b=[{x:c.x,y:a.y}];if(d==="x"?m=l.x===g?b:C:m=l.y===g?C:b,t===r){const S=Math.abs(e[d]-n[d]);if(S<=i){const $=Math.min(i-1,i-S);l[d]===g?p[d]=(a[d]>e[d]?-1:1)*$:y[d]=(c[d]>n[d]?-1:1)*$}}if(t!==r){const S=d==="x"?"y":"x",$=l[d]===u[S],L=a[S]>c[S],z=a[S]=V?(w=(j.x+T.x)/2,x=m[0].y):(w=m[0].x,x=(j.y+T.y)/2)}const E={x:a.x+p.x,y:a.y+p.y},_={x:c.x+y.x,y:c.y+y.y};return[[e,...E.x!==m[0].x||E.y!==m[0].y?[E]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],w,x,h,v]}function s_(e,t,n,r){const o=Math.min(ig(e,t)/2,ig(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.xn.id===t):e[0])||null}function Va(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function u_(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=Va(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 ag=1e3,a_=10,Ha={nodeOrigin:[0,0],nodeExtent:Bo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},c_={...Ha,checkEquality:!0};function Ba(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function f_(e,t,n){const r=Ba(Ha,n);for(const o of e.values())if(o.parentId)Ya(o,e,t,r);else{const i=Wo(o,r.nodeOrigin),s=Wn(o.extent)?o.extent:r.nodeExtent,l=Un(i,s,Qt(o));o.internals.positionAbsolute=l}}function d_(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 Ua(e){return e==="manual"}function Wa(e,t,n,r={}){var c,f;const o=Ba(c_,r),i={i:0},s=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!Ua(o.zIndexMode)?ag:0;let u=e.length>0,a=!1;t.clear(),n.clear();for(const d of e){let g=s.get(d.id);if(o.checkEquality&&d===(g==null?void 0:g.internals.userNode))t.set(d.id,g);else{const m=Wo(d,o.nodeOrigin),w=Wn(d.extent)?d.extent:o.nodeExtent,x=Un(m,w,Qt(d));g={...o.defaults,...d,measured:{width:(c=d.measured)==null?void 0:c.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:d_(d,g),z:cg(d,l,o.zIndexMode),userNode:d}},t.set(d.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(u=!1),d.parentId&&Ya(g,t,n,r,i),a||(a=d.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:a}}function h_(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 Ya(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:l,zIndexMode:u}=Ba(Ha,r),a=e.parentId,c=t.get(a);if(!c){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}h_(e,n),o&&!c.parentId&&c.internals.rootParentIndex===void 0&&u==="auto"&&(c.internals.rootParentIndex=++o.i,c.internals.z=c.internals.z+o.i*a_),o&&c.internals.rootParentIndex!==void 0&&(o.i=c.internals.rootParentIndex);const f=i&&!Ua(u)?ag:0,{x:d,y:g,z:m}=p_(e,c,s,l,f,u),{positionAbsolute:w}=e.internals,x=d!==w.x||g!==w.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:d,y:g}:w,z:m}})}function cg(e,t,n){const r=vt(e.zIndex)?e.zIndex:0;return Ua(n)?r:r+(e.selected?t:0)}function p_(e,t,n,r,o,i){const{x:s,y:l}=t.internals.positionAbsolute,u=Qt(e),a=Wo(e,n),c=Wn(e.extent)?Un(a,e.extent,u):a;let f=Un({x:s+c.x,y:l+c.y},r,u);e.extent==="parent"&&(f=Vp(f,u,t));const d=cg(e,o,i),g=t.internals.z??0;return{x:f.x,y:f.y,z:g>=d?g+1:d}}function Xa(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)??zr(u),c=Bp(a,l.rect);i.set(l.parentId,{expandedRect:c,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},a)=>{var h;const c=u.internals.positionAbsolute,f=Qt(u),d=u.origin??r,g=l.x0||m>0||p||y)&&(o.push({id:a,type:"position",position:{x:u.position.x-g+p,y:u.position.y-m+y}}),(h=n.get(a))==null||h.forEach(v=>{e.some(E=>E.id===v.id)||o.push({id:v.id,type:"position",position:{x:v.position.x+g,y:v.position.y+m}})})),(f.width0){const g=Xa(d,t,n,o);a.push(...g)}return{changes:a,updatedInternals:u}}async function m_({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function fg(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 dg(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}`,c=`${i}-${l}--${o}-${s}`;fg("source",u,c,e,o,s),fg("target",u,a,e,i,l),t.set(r.id,r)}}function hg(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:hg(n,t):!1}function pg(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 y_(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!hg(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 Ga({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,l,u;const o=[];for(const[a,c]of t){const f=(s=n.get(a))==null?void 0:s.internals.userNode;f&&o.push({...f,position:c.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 v_({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=Go(i,t);return{x:s.x-i.x,y:s.y-i.y}}function w_({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},c=null,f=!1,d=null,g=!1,m=!1,w=null;function x({noDragClassName:y,handleSelector:h,domNode:v,isSelectable:E,nodeId:_,nodeClickDistance:k=0}){d=qe(v);function C({x:R,y:V}){const{nodeLookup:S,nodeExtent:$,snapGrid:L,snapToGrid:z,nodeOrigin:M,onNodeDrag:N,onSelectionDrag:P,onError:A,updateNodePositions:O}=t();i={x:R,y:V};let U=!1;const B=l.size>1,X=B&&$?Aa(Yo(l)):null,q=B&&z?v_({dragItems:l,snapGrid:L,x:R,y:V}):null;for(const[Q,F]of l){if(!S.has(Q))continue;let W={x:R-F.distance.x,y:V-F.distance.y};z&&(W=q?{x:Math.round(W.x+q.x),y:Math.round(W.y+q.y)}:Go(W,L));let ee=null;if(B&&$&&!F.extent&&X){const{positionAbsolute:K}=F.internals,ne=K.x-X.x+$[0][0],ie=K.x+F.measured.width-X.x2+$[1][0],le=K.y-X.y+$[0][1],we=K.y+F.measured.height-X.y2+$[1][1];ee=[[ne,le],[ie,we]]}const{position:J,positionAbsolute:Z}=Fp({nodeId:Q,nextPosition:W,nodeLookup:S,nodeExtent:ee||$,nodeOrigin:M,onError:A});U=U||F.position.x!==J.x||F.position.y!==J.y,F.position=J,F.internals.positionAbsolute=Z}if(m=m||U,!!U&&(O(l,!0),w&&(r||N||!_&&P))){const[Q,F]=Ga({nodeId:_,dragItems:l,nodeLookup:S});r==null||r(w,l,Q,F),N==null||N(w,Q,F),_||P==null||P(w,F)}}async function b(){if(!c)return;const{transform:R,panBy:V,autoPanSpeed:S,autoPanOnNodeDrag:$}=t();if(!$){u=!1,cancelAnimationFrame(s);return}const[L,z]=Ra(a,c,S);(L!==0||z!==0)&&(i.x=(i.x??0)-L/R[2],i.y=(i.y??0)-z/R[2],await V({x:L,y:z})&&C(i)),s=requestAnimationFrame(b)}function j(R){var B;const{nodeLookup:V,multiSelectionActive:S,nodesDraggable:$,transform:L,snapGrid:z,snapToGrid:M,selectNodesOnDrag:N,onNodeDragStart:P,onSelectionDragStart:A,unselectNodesAndEdges:O}=t();f=!0,(!N||!E)&&!S&&_&&((B=V.get(_))!=null&&B.selected||O()),E&&N&&_&&(e==null||e(_));const U=Ko(R.sourceEvent,{transform:L,snapGrid:z,snapToGrid:M,containerBounds:c});if(i=U,l=y_(V,$,U,_),l.size>0&&(n||P||!_&&A)){const[X,q]=Ga({nodeId:_,dragItems:l,nodeLookup:V});n==null||n(R.sourceEvent,l,X,q),P==null||P(R.sourceEvent,X,q),_||A==null||A(R.sourceEvent,q)}}const T=rp().clickDistance(k).on("start",R=>{const{domNode:V,nodeDragThreshold:S,transform:$,snapGrid:L,snapToGrid:z}=t();c=(V==null?void 0:V.getBoundingClientRect())||null,g=!1,m=!1,w=R.sourceEvent,S===0&&j(R),i=Ko(R.sourceEvent,{transform:$,snapGrid:L,snapToGrid:z,containerBounds:c}),a=wt(R.sourceEvent,c)}).on("drag",R=>{const{autoPanOnNodeDrag:V,transform:S,snapGrid:$,snapToGrid:L,nodeDragThreshold:z,nodeLookup:M}=t(),N=Ko(R.sourceEvent,{transform:S,snapGrid:$,snapToGrid:L,containerBounds:c});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!M.has(_))&&(g=!0),!g){if(!u&&V&&f&&(u=!0,b()),!f){const P=wt(R.sourceEvent,c),A=P.x-a.x,O=P.y-a.y;Math.sqrt(A*A+O*O)>z&&j(R)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&l&&f&&(a=wt(R.sourceEvent,c),C(N))}}).on("end",R=>{if(!f||g){g&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,f=!1,cancelAnimationFrame(s),l.size>0){const{nodeLookup:V,updateNodePositions:S,onNodeDragStop:$,onSelectionDragStop:L}=t();if(m&&(S(l,!1),m=!1),o||$||!_&&L){const[z,M]=Ga({nodeId:_,dragItems:l,nodeLookup:V,dragging:!1});o==null||o(R.sourceEvent,l,z,M),$==null||$(R.sourceEvent,z,M),_||L==null||L(R.sourceEvent,M)}}}).filter(R=>{const V=R.target;return!R.button&&(!y||!pg(V,`.${y}`,v))&&(!h||pg(V,h,v))});d.call(T)}function p(){d==null||d.on(".drag",null)}return{update:x,destroy:p}}function x_(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())Xo(o,zr(i))>0&&r.push(i);return r}const E_=250;function __(e,t,n,r){var l,u;let o=[],i=1/0;const s=x_(e,n,t+E_);for(const a of s){const c=[...((l=a.internals.handleBounds)==null?void 0:l.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of c){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:g}=Yn(a,f,f.position,!0),m=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(g-e.y,2));m>t||(m1){const a=r.type==="source"?"target":"source";return o.find(c=>c.type===a)??o[0]}return o[0]}function gg(e,t,n,r,o,i=!1){var a,c,f;const s=r.get(e);if(!s)return null;const l=o==="strict"?(a=s.internals.handleBounds)==null?void 0:a[t]:[...((c=s.internals.handleBounds)==null?void 0:c.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],u=(n?l==null?void 0:l.find(d=>d.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Yn(s,u,u.position,!0)}:u}function mg(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function S_(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const yg=()=>!0;function k_(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:l,nodeLookup:u,lib:a,autoPanOnConnect:c,flowId:f,panBy:d,cancelConnection:g,onConnectStart:m,onConnect:w,onConnectEnd:x,isValidConnection:p=yg,onReconnectEnd:y,updateConnection:h,getTransform:v,getFromHandle:E,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:C}){const b=Qp(e.target);let j=0,T;const{x:R,y:V}=wt(e),S=mg(i,C),$=l==null?void 0:l.getBoundingClientRect();let L=!1;if(!$||!S)return;const z=gg(o,S,r,u,t);if(!z)return;let M=wt(e,$),N=!1,P=null,A=!1,O=null;function U(){if(!c||!$)return;const[J,Z]=Ra(M,$,_);d({x:J,y:Z}),j=requestAnimationFrame(U)}const B={...z,nodeId:o,type:S,position:z.position},X=u.get(o);let Q={inProgress:!0,isValid:null,from:Yn(X,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:M,toHandle:null,toPosition:Ap[B.position],toNode:null,pointer:M};function F(){L=!0,h(Q),m==null||m(e,{nodeId:o,handleId:r,handleType:S})}k===0&&F();function W(J){if(!L){const{x:we,y:st}=wt(J),bt=we-R,$t=st-V;if(!(bt*bt+$t*$t>k*k))return;F()}if(!E()||!B){ee(J);return}const Z=v();M=wt(J,$),T=__(Or(M,Z,!1,[1,1]),n,u,B),N||(U(),N=!0);const K=vg(J,{handle:T,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:p,doc:b,lib:a,flowId:f,nodeLookup:u});O=K.handleDomNode,P=K.connection,A=S_(!!T,K.isValid);const ne=u.get(o),ie=ne?Yn(ne,B,G.Left,!0):Q.from,le={...Q,from:ie,isValid:A,to:K.toHandle&&A?Rr({x:K.toHandle.x,y:K.toHandle.y},Z):M,toHandle:K.toHandle,toPosition:A&&K.toHandle?K.toHandle.position:Ap[B.position],toNode:K.toHandle?u.get(K.toHandle.nodeId):null,pointer:M};h(le),Q=le}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(L){(T||O)&&P&&A&&(w==null||w(P));const{inProgress:Z,...K}=Q,ne={...K,toPosition:Q.toHandle?Q.toPosition:null};x==null||x(J,ne),i&&(y==null||y(J,ne))}g(),cancelAnimationFrame(j),N=!1,A=!1,P=null,O=null,b.removeEventListener("mousemove",W),b.removeEventListener("mouseup",ee),b.removeEventListener("touchmove",W),b.removeEventListener("touchend",ee)}}b.addEventListener("mousemove",W),b.addEventListener("mouseup",ee),b.addEventListener("touchmove",W),b.addEventListener("touchend",ee)}function vg(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:l,flowId:u,isValidConnection:a=yg,nodeLookup:c}){const f=i==="target",d=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:g,y:m}=wt(e),w=s.elementFromPoint(g,m),x=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:d,p={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const y=mg(void 0,x),h=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),E=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!h||!y)return p;const k={source:f?h:r,sourceHandle:f?v:o,target:f?r:h,targetHandle:f?o:v};p.connection=k;const b=E&&_&&(n===br.Strict?f&&y==="source"||!f&&y==="target":h!==r||v!==o);p.isValid=b&&a(k),p.toHandle=gg(h,y,v,c,n,!0)}return p}const Qa={onPointerDown:k_,isValid:vg};function N_({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=qe(e);function i({translateExtent:l,width:u,height:a,zoomStep:c=1,pannable:f=!0,zoomable:d=!0,inversePan:g=!1}){const m=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const v=n(),E=h.sourceEvent.ctrlKey&&Qo()?10:1,_=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*c,k=v[2]*Math.pow(2,_*E);t.scaleTo(k)};let w=[0,0];const x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},p=h=>{const v=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const E=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],_=[E[0]-w[0],E[1]-w[1]];w=E;const k=r()*Math.max(v[2],Math.log(v[2]))*(g?-1:1),C={x:v[0]-_[0]*k,y:v[1]-_[1]*k},b=[[0,0],[u,a]];t.setViewportConstrained({x:C.x,y:C.y,zoom:v[2]},b,l)},y=$p().on("start",x).on("zoom",f?p:null).on("zoom.wheel",d?m:null);o.call(y,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:pt}}const Vs=e=>({x:e.x,y:e.y,zoom:e.k}),Ka=({x:e,y:t,zoom:n})=>Os.translate(e,t).scale(n),Dr=(e,t)=>e.target.closest(`.${t}`),wg=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),C_=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Za=(e,t=0,n=C_,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},xg=e=>{const t=e.ctrlKey&&Qo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function M_({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:a}){return c=>{if(Dr(c,t))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(c.ctrlKey&&s){const x=pt(c),p=xg(c),y=f*Math.pow(2,p);r.scaleTo(n,y,x,c);return}const d=c.deltaMode===1?20:1;let g=o===Bn.Vertical?0:c.deltaX*d,m=o===Bn.Horizontal?0:c.deltaY*d;!Qo()&&c.shiftKey&&o!==Bn.Vertical&&(g=c.deltaY*d,m=0),r.translateBy(n,-(g/f)*i,-(m/f)*i,{internal:!0});const w=Vs(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(c,w),e.panScrollTimeout=setTimeout(()=>{a==null||a(c,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(c,w))}}function I_({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,l=Dr(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),s||l)return null;r.preventDefault(),n.call(this,r,o)}}function P_({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Vs(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 L_({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,l;e.usedRightMouseButton=!!(n&&wg(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,Vs(i.transform)))}}function T_({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&&wg(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=Vs(s.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,u)},n?150:0)}}}function b_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:l,noPanClassName:u,lib:a,connectionInProgress:c}){return f=>{var x;const d=e||t,g=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Dr(f,`${a}-flow__node`)||Dr(f,`${a}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||c&&!m||Dr(f,l)&&m||Dr(f,u)&&(!m||o&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((x=f.touches)==null?void 0:x.length)>1)return f.preventDefault(),!1;if(!d&&!o&&!g&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&w}}function $_({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},c=e.getBoundingClientRect(),f=$p().scaleExtent([t,n]).translateExtent(r),d=qe(e).call(f);y({x:o.x,y:o.y,zoom:$r(o.zoom,t,n)},[[0,0],[c.width,c.height]],r);const g=d.on("wheel.zoom"),m=d.on("dblclick.zoom");f.wheelDelta(xg);async function w(T,R){return d?new Promise(V=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).transform(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}function x({noWheelClassName:T,noPanClassName:R,onPaneContextMenu:V,userSelectionActive:S,panOnScroll:$,panOnDrag:L,panOnScrollMode:z,panOnScrollSpeed:M,preventScrolling:N,zoomOnPinch:P,zoomOnScroll:A,zoomOnDoubleClick:O,zoomActivationKeyPressed:U,lib:B,onTransformChange:X,connectionInProgress:q,paneClickDistance:Q,selectionOnDrag:F}){S&&!a.isZoomingOrPanning&&p();const W=$&&!U&&!S;f.clickDistance(F?1/0:!vt(Q)||Q<0?0:Q);const ee=W?M_({zoomPanValues:a,noWheelClassName:T,d3Selection:d,d3Zoom:f,panOnScrollMode:z,panOnScrollSpeed:M,zoomOnPinch:P,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:l}):I_({noWheelClassName:T,preventScrolling:N,d3ZoomHandler:g});d.on("wheel.zoom",ee,{passive:!1});const J=P_({zoomPanValues:a,onDraggingChange:u,onPanZoomStart:s});f.on("start",J);const Z=L_({zoomPanValues:a,panOnDrag:L,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:X});f.on("zoom",Z);const K=T_({zoomPanValues:a,panOnDrag:L,panOnScroll:$,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:u});f.on("end",K);const ne=b_({zoomActivationKeyPressed:U,panOnDrag:L,zoomOnScroll:A,panOnScroll:$,zoomOnDoubleClick:O,zoomOnPinch:P,userSelectionActive:S,noPanClassName:R,noWheelClassName:T,lib:B,connectionInProgress:q});f.filter(ne),O?d.on("dblclick.zoom",m):d.on("dblclick.zoom",null)}function p(){f.on("zoom",null)}async function y(T,R,V){const S=Ka(T),$=f==null?void 0:f.constrain()(S,R,V);return $&&await w($),$}async function h(T,R){const V=Ka(T);return await w(V,R),V}function v(T){if(d){const R=Ka(T),V=d.property("__zoom");(V.k!==T.zoom||V.x!==T.x||V.y!==T.y)&&(f==null||f.transform(d,R,null,{sync:!0}))}}function E(){const T=d?Tp(d.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}async function _(T,R){return d?new Promise(V=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).scaleTo(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}async function k(T,R){return d?new Promise(V=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).scaleBy(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}function C(T){f==null||f.scaleExtent(T)}function b(T){f==null||f.translateExtent(T)}function j(T){const R=!vt(T)||T<0?0:T;f==null||f.clickDistance(R)}return{update:x,destroy:p,setViewport:h,setViewportConstrained:y,getViewport:E,scaleTo:_,scaleBy:k,setScaleExtent:C,setTranslateExtent:b,syncViewport:v,setClickDistance:j}}var jr;(function(e){e.Line="line",e.Handle="handle"})(jr||(jr={}));function z_({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 Eg(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 _n(e,t){return Math.max(0,t-e)}function Sn(e,t){return Math.max(0,e-t)}function Hs(e,t,n){return Math.max(0,t-e,e-n)}function _g(e,t){return e?!t:t}function O_(e,t,n,r,o,i,s,l){let{affectsX:u,affectsY:a}=t;const{isHorizontal:c,isVertical:f}=t,d=c&&f,{xSnapped:g,ySnapped:m}=n,{minWidth:w,maxWidth:x,minHeight:p,maxHeight:y}=r,{x:h,y:v,width:E,height:_,aspectRatio:k}=e;let C=Math.floor(c?g-e.pointerX:0),b=Math.floor(f?m-e.pointerY:0);const j=E+(u?-C:C),T=_+(a?-b:b),R=-i[0]*E,V=-i[1]*_;let S=Hs(j,w,x),$=Hs(T,p,y);if(s){let M=0,N=0;u&&C<0?M=_n(h+C+R,s[0][0]):!u&&C>0&&(M=Sn(h+j+R,s[1][0])),a&&b<0?N=_n(v+b+V,s[0][1]):!a&&b>0&&(N=Sn(v+T+V,s[1][1])),S=Math.max(S,M),$=Math.max($,N)}if(l){let M=0,N=0;u&&C>0?M=Sn(h+C,l[0][0]):!u&&C<0&&(M=_n(h+j,l[1][0])),a&&b>0?N=Sn(v+b,l[0][1]):!a&&b<0&&(N=_n(v+T,l[1][1])),S=Math.max(S,M),$=Math.max($,N)}if(o){if(c){const M=Hs(j/k,p,y)*k;if(S=Math.max(S,M),s){let N=0;!u&&!a||u&&!a&&d?N=Sn(v+V+j/k,s[1][1])*k:N=_n(v+V+(u?C:-C)/k,s[0][1])*k,S=Math.max(S,N)}if(l){let N=0;!u&&!a||u&&!a&&d?N=_n(v+j/k,l[1][1])*k:N=Sn(v+(u?C:-C)/k,l[0][1])*k,S=Math.max(S,N)}}if(f){const M=Hs(T*k,w,x)/k;if($=Math.max($,M),s){let N=0;!u&&!a||a&&!u&&d?N=Sn(h+T*k+R,s[1][0])/k:N=_n(h+(a?b:-b)*k+R,s[0][0])/k,$=Math.max($,N)}if(l){let N=0;!u&&!a||a&&!u&&d?N=_n(h+T*k,l[1][0])/k:N=Sn(h+(a?b:-b)*k,l[0][0])/k,$=Math.max($,N)}}}b=b+(b<0?$:-$),C=C+(C<0?S:-S),o&&(d?j>T*k?b=(_g(u,a)?-C:C)/k:C=(_g(u,a)?-b:b)*k:c?(b=C/k,a=u):(C=b*k,u=a));const L=u?h+C:h,z=a?v+b:v;return{width:E+(u?-C:C),height:_+(a?-b:b),x:i[0]*C*(u?-1:1)+L,y:i[1]*b*(a?-1:1)+z}}const Sg={width:0,height:0,x:0,y:0},R_={...Sg,pointerX:0,pointerY:0,aspectRatio:1};function A_(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 D_({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=qe(e);let s={controlDirection:Eg("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:c,keepAspectRatio:f,resizeDirection:d,onResizeStart:g,onResize:m,onResizeEnd:w,shouldResize:x}){let p={...Sg},y={...R_};s={boundaries:c,resizeDirection:d,keepAspectRatio:f,controlDirection:Eg(a)};let h,v=null,E=[],_,k,C,b=!1;const j=rp().on("start",T=>{const{nodeLookup:R,transform:V,snapGrid:S,snapToGrid:$,nodeOrigin:L,paneDomNode:z}=n();if(h=R.get(t),!h)return;v=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:M,ySnapped:N}=Ko(T.sourceEvent,{transform:V,snapGrid:S,snapToGrid:$,containerBounds:v});p={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},y={...p,pointerX:M,pointerY:N,aspectRatio:p.width/p.height},_=void 0,k=Wn(h.extent)?h.extent:void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(_=R.get(h.parentId)),_&&h.extent==="parent"&&(k=[[0,0],[_.measured.width,_.measured.height]]),E=[],C=void 0;for(const[P,A]of R)if(A.parentId===t&&(E.push({id:P,position:{...A.position},extent:A.extent}),A.extent==="parent"||A.expandParent)){const O=A_(A,h,A.origin??L);C?C=[[Math.min(O[0][0],C[0][0]),Math.min(O[0][1],C[0][1])],[Math.max(O[1][0],C[1][0]),Math.max(O[1][1],C[1][1])]]:C=O}g==null||g(T,{...p})}).on("drag",T=>{const{transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$}=n(),L=Ko(T.sourceEvent,{transform:R,snapGrid:V,snapToGrid:S,containerBounds:v}),z=[];if(!h)return;const{x:M,y:N,width:P,height:A}=p,O={},U=h.origin??$,{width:B,height:X,x:q,y:Q}=O_(y,s.controlDirection,L,s.boundaries,s.keepAspectRatio,U,k,C),F=B!==P,W=X!==A,ee=q!==M&&F,J=Q!==N&&W;if(!ee&&!J&&!F&&!W)return;if((ee||J||U[0]===1||U[1]===1)&&(O.x=ee?q:p.x,O.y=J?Q:p.y,p.x=O.x,p.y=O.y,E.length>0)){const ie=q-M,le=Q-N;for(const we of E)we.position={x:we.position.x-ie+U[0]*(B-P),y:we.position.y-le+U[1]*(X-A)},z.push(we)}if((F||W)&&(O.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:p.width,O.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:p.height,p.width=O.width,p.height=O.height),_&&h.expandParent){const ie=U[0]*(O.width??0);O.x&&O.x{b&&(w==null||w(T,{...p}),o==null||o({...p}),b=!1)});i.call(j)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var kg={exports:{}},Ng={},Cg={exports:{}},Mg={};/** +`+i.stack}return{value:e,source:t,stack:o,digest:null}}function ju(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Av=typeof WeakMap=="function"?WeakMap:Map;function Xd(e,t,n){n=Bt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){es||(es=!0,ta=r),Fu(e,t)},n}function Gd(e,t,n){n=Bt(-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(){Fu(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Fu(e,t),typeof r!="function"&&(mn===null?mn=new Set([this]):mn.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Qd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Av;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=Zv.bind(null,e,t,n),t.then(e,e))}function Kd(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 Zd(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=Bt(-1,1),t.tag=2,pn(n,t,1))),n.lanes|=1),e)}var Dv=At.ReactCurrentOwner,Ve=!1;function Ae(e,t,n,r){t.child=e===null?yd(t,null,n,r):wr(t,e.child,n,r)}function qd(e,t,n,r,o){n=n.render;var i=t.ref;return Er(t,o),r=Tu(e,t,n,r,i,o),n=bu(),e!==null&&!Ve?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ut(e,t,o)):(fe&&n&&pu(t),t.flags|=1,Ae(e,t,r,o),t.child)}function Jd(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!ua(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,eh(e,t,i,r,o)):(e=ss(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:co,n(s,r)&&e.ref===t.ref)return Ut(e,t,o)}return t.flags|=1,e=xn(i,r),e.ref=t.ref,e.return=t,t.child=e}function eh(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(co(i,r)&&e.ref===t.ref)if(Ve=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Ve=!0);else return t.lanes=e.lanes,Ut(e,t,o)}return Vu(e,t,n,r,o)}function th(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},ue(Nr,Ke),Ke|=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,ue(Nr,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,ue(Nr,Ke),Ke|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,ue(Nr,Ke),Ke|=r;return Ae(e,t,o,n),t.child}function nh(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vu(e,t,n,r,o){var i=Fe(n)?In:Te.current;return i=gr(t,i),Er(t,o),n=Tu(e,t,n,r,i,o),r=bu(),e!==null&&!Ve?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ut(e,t,o)):(fe&&r&&pu(t),t.flags|=1,Ae(e,t,n,o),t.child)}function rh(e,t,n,r,o){if(Fe(n)){var i=!0;Ti(t)}else i=!1;if(Er(t,o),t.stateNode===null)Qi(e,t),Wd(t,n,r),Du(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=tt(a):(a=Fe(n)?In:Te.current,a=gr(t,a));var f=n.getDerivedStateFromProps,c=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";c||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||u!==a)&&Yd(t,s,r,a),hn=!1;var d=t.memoizedState;s.state=d,Fi(t,r,s,o),u=t.memoizedState,l!==r||d!==u||je.current||hn?(typeof f=="function"&&(Au(t,n,f,r),u=t.memoizedState),(l=hn||Ud(t,n,l,r,d,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,wd(e,t),l=t.memoizedProps,a=t.type===t.elementType?l:ct(t.type,l),s.props=a,c=t.pendingProps,d=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=tt(u):(u=Fe(n)?In:Te.current,u=gr(t,u));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==c||d!==u)&&Yd(t,s,r,u),hn=!1,d=t.memoizedState,s.state=d,Fi(t,r,s,o);var m=t.memoizedState;l!==c||d!==m||je.current||hn?(typeof g=="function"&&(Au(t,n,g,r),m=t.memoizedState),(a=hn||Ud(t,n,a,r,d,m,u)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=u,r=a):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Hu(e,t,n,r,i,o)}function Hu(e,t,n,r,o,i){nh(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&ud(t,n,!1),Ut(e,t,i);r=t.stateNode,Dv.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=wr(t,e.child,null,i),t.child=wr(t,null,l,i)):Ae(e,t,l,i),t.memoizedState=r.state,o&&ud(t,n,!0),t.child}function oh(e){var t=e.stateNode;t.pendingContext?sd(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sd(e,t.context,!1),Nu(e,t.containerInfo)}function ih(e,t,n,r,o){return vr(),vu(o),t.flags|=256,Ae(e,t,n,r),t.child}var Bu={dehydrated:null,treeContext:null,retryLane:0};function Uu(e){return{baseLanes:e,cachePool:null,transitions:null}}function sh(e,t,n){var r=t.pendingProps,o=ge.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),ue(ge,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=ls(s,r,0,null),e=Dn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Uu(n),t.memoizedState=Bu,e):Wu(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return jv(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=xn(o,u),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=xn(l,i):(i=Dn(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?Uu(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Bu,r}return i=e.child,e=i.sibling,r=xn(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 Wu(e,t){return t=ls({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Gi(e,t,n,r){return r!==null&&vu(r),wr(t,e.child,null,n),e=Wu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jv(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=ju(Error(H(422))),Gi(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=ls({mode:"visible",children:r.children},o,0,null),i=Dn(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&wr(t,e.child,null,s),t.child.memoizedState=Uu(s),t.memoizedState=Bu,i);if(!(t.mode&1))return Gi(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(H(419)),r=ju(i,r,void 0),Gi(e,t,s,r)}if(l=(s&e.childLanes)!==0,Ve||l){if(r=Me,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,Ht(e,o),ht(r,e,o,-1))}return la(),r=ju(Error(H(421))),Gi(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=qv.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Qe=an(o.nextSibling),Ge=t,fe=!0,at=null,e!==null&&(Je[et++]=Ft,Je[et++]=Vt,Je[et++]=Pn,Ft=e.id,Vt=e.overflow,Pn=t),t=Wu(t,r.children),t.flags|=4096,t)}function lh(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),_u(e.return,t,n)}function Yu(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 uh(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ae(e,t,r.children,n),r=ge.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&&lh(e,n,t);else if(e.tag===19)lh(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(ue(ge,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&&Vi(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Yu(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&&Vi(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Yu(t,!0,n,null,i);break;case"together":Yu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Qi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ut(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(H(153));if(t.child!==null){for(e=t.child,n=xn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fv(e,t,n){switch(t.tag){case 3:oh(t),vr();break;case 5:_d(t);break;case 1:Fe(t.type)&&Ti(t);break;case 4:Nu(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;ue(Ai,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ue(ge,ge.current&1),t.flags|=128,null):n&t.child.childLanes?sh(e,t,n):(ue(ge,ge.current&1),e=Ut(e,t,n),e!==null?e.sibling:null);ue(ge,ge.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return uh(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ue(ge,ge.current),r)break;return null;case 22:case 23:return t.lanes=0,th(e,t,n)}return Ut(e,t,n)}var ah,Xu,ch,fh;ah=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}},Xu=function(){},ch=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,bn(Nt.current);var i=null;switch(n){case"input":o=_l(e,o),r=_l(e,r),i=[];break;case"select":o=pe({},o,{value:void 0}),r=pe({},r,{value:void 0}),i=[];break;case"textarea":o=Nl(e,o),r=Nl(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ii)}Ml(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"&&(Br.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"&&(Br.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)}},fh=function(e,t,n,r){n!==r&&(t.flags|=4)};function Co(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 $e(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 Vv(e,t,n){var r=t.pendingProps;switch(gu(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return Fe(t.type)&&Li(),$e(t),null;case 3:return r=t.stateNode,_r(),ce(je),ce(Te),Iu(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,at!==null&&(oa(at),at=null))),Xu(e,t),$e(t),null;case 5:Cu(t);var o=bn(Eo.current);if(n=t.type,e!==null&&t.stateNode!=null)ch(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(H(166));return $e(t),null}if(e=bn(Nt.current),Oi(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[kt]=t,r[mo]=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[kt]=t,e[mo]=r,ah(e,t,!1,!1),t.stateNode=e;e:{switch(s=Il(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;oCr&&(t.flags|=128,r=!0,Co(i,!1),t.lanes=4194304)}else{if(!r)if(e=Vi(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Co(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!fe)return $e(t),null}else 2*ve()-i.renderingStartTime>Cr&&n!==1073741824&&(t.flags|=128,r=!0,Co(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=ge.current,ue(ge,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return sa(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(H(156,t.tag))}function Hv(e,t){switch(gu(t),t.tag){case 1:return Fe(t.type)&&Li(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _r(),ce(je),ce(Te),Iu(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cu(t),null;case 13:if(ce(ge),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(H(340));vr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(ge),null;case 4:return _r(),null;case 10:return Eu(t.type._context),null;case 22:case 23:return sa(),null;case 24:return null;default:return null}}var Ki=!1,ze=!1,Bv=typeof WeakSet=="function"?WeakSet:Set,Y=null;function kr(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 Gu(e,t,n){try{n()}catch(r){ye(e,t,r)}}var dh=!1;function Uv(e,t){if(su=mi,e=Uf(),ql(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,f=0,c=e,d=null;t:for(;;){for(var g;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),(g=c.firstChild)!==null;)d=c,c=g;for(;;){if(c===e)break t;if(d===n&&++a===o&&(l=s),d===i&&++f===r&&(u=s),(g=c.nextSibling)!==null)break;c=d,d=c.parentNode}c=g}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(lu={focusedElem:e,selectionRange:n},mi=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var w=m.memoizedProps,x=m.memoizedState,p=t.stateNode,y=p.getSnapshotBeforeUpdate(t.elementType===t.type?w:ct(t.type,w),x);p.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(H(163))}}catch(v){ye(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return m=dh,dh=!1,m}function Mo(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&&Gu(t,n,i)}o=o.next}while(o!==r)}}function Zi(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 Qu(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 hh(e){var t=e.alternate;t!==null&&(e.alternate=null,hh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[mo],delete t[fu],delete t[Cv],delete t[Mv])),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 ph(e){return e.tag===5||e.tag===3||e.tag===4}function gh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ph(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 Ku(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=Ii));else if(r!==4&&(e=e.child,e!==null))for(Ku(e,t,n),e=e.sibling;e!==null;)Ku(e,t,n),e=e.sibling}function Zu(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(Zu(e,t,n),e=e.sibling;e!==null;)Zu(e,t,n),e=e.sibling}var Pe=null,ft=!1;function gn(e,t,n){for(n=n.child;n!==null;)mh(e,t,n),n=n.sibling}function mh(e,t,n){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(ci,n)}catch{}switch(n.tag){case 5:ze||kr(n,t);case 6:var r=Pe,o=ft;Pe=null,gn(e,t,n),Pe=r,ft=o,Pe!==null&&(ft?(e=Pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Pe.removeChild(n.stateNode));break;case 18:Pe!==null&&(ft?(e=Pe,n=n.stateNode,e.nodeType===8?cu(e.parentNode,n):e.nodeType===1&&cu(e,n),oo(e)):cu(Pe,n.stateNode));break;case 4:r=Pe,o=ft,Pe=n.stateNode.containerInfo,ft=!0,gn(e,t,n),Pe=r,ft=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)&&Gu(n,t,s),o=o.next}while(o!==r)}gn(e,t,n);break;case 1:if(!ze&&(kr(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)}gn(e,t,n);break;case 21:gn(e,t,n);break;case 22:n.mode&1?(ze=(r=ze)||n.memoizedState!==null,gn(e,t,n),ze=r):gn(e,t,n);break;default:gn(e,t,n)}}function yh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Bv),t.forEach(function(r){var o=Jv.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function dt(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*Yv(r/1960))-r,10e?16:e,yn===null)var r=!1;else{if(e=yn,yn=null,ns=0,oe&6)throw Error(H(331));var o=oe;for(oe|=4,Y=e.current;Y!==null;){var i=Y,s=i.child;if(Y.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uve()-ea?Rn(e,0):Ju|=n),Be(e,t)}function Lh(e,t){t===0&&(e.mode&1?(t=di,di<<=1,!(di&130023424)&&(di=4194304)):t=1);var n=De();e=Ht(e,t),e!==null&&(Jr(e,t,n),Be(e,n))}function qv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Lh(e,n)}function Jv(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(H(314))}r!==null&&r.delete(t),Lh(e,n)}var Th;Th=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||je.current)Ve=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ve=!1,Fv(e,t,n);Ve=!!(e.flags&131072)}else Ve=!1,fe&&t.flags&1048576&&cd(t,zi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Qi(e,t),e=t.pendingProps;var o=gr(t,Te.current);Er(t,n),o=Tu(null,t,r,e,o,n);var i=bu();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,Fe(r)?(i=!0,Ti(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ku(t),o.updater=Xi,t.stateNode=o,o._reactInternals=t,Du(t,r,e,n),t=Hu(null,t,r,!0,i,n)):(t.tag=0,fe&&i&&pu(t),Ae(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Qi(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=tw(r),e=ct(r,e),o){case 0:t=Vu(null,t,r,e,n);break e;case 1:t=rh(null,t,r,e,n);break e;case 11:t=qd(null,t,r,e,n);break e;case 14:t=Jd(null,t,r,ct(r.type,e),n);break e}throw Error(H(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),Vu(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),rh(e,t,r,o,n);case 3:e:{if(oh(t),e===null)throw Error(H(387));r=t.pendingProps,i=t.memoizedState,o=i.element,wd(e,t),Fi(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=Sr(Error(H(423)),t),t=ih(e,t,r,n,o);break e}else if(r!==o){o=Sr(Error(H(424)),t),t=ih(e,t,r,n,o);break e}else for(Qe=an(t.stateNode.containerInfo.firstChild),Ge=t,fe=!0,at=null,n=yd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vr(),r===o){t=Ut(e,t,n);break e}Ae(e,t,r,n)}t=t.child}return t;case 5:return _d(t),e===null&&yu(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,uu(r,o)?s=null:i!==null&&uu(r,i)&&(t.flags|=32),nh(e,t),Ae(e,t,s,n),t.child;case 6:return e===null&&yu(t),null;case 13:return sh(e,t,n);case 4:return Nu(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=wr(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:ct(r,o),qd(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,ue(Ai,r._currentValue),r._currentValue=s,i!==null)if(ut(i.value,s)){if(i.children===o.children&&!je.current){t=Ut(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=Bt(-1,n&-n),u.tag=2;var a=i.updateQueue;if(a!==null){a=a.shared;var f=a.pending;f===null?u.next=u:(u.next=f.next,f.next=u),a.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),_u(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(H(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),_u(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,Er(t,n),o=tt(o),r=r(o),t.flags|=1,Ae(e,t,r,n),t.child;case 14:return r=t.type,o=ct(r,t.pendingProps),o=ct(r.type,o),Jd(e,t,r,o,n);case 15:return eh(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ct(r,o),Qi(e,t),t.tag=1,Fe(r)?(e=!0,Ti(t)):e=!1,Er(t,n),Wd(t,r,o),Du(t,r,o,n),Hu(null,t,r,!0,e,n);case 19:return uh(e,t,n);case 22:return th(e,t,n)}throw Error(H(156,t.tag))};function bh(e,t){return ff(e,t)}function ew(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 ot(e,t,n,r){return new ew(e,t,n,r)}function ua(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tw(e){if(typeof e=="function")return ua(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pl)return 11;if(e===yl)return 14}return 2}function xn(e,t){var n=e.alternate;return n===null?(n=ot(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 ss(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")ua(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case nr:return Dn(n.children,o,i,t);case dl:s=8,o|=8;break;case hl:return e=ot(12,n,t,o|2),e.elementType=hl,e.lanes=i,e;case gl:return e=ot(13,n,t,o),e.elementType=gl,e.lanes=i,e;case ml:return e=ot(19,n,t,o),e.elementType=ml,e.lanes=i,e;case Fc:return ls(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Dc:s=10;break e;case jc:s=9;break e;case pl:s=11;break e;case yl:s=14;break e;case en:s=16,r=null;break e}throw Error(H(130,e==null?e:typeof e,""))}return t=ot(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Dn(e,t,n,r){return e=ot(7,e,r,t),e.lanes=n,e}function ls(e,t,n,r){return e=ot(22,e,r,t),e.elementType=Fc,e.lanes=n,e.stateNode={isHidden:!1},e}function aa(e,t,n){return e=ot(6,e,null,t),e.lanes=n,e}function ca(e,t,n){return t=ot(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function nw(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 fa(e,t,n,r,o,i,s,l,u){return e=new nw(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ot(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ku(i),e}function rw(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dh)}catch(e){console.error(e)}}Dh(),bc.exports=We;var uw=bc.exports,jh,Fh=uw;jh=Fh.createRoot,Fh.hydrateRoot;function Ee(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function ps(){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}})}gs.prototype=ps.prototype={constructor:gs,on:function(e,t){var n=this._,r=cw(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)),Hh.hasOwnProperty(t)?{space:Hh[t],local:e}:e}function dw(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ga&&t.documentElement.namespaceURI===ga?t.createElement(e):t.createElementNS(n,e)}}function hw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Bh(e){var t=ms(e);return(t.local?hw:dw)(t)}function pw(){}function ma(e){return e==null?pw:function(){return this.querySelector(e)}}function gw(e){typeof e!="function"&&(e=ma(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o=h&&(h=y+1);!(E=x[h])&&++h=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Fw(e){e||(e=Vw);function t(c,d){return c&&d?e(c.__data__,d.__data__):!c-!d}for(var n=this._groups,r=n.length,o=new Array(r),i=0;it?1:e>=t?0:NaN}function Hw(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bw(){return Array.from(this)}function Uw(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?t1:typeof t=="function"?r1:n1)(e,t,n??"")):Ir(this.node(),e)}function Ir(e,t){return e.style.getPropertyValue(t)||Gh(e).getComputedStyle(e,null).getPropertyValue(t)}function i1(e){return function(){delete this[e]}}function s1(e,t){return function(){this[e]=t}}function l1(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function u1(e,t){return arguments.length>1?this.each((t==null?i1:typeof t=="function"?l1:s1)(e,t)):this.node()[e]}function Qh(e){return e.trim().split(/^|\s+/)}function ya(e){return e.classList||new Kh(e)}function Kh(e){this._node=e,this._names=Qh(e.getAttribute("class")||"")}Kh.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 Zh(e,t){for(var n=ya(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 wa(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:l,dx:u,dy:a,dispatch:f}){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:f}})}wa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Y1(e){return!e.ctrlKey&&!e.button}function X1(){return this.parentNode}function G1(e,t){return t??{x:e.x,y:e.y}}function Q1(){return navigator.maxTouchPoints||"ontouchstart"in this}function rp(){var e=Y1,t=X1,n=G1,r=Q1,o={},i=ps("start","drag","end"),s=0,l,u,a,f,c=0;function d(v){v.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",p,W1).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(v,E){if(!(f||!e.call(this,v,E))){var _=h(this,t.call(this,v,E),v,E,"mouse");_&&(qe(v.view).on("mousemove.drag",m,$o).on("mouseup.drag",w,$o),tp(v.view),va(v),a=!1,l=v.clientX,u=v.clientY,_("start",v))}}function m(v){if(Pr(v),!a){var E=v.clientX-l,_=v.clientY-u;a=E*E+_*_>c}o.mouse("drag",v)}function w(v){qe(v.view).on("mousemove.drag mouseup.drag",null),np(v.view,a),Pr(v),o.mouse("end",v)}function x(v,E){if(e.call(this,v,E)){var _=v.changedTouches,k=t.call(this,v,E),C=_.length,b,j;for(b=0;b>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?xs(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?xs(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=Z1.exec(e))?new Ue(t[1],t[2],t[3],1):(t=q1.exec(e))?new Ue(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=J1.exec(e))?xs(t[1],t[2],t[3],t[4]):(t=ex.exec(e))?xs(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tx.exec(e))?fp(t[1],t[2]/100,t[3]/100,1):(t=nx.exec(e))?fp(t[1],t[2]/100,t[3]/100,t[4]):ip.hasOwnProperty(e)?up(ip[e]):e==="transparent"?new Ue(NaN,NaN,NaN,0):null}function up(e){return new Ue(e>>16&255,e>>8&255,e&255,1)}function xs(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ue(e,t,n,r)}function ix(e){return e instanceof zo||(e=jn(e)),e?(e=e.rgb(),new Ue(e.r,e.g,e.b,e.opacity)):new Ue}function Ea(e,t,n,r){return arguments.length===1?ix(e):new Ue(e,t,n,r??1)}function Ue(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}xa(Ue,Ea,op(zo,{brighter(e){return e=e==null?ws:Math.pow(ws,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new Ue(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ue(Fn(this.r),Fn(this.g),Fn(this.b),Es(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:ap,formatHex:ap,formatHex8:sx,formatRgb:cp,toString:cp}));function ap(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function sx(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn((isNaN(this.opacity)?1:this.opacity)*255)}`}function cp(){const e=Es(this.opacity);return`${e===1?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${e===1?")":`, ${e})`}`}function Es(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return e=Fn(e),(e<16?"0":"")+e.toString(16)}function fp(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new gt(e,t,n,r)}function dp(e){if(e instanceof gt)return new gt(e.h,e.s,e.l,e.opacity);if(e instanceof zo||(e=jn(e)),!e)return new gt;if(e instanceof gt)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 gt(s,l,u,e.opacity)}function lx(e,t,n,r){return arguments.length===1?dp(e):new gt(e,t,n,r??1)}function gt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}xa(gt,lx,op(zo,{brighter(e){return e=e==null?ws:Math.pow(ws,e),new gt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new gt(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 Ue(_a(e>=240?e-240:e+120,o,r),_a(e,o,r),_a(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new gt(hp(this.h),_s(this.s),_s(this.l),Es(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=Es(this.opacity);return`${e===1?"hsl(":"hsla("}${hp(this.h)}, ${_s(this.s)*100}%, ${_s(this.l)*100}%${e===1?")":`, ${e})`}`}}));function hp(e){return e=(e||0)%360,e<0?e+360:e}function _s(e){return Math.max(0,Math.min(1,e||0))}function _a(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 Sa=e=>()=>e;function ux(e,t){return function(n){return e+n*t}}function ax(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 cx(e){return(e=+e)==1?pp:function(t,n){return n-t?ax(t,n,e):Sa(isNaN(t)?n:t)}}function pp(e,t){var n=t-e;return n?ux(e,n):Sa(isNaN(e)?t:e)}const Ss=function e(t){var n=cx(t);function r(o,i){var s=n((o=Ea(o)).r,(i=Ea(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),a=pp(o.opacity,i.opacity);return function(f){return o.r=s(f),o.g=l(f),o.b=u(f),o.opacity=a(f),o+""}}return r.gamma=e,r}(1);function fx(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:Pt(r,o)})),n=Na.lastIndex;return n180?f+=360:f-a>180&&(a+=360),d.push({i:c.push(o(c)+"rotate(",null,r)-2,x:Pt(a,f)})):f&&c.push(o(c)+"rotate("+f+r)}function l(a,f,c,d){a!==f?d.push({i:c.push(o(c)+"skewX(",null,r)-2,x:Pt(a,f)}):f&&c.push(o(c)+"skewX("+f+r)}function u(a,f,c,d,g,m){if(a!==c||f!==d){var w=g.push(o(g)+"scale(",null,",",null,")");m.push({i:w-4,x:Pt(a,c)},{i:w-2,x:Pt(f,d)})}else(c!==1||d!==1)&&g.push(o(g)+"scale("+c+","+d+")")}return function(a,f){var c=[],d=[];return a=e(a),f=e(f),i(a.translateX,a.translateY,f.translateX,f.translateY,c,d),s(a.rotate,f.rotate,c,d),l(a.skewX,f.skewX,c,d),u(a.scaleX,a.scaleY,f.scaleX,f.scaleY,c,d),a=f=null,function(g){for(var m=-1,w=d.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Tr}function Sp(){Hn=(Ms=Vo.now())+Is,Tr=Do=0;try{Cx()}finally{Tr=0,Ix(),Hn=0}}function Mx(){var e=Vo.now(),t=e-Ms;t>xp&&(Is-=t,Ms=e)}function Ix(){for(var e,t=Cs,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:Cs=n);Fo=e,Ia(r)}function Ia(e){if(!Tr){Do&&(Do=clearTimeout(Do));var t=e-Hn;t>24?(e<1/0&&(Do=setTimeout(Sp,e-Vo.now()-Is)),jo&&(jo=clearInterval(jo))):(jo||(Ms=Vo.now(),jo=setInterval(Mx,xp)),Tr=1,Ep(Sp))}}function kp(e,t,n){var r=new Ps;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Px=ps("start","end","cancel","interrupt"),Lx=[],Np=0,Cp=1,Pa=2,Ls=3,Mp=4,La=5,Ts=6;function bs(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Tx(e,n,{name:t,index:r,group:o,on:Px,tween:Lx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Np})}function Ta(e,t){var n=mt(e,t);if(n.state>Np)throw new Error("too late; already scheduled");return n}function Lt(e,t){var n=mt(e,t);if(n.state>Ls)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 Tx(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=_p(i,0,n.time);function i(a){n.state=Cp,n.timer.restart(s,n.delay,n.time),n.delay<=a&&s(a-n.delay)}function s(a){var f,c,d,g;if(n.state!==Cp)return u();for(f in r)if(g=r[f],g.name===n.name){if(g.state===Ls)return kp(s);g.state===Mp?(g.state=Ts,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[f]):+fPa&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function lE(e,t,n){var r,o,i=sE(t)?Ta:Lt;return function(){var s=i(this,e),l=s.on;l!==r&&(o=(r=l).copy()).on(t,n),s.on=o}}function uE(e,t){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(e):this.each(lE(n,e,t))}function aE(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function cE(){return this.on("end.remove",aE(this._id))}function fE(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ma(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 Gt(e,t,n){this.k=e,this.x=t,this.y=n}Gt.prototype={constructor:Gt,scale:function(e){return e===1?this:new Gt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Gt(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 Os=new Gt(1,0,0);Tp.prototype=Gt.prototype;function Tp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Os;return e.__zoom}function $a(e){e.stopImmediatePropagation()}function Ho(e){e.preventDefault(),e.stopImmediatePropagation()}function AE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function DE(){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 bp(){return this.__zoom||Os}function jE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function FE(){return navigator.maxTouchPoints||"ontouchstart"in this}function VE(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 $p(){var e=AE,t=DE,n=VE,r=jE,o=FE,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Ns,a=ps("start","zoom","end"),f,c,d,g=500,m=150,w=0,x=10;function p(S){S.property("__zoom",bp).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",b).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",T).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(S,$,L,z){var M=S.selection?S.selection():S;M.property("__zoom",bp),S!==M?E(S,$,L,z):M.interrupt().each(function(){_(this,arguments).event(z).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},p.scaleBy=function(S,$,L,z){p.scaleTo(S,function(){var M=this.__zoom.k,N=typeof $=="function"?$.apply(this,arguments):$;return M*N},L,z)},p.scaleTo=function(S,$,L,z){p.transform(S,function(){var M=t.apply(this,arguments),N=this.__zoom,P=L==null?v(M):typeof L=="function"?L.apply(this,arguments):L,A=N.invert(P),O=typeof $=="function"?$.apply(this,arguments):$;return n(h(y(N,O),P,A),M,s)},L,z)},p.translateBy=function(S,$,L,z){p.transform(S,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),s)},null,z)},p.translateTo=function(S,$,L,z,M){p.transform(S,function(){var N=t.apply(this,arguments),P=this.__zoom,A=z==null?v(N):typeof z=="function"?z.apply(this,arguments):z;return n(Os.translate(A[0],A[1]).scale(P.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof L=="function"?-L.apply(this,arguments):-L),N,s)},z,M)};function y(S,$){return $=Math.max(i[0],Math.min(i[1],$)),$===S.k?S:new Gt($,S.x,S.y)}function h(S,$,L){var z=$[0]-L[0]*S.k,M=$[1]-L[1]*S.k;return z===S.x&&M===S.y?S:new Gt(S.k,z,M)}function v(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function E(S,$,L,z){S.on("start.zoom",function(){_(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(z).end()}).tween("zoom",function(){var M=this,N=arguments,P=_(M,N).event(z),A=t.apply(M,N),O=L==null?v(A):typeof L=="function"?L.apply(M,N):L,U=Math.max(A[1][0]-A[0][0],A[1][1]-A[0][1]),B=M.__zoom,X=typeof $=="function"?$.apply(M,N):$,q=u(B.invert(O).concat(U/B.k),X.invert(O).concat(U/X.k));return function(Q){if(Q===1)Q=X;else{var F=q(Q),W=U/F[2];Q=new Gt(W,O[0]-F[0]*W,O[1]-F[1]*W)}P.zoom(null,Q)}})}function _(S,$,L){return!L&&S.__zooming||new k(S,$)}function k(S,$){this.that=S,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,$),this.taps=0}k.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,$){return this.mouse&&S!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var $=qe(this.that).datum();a.call(S,this.that,new RE(S,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:a}),$)}};function C(S,...$){if(!e.apply(this,arguments))return;var L=_(this,$).event(S),z=this.__zoom,M=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),N=pt(S);if(L.wheel)(L.mouse[0][0]!==N[0]||L.mouse[0][1]!==N[1])&&(L.mouse[1]=z.invert(L.mouse[0]=N)),clearTimeout(L.wheel);else{if(z.k===M)return;L.mouse=[N,z.invert(N)],$s(this),L.start()}Ho(S),L.wheel=setTimeout(P,m),L.zoom("mouse",n(h(y(z,M),L.mouse[0],L.mouse[1]),L.extent,s));function P(){L.wheel=null,L.end()}}function b(S,...$){if(d||!e.apply(this,arguments))return;var L=S.currentTarget,z=_(this,$,!0).event(S),M=qe(S.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",U,!0),N=pt(S,L),P=S.clientX,A=S.clientY;tp(S.view),$a(S),z.mouse=[N,this.__zoom.invert(N)],$s(this),z.start();function O(B){if(Ho(B),!z.moved){var X=B.clientX-P,q=B.clientY-A;z.moved=X*X+q*q>w}z.event(B).zoom("mouse",n(h(z.that.__zoom,z.mouse[0]=pt(B,L),z.mouse[1]),z.extent,s))}function U(B){M.on("mousemove.zoom mouseup.zoom",null),np(B.view,z.moved),Ho(B),z.event(B).end()}}function j(S,...$){if(e.apply(this,arguments)){var L=this.__zoom,z=pt(S.changedTouches?S.changedTouches[0]:S,this),M=L.invert(z),N=L.k*(S.shiftKey?.5:2),P=n(h(y(L,N),z,M),t.apply(this,$),s);Ho(S),l>0?qe(this).transition().duration(l).call(E,P,z,S):qe(this).call(p.transform,P,z,S)}}function T(S,...$){if(e.apply(this,arguments)){var L=S.touches,z=L.length,M=_(this,$,S.changedTouches.length===z).event(S),N,P,A,O;for($a(S),P=0;P`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Bo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],zp=["Enter"," ","Escape"],Op={"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 br;(function(e){e.Strict="strict",e.Loose="loose"})(br||(br={}));var Bn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Bn||(Bn={}));var Uo;(function(e){e.Partial="partial",e.Full="full"})(Uo||(Uo={}));const Rp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var En;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(En||(En={}));var Rs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rs||(Rs={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Ap={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Dp(e){return e===null?null:e?"valid":"invalid"}const jp=e=>"id"in e&&"source"in e&&"target"in e,HE=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),Wo=(e,t=[0,0])=>{const{width:n,height:r}=Qt(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},BE=(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?js(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return As(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ds(n)},Yo=(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=As(n,js(o)),r=!0)}),r?Ds(n):{x:0,y:0,width:0,height:0}},Oa=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const l={...Or(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const a of e.values()){const{measured:f,selectable:c=!0,hidden:d=!1}=a;if(s&&!c||d)continue;const g=f.width??a.width??a.initialWidth??null,m=f.height??a.height??a.initialHeight??null,w=Xo(l,zr(a)),x=(g??0)*(m??0),p=i&&w>0;(!a.internals.handleBounds||p||w>=x||a.dragging)&&u.push(a)}return u},UE=(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 WE(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 YE({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const l=WE(e,s),u=Yo(l),a=Da(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}),!0}function Fp({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},f=s.origin??r;let c=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!l)i==null||i("005",yt.error005());else{const g=l.measured.width,m=l.measured.height;g&&m&&(c=[[u,a],[u+g,a+m]])}else l&&Wn(s.extent)&&(c=[[s.extent[0][0]+u,s.extent[0][1]+a],[s.extent[1][0]+u,s.extent[1][1]+a]]);const d=Wn(c)?Un(t,c,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",yt.error015())),{position:{x:d.x-u+(s.measured.width??0)*f[0],y:d.y-a+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function XE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const g=i.has(d.id),m=!g&&d.parentId&&s.find(w=>w.id===d.parentId);(g||m)&&s.push(d)}const l=new Set(t.map(d=>d.id)),u=r.filter(d=>d.deletable!==!1),f=UE(s,u);for(const d of u)l.has(d.id)&&!f.find(m=>m.id===d.id)&&f.push(d);if(!o)return{edges:f,nodes:s};const c=await o({nodes:s,edges:f});return typeof c=="boolean"?c?{edges:f,nodes:s}:{edges:[],nodes:[]}:c}const $r=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Un=(e={x:0,y:0},t,n)=>({x:$r(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:$r(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Vp(e,t,n){const{width:r,height:o}=Qt(n),{x:i,y:s}=n.internals.positionAbsolute;return Un(e,[[i,s],[i+r,s+o]],t)}const Hp=(e,t,n)=>en?-$r(Math.abs(e-n),1,t)/t:0,Ra=(e,t,n=15,r=40)=>{const o=Hp(e.x,r,t.width-r)*n,i=Hp(e.y,r,t.height-r)*n;return[o,i]},As=(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)}),Aa=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ds=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),zr=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=za(e)?e.internals.positionAbsolute:Wo(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}},js=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=za(e)?e.internals.positionAbsolute:Wo(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)}},Bp=(e,t)=>Ds(As(Aa(e),Aa(t))),Xo=(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)},Up=e=>vt(e.width)&&vt(e.height)&&vt(e.x)&&vt(e.y),vt=e=>!isNaN(e)&&isFinite(e),Wp=(e,t)=>(n,r)=>{},Go=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Or=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Go(l,s):l},Rr=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ar(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(`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=Ar(e,n),o=Ar(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ar(e.top??e.y??0,n),o=Ar(e.bottom??e.y??0,n),i=Ar(e.left??e.x??0,t),s=Ar(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 QE(e,t,n,r,o,i){const{x:s,y:l}=Rr(e,[t,n,r]),{x:u,y:a}=Rr({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=o-u,c=i-a;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(c)}}const Da=(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),f=$r(a,r,o),c=e.x+e.width/2,d=e.y+e.height/2,g=t/2-c*f,m=n/2-d*f,w=QE(e,g,m,f,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:g-x.left+x.right,y:m-x.top+x.bottom,zoom:f}},Qo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Wn(e){return e!=null&&e!=="parent"}function Qt(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 Yp(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 Xp(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 Gp(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function KE(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ZE(e){return{...Op,...e||{}}}function Ko(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=wt(e),l=Or({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:u,y:a}=n?Go(l,t):l;return{xSnapped:u,ySnapped:a,...l}}const ja=e=>({width:e.offsetWidth,height:e.offsetHeight}),Qp=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},qE=["INPUT","SELECT","TEXTAREA"];function Kp(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:qE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Zp=e=>"clientX"in e,wt=(e,t)=>{var i,s;const n=Zp(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)}},qp=(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 Jp({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,f=Math.abs(u-e),c=Math.abs(a-t);return[u,a,f,c]}function Fs(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eg({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case G.Left:return[t-Fs(t-r,i),n];case G.Right:return[t+Fs(r-t,i),n];case G.Top:return[t,n-Fs(n-o,i)];case G.Bottom:return[t,n+Fs(o-n,i)]}}function tg({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[l,u]=eg({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[a,f]=eg({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[c,d,g,m]=Jp({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:a,targetControlY:f});return[`M${e},${t} C${l},${u} ${a},${f} ${r},${o}`,c,d,g,m]}function ng({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n0}const t_=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,n_=(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)),r_=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",yt.error006()),t;const r=n.getEdgeId||t_;let o;return jp(e)?o={...e}:o={...e,id:r(e)},n_(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function rg({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,l]=ng({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,l]}const og={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},o_=({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 i_({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const l=og[t],u=og[r],a={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+u.x*i,y:n.y+u.y*i},c=o_({source:a,sourcePosition:t,target:f}),d=c.x!==0?"x":"y",g=c[d];let m=[],w,x;const p={x:0,y:0},y={x:0,y:0},[,,h,v]=ng({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[d]*u[d]===-1){d==="x"?(w=o.x??a.x+(f.x-a.x)*s,x=o.y??(a.y+f.y)/2):(w=o.x??(a.x+f.x)/2,x=o.y??a.y+(f.y-a.y)*s);const C=[{x:w,y:a.y},{x:w,y:f.y}],b=[{x:a.x,y:x},{x:f.x,y:x}];l[d]===g?m=d==="x"?C:b:m=d==="x"?b:C}else{const C=[{x:a.x,y:f.y}],b=[{x:f.x,y:a.y}];if(d==="x"?m=l.x===g?b:C:m=l.y===g?C:b,t===r){const S=Math.abs(e[d]-n[d]);if(S<=i){const $=Math.min(i-1,i-S);l[d]===g?p[d]=(a[d]>e[d]?-1:1)*$:y[d]=(f[d]>n[d]?-1:1)*$}}if(t!==r){const S=d==="x"?"y":"x",$=l[d]===u[S],L=a[S]>f[S],z=a[S]=V?(w=(j.x+T.x)/2,x=m[0].y):(w=m[0].x,x=(j.y+T.y)/2)}const E={x:a.x+p.x,y:a.y+p.y},_={x:f.x+y.x,y:f.y+y.y};return[[e,...E.x!==m[0].x||E.y!==m[0].y?[E]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],w,x,h,v]}function s_(e,t,n,r){const o=Math.min(ig(e,t)/2,ig(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.xn.id===t):e[0])||null}function Va(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function u_(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=Va(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 ag=1e3,a_=10,Ha={nodeOrigin:[0,0],nodeExtent:Bo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},c_={...Ha,checkEquality:!0};function Ba(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function f_(e,t,n){const r=Ba(Ha,n);for(const o of e.values())if(o.parentId)Ya(o,e,t,r);else{const i=Wo(o,r.nodeOrigin),s=Wn(o.extent)?o.extent:r.nodeExtent,l=Un(i,s,Qt(o));o.internals.positionAbsolute=l}}function d_(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 Ua(e){return e==="manual"}function Wa(e,t,n,r={}){var f,c;const o=Ba(c_,r),i={i:0},s=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!Ua(o.zIndexMode)?ag:0;let u=e.length>0,a=!1;t.clear(),n.clear();for(const d of e){let g=s.get(d.id);if(o.checkEquality&&d===(g==null?void 0:g.internals.userNode))t.set(d.id,g);else{const m=Wo(d,o.nodeOrigin),w=Wn(d.extent)?d.extent:o.nodeExtent,x=Un(m,w,Qt(d));g={...o.defaults,...d,measured:{width:(f=d.measured)==null?void 0:f.width,height:(c=d.measured)==null?void 0:c.height},internals:{positionAbsolute:x,handleBounds:d_(d,g),z:cg(d,l,o.zIndexMode),userNode:d}},t.set(d.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(u=!1),d.parentId&&Ya(g,t,n,r,i),a||(a=d.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:a}}function h_(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 Ya(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:l,zIndexMode:u}=Ba(Ha,r),a=e.parentId,f=t.get(a);if(!f){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}h_(e,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&u==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*a_),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const c=i&&!Ua(u)?ag:0,{x:d,y:g,z:m}=p_(e,f,s,l,c,u),{positionAbsolute:w}=e.internals,x=d!==w.x||g!==w.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:d,y:g}:w,z:m}})}function cg(e,t,n){const r=vt(e.zIndex)?e.zIndex:0;return Ua(n)?r:r+(e.selected?t:0)}function p_(e,t,n,r,o,i){const{x:s,y:l}=t.internals.positionAbsolute,u=Qt(e),a=Wo(e,n),f=Wn(e.extent)?Un(a,e.extent,u):a;let c=Un({x:s+f.x,y:l+f.y},r,u);e.extent==="parent"&&(c=Vp(c,u,t));const d=cg(e,o,i),g=t.internals.z??0;return{x:c.x,y:c.y,z:g>=d?g+1:d}}function Xa(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)??zr(u),f=Bp(a,l.rect);i.set(l.parentId,{expandedRect:f,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},a)=>{var h;const f=u.internals.positionAbsolute,c=Qt(u),d=u.origin??r,g=l.x0||m>0||p||y)&&(o.push({id:a,type:"position",position:{x:u.position.x-g+p,y:u.position.y-m+y}}),(h=n.get(a))==null||h.forEach(v=>{e.some(E=>E.id===v.id)||o.push({id:v.id,type:"position",position:{x:v.position.x+g,y:v.position.y+m}})})),(c.width0){const g=Xa(d,t,n,o);a.push(...g)}return{changes:a,updatedInternals:u}}async function m_({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function fg(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 dg(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}`,f=`${i}-${l}--${o}-${s}`;fg("source",u,f,e,o,s),fg("target",u,a,e,i,l),t.set(r.id,r)}}function hg(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:hg(n,t):!1}function pg(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 y_(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!hg(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 Ga({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,l,u;const o=[];for(const[a,f]of t){const c=(s=n.get(a))==null?void 0:s.internals.userNode;c&&o.push({...c,position:f.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 v_({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=Go(i,t);return{x:s.x-i.x,y:s.y-i.y}}function w_({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},f=null,c=!1,d=null,g=!1,m=!1,w=null;function x({noDragClassName:y,handleSelector:h,domNode:v,isSelectable:E,nodeId:_,nodeClickDistance:k=0}){d=qe(v);function C({x:R,y:V}){const{nodeLookup:S,nodeExtent:$,snapGrid:L,snapToGrid:z,nodeOrigin:M,onNodeDrag:N,onSelectionDrag:P,onError:A,updateNodePositions:O}=t();i={x:R,y:V};let U=!1;const B=l.size>1,X=B&&$?Aa(Yo(l)):null,q=B&&z?v_({dragItems:l,snapGrid:L,x:R,y:V}):null;for(const[Q,F]of l){if(!S.has(Q))continue;let W={x:R-F.distance.x,y:V-F.distance.y};z&&(W=q?{x:Math.round(W.x+q.x),y:Math.round(W.y+q.y)}:Go(W,L));let ee=null;if(B&&$&&!F.extent&&X){const{positionAbsolute:K}=F.internals,ne=K.x-X.x+$[0][0],ie=K.x+F.measured.width-X.x2+$[1][0],le=K.y-X.y+$[0][1],we=K.y+F.measured.height-X.y2+$[1][1];ee=[[ne,le],[ie,we]]}const{position:J,positionAbsolute:Z}=Fp({nodeId:Q,nextPosition:W,nodeLookup:S,nodeExtent:ee||$,nodeOrigin:M,onError:A});U=U||F.position.x!==J.x||F.position.y!==J.y,F.position=J,F.internals.positionAbsolute=Z}if(m=m||U,!!U&&(O(l,!0),w&&(r||N||!_&&P))){const[Q,F]=Ga({nodeId:_,dragItems:l,nodeLookup:S});r==null||r(w,l,Q,F),N==null||N(w,Q,F),_||P==null||P(w,F)}}async function b(){if(!f)return;const{transform:R,panBy:V,autoPanSpeed:S,autoPanOnNodeDrag:$}=t();if(!$){u=!1,cancelAnimationFrame(s);return}const[L,z]=Ra(a,f,S);(L!==0||z!==0)&&(i.x=(i.x??0)-L/R[2],i.y=(i.y??0)-z/R[2],await V({x:L,y:z})&&C(i)),s=requestAnimationFrame(b)}function j(R){var B;const{nodeLookup:V,multiSelectionActive:S,nodesDraggable:$,transform:L,snapGrid:z,snapToGrid:M,selectNodesOnDrag:N,onNodeDragStart:P,onSelectionDragStart:A,unselectNodesAndEdges:O}=t();c=!0,(!N||!E)&&!S&&_&&((B=V.get(_))!=null&&B.selected||O()),E&&N&&_&&(e==null||e(_));const U=Ko(R.sourceEvent,{transform:L,snapGrid:z,snapToGrid:M,containerBounds:f});if(i=U,l=y_(V,$,U,_),l.size>0&&(n||P||!_&&A)){const[X,q]=Ga({nodeId:_,dragItems:l,nodeLookup:V});n==null||n(R.sourceEvent,l,X,q),P==null||P(R.sourceEvent,X,q),_||A==null||A(R.sourceEvent,q)}}const T=rp().clickDistance(k).on("start",R=>{const{domNode:V,nodeDragThreshold:S,transform:$,snapGrid:L,snapToGrid:z}=t();f=(V==null?void 0:V.getBoundingClientRect())||null,g=!1,m=!1,w=R.sourceEvent,S===0&&j(R),i=Ko(R.sourceEvent,{transform:$,snapGrid:L,snapToGrid:z,containerBounds:f}),a=wt(R.sourceEvent,f)}).on("drag",R=>{const{autoPanOnNodeDrag:V,transform:S,snapGrid:$,snapToGrid:L,nodeDragThreshold:z,nodeLookup:M}=t(),N=Ko(R.sourceEvent,{transform:S,snapGrid:$,snapToGrid:L,containerBounds:f});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!M.has(_))&&(g=!0),!g){if(!u&&V&&c&&(u=!0,b()),!c){const P=wt(R.sourceEvent,f),A=P.x-a.x,O=P.y-a.y;Math.sqrt(A*A+O*O)>z&&j(R)}(i.x!==N.xSnapped||i.y!==N.ySnapped)&&l&&c&&(a=wt(R.sourceEvent,f),C(N))}}).on("end",R=>{if(!c||g){g&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,c=!1,cancelAnimationFrame(s),l.size>0){const{nodeLookup:V,updateNodePositions:S,onNodeDragStop:$,onSelectionDragStop:L}=t();if(m&&(S(l,!1),m=!1),o||$||!_&&L){const[z,M]=Ga({nodeId:_,dragItems:l,nodeLookup:V,dragging:!1});o==null||o(R.sourceEvent,l,z,M),$==null||$(R.sourceEvent,z,M),_||L==null||L(R.sourceEvent,M)}}}).filter(R=>{const V=R.target;return!R.button&&(!y||!pg(V,`.${y}`,v))&&(!h||pg(V,h,v))});d.call(T)}function p(){d==null||d.on(".drag",null)}return{update:x,destroy:p}}function x_(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())Xo(o,zr(i))>0&&r.push(i);return r}const E_=250;function __(e,t,n,r){var l,u;let o=[],i=1/0;const s=x_(e,n,t+E_);for(const a of s){const f=[...((l=a.internals.handleBounds)==null?void 0:l.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of f){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:d,y:g}=Yn(a,c,c.position,!0),m=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(g-e.y,2));m>t||(m1){const a=r.type==="source"?"target":"source";return o.find(f=>f.type===a)??o[0]}return o[0]}function gg(e,t,n,r,o,i=!1){var a,f,c;const s=r.get(e);if(!s)return null;const l=o==="strict"?(a=s.internals.handleBounds)==null?void 0:a[t]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((c=s.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?l==null?void 0:l.find(d=>d.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Yn(s,u,u.position,!0)}:u}function mg(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function S_(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const yg=()=>!0;function k_(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:l,nodeLookup:u,lib:a,autoPanOnConnect:f,flowId:c,panBy:d,cancelConnection:g,onConnectStart:m,onConnect:w,onConnectEnd:x,isValidConnection:p=yg,onReconnectEnd:y,updateConnection:h,getTransform:v,getFromHandle:E,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:C}){const b=Qp(e.target);let j=0,T;const{x:R,y:V}=wt(e),S=mg(i,C),$=l==null?void 0:l.getBoundingClientRect();let L=!1;if(!$||!S)return;const z=gg(o,S,r,u,t);if(!z)return;let M=wt(e,$),N=!1,P=null,A=!1,O=null;function U(){if(!f||!$)return;const[J,Z]=Ra(M,$,_);d({x:J,y:Z}),j=requestAnimationFrame(U)}const B={...z,nodeId:o,type:S,position:z.position},X=u.get(o);let Q={inProgress:!0,isValid:null,from:Yn(X,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:M,toHandle:null,toPosition:Ap[B.position],toNode:null,pointer:M};function F(){L=!0,h(Q),m==null||m(e,{nodeId:o,handleId:r,handleType:S})}k===0&&F();function W(J){if(!L){const{x:we,y:st}=wt(J),bt=we-R,$t=st-V;if(!(bt*bt+$t*$t>k*k))return;F()}if(!E()||!B){ee(J);return}const Z=v();M=wt(J,$),T=__(Or(M,Z,!1,[1,1]),n,u,B),N||(U(),N=!0);const K=vg(J,{handle:T,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:p,doc:b,lib:a,flowId:c,nodeLookup:u});O=K.handleDomNode,P=K.connection,A=S_(!!T,K.isValid);const ne=u.get(o),ie=ne?Yn(ne,B,G.Left,!0):Q.from,le={...Q,from:ie,isValid:A,to:K.toHandle&&A?Rr({x:K.toHandle.x,y:K.toHandle.y},Z):M,toHandle:K.toHandle,toPosition:A&&K.toHandle?K.toHandle.position:Ap[B.position],toNode:K.toHandle?u.get(K.toHandle.nodeId):null,pointer:M};h(le),Q=le}function ee(J){if(!("touches"in J&&J.touches.length>0)){if(L){(T||O)&&P&&A&&(w==null||w(P));const{inProgress:Z,...K}=Q,ne={...K,toPosition:Q.toHandle?Q.toPosition:null};x==null||x(J,ne),i&&(y==null||y(J,ne))}g(),cancelAnimationFrame(j),N=!1,A=!1,P=null,O=null,b.removeEventListener("mousemove",W),b.removeEventListener("mouseup",ee),b.removeEventListener("touchmove",W),b.removeEventListener("touchend",ee)}}b.addEventListener("mousemove",W),b.addEventListener("mouseup",ee),b.addEventListener("touchmove",W),b.addEventListener("touchend",ee)}function vg(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:l,flowId:u,isValidConnection:a=yg,nodeLookup:f}){const c=i==="target",d=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:g,y:m}=wt(e),w=s.elementFromPoint(g,m),x=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:d,p={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const y=mg(void 0,x),h=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),E=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!h||!y)return p;const k={source:c?h:r,sourceHandle:c?v:o,target:c?r:h,targetHandle:c?o:v};p.connection=k;const b=E&&_&&(n===br.Strict?c&&y==="source"||!c&&y==="target":h!==r||v!==o);p.isValid=b&&a(k),p.toHandle=gg(h,y,v,f,n,!0)}return p}const Qa={onPointerDown:k_,isValid:vg};function N_({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=qe(e);function i({translateExtent:l,width:u,height:a,zoomStep:f=1,pannable:c=!0,zoomable:d=!0,inversePan:g=!1}){const m=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const v=n(),E=h.sourceEvent.ctrlKey&&Qo()?10:1,_=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*f,k=v[2]*Math.pow(2,_*E);t.scaleTo(k)};let w=[0,0];const x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},p=h=>{const v=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const E=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],_=[E[0]-w[0],E[1]-w[1]];w=E;const k=r()*Math.max(v[2],Math.log(v[2]))*(g?-1:1),C={x:v[0]-_[0]*k,y:v[1]-_[1]*k},b=[[0,0],[u,a]];t.setViewportConstrained({x:C.x,y:C.y,zoom:v[2]},b,l)},y=$p().on("start",x).on("zoom",c?p:null).on("zoom.wheel",d?m:null);o.call(y,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:pt}}const Vs=e=>({x:e.x,y:e.y,zoom:e.k}),Ka=({x:e,y:t,zoom:n})=>Os.translate(e,t).scale(n),Dr=(e,t)=>e.target.closest(`.${t}`),wg=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),C_=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Za=(e,t=0,n=C_,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},xg=e=>{const t=e.ctrlKey&&Qo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function M_({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:a}){return f=>{if(Dr(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(f.ctrlKey&&s){const x=pt(f),p=xg(f),y=c*Math.pow(2,p);r.scaleTo(n,y,x,f);return}const d=f.deltaMode===1?20:1;let g=o===Bn.Vertical?0:f.deltaX*d,m=o===Bn.Horizontal?0:f.deltaY*d;!Qo()&&f.shiftKey&&o!==Bn.Vertical&&(g=f.deltaY*d,m=0),r.translateBy(n,-(g/c)*i,-(m/c)*i,{internal:!0});const w=Vs(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(f,w),e.panScrollTimeout=setTimeout(()=>{a==null||a(f,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,w))}}function I_({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,l=Dr(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),s||l)return null;r.preventDefault(),n.call(this,r,o)}}function P_({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Vs(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 L_({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,l;e.usedRightMouseButton=!!(n&&wg(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,Vs(i.transform)))}}function T_({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&&wg(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=Vs(s.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,u)},n?150:0)}}}function b_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:l,noPanClassName:u,lib:a,connectionInProgress:f}){return c=>{var x;const d=e||t,g=n&&c.ctrlKey,m=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(Dr(c,`${a}-flow__node`)||Dr(c,`${a}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||f&&!m||Dr(c,l)&&m||Dr(c,u)&&(!m||o&&m&&!e)||!n&&c.ctrlKey&&m)return!1;if(!n&&c.type==="touchstart"&&((x=c.touches)==null?void 0:x.length)>1)return c.preventDefault(),!1;if(!d&&!o&&!g&&m||!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||m)&&w}}function $_({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},f=e.getBoundingClientRect(),c=$p().scaleExtent([t,n]).translateExtent(r),d=qe(e).call(c);y({x:o.x,y:o.y,zoom:$r(o.zoom,t,n)},[[0,0],[f.width,f.height]],r);const g=d.on("wheel.zoom"),m=d.on("dblclick.zoom");c.wheelDelta(xg);async function w(T,R){return d?new Promise(V=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).transform(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}function x({noWheelClassName:T,noPanClassName:R,onPaneContextMenu:V,userSelectionActive:S,panOnScroll:$,panOnDrag:L,panOnScrollMode:z,panOnScrollSpeed:M,preventScrolling:N,zoomOnPinch:P,zoomOnScroll:A,zoomOnDoubleClick:O,zoomActivationKeyPressed:U,lib:B,onTransformChange:X,connectionInProgress:q,paneClickDistance:Q,selectionOnDrag:F}){S&&!a.isZoomingOrPanning&&p();const W=$&&!U&&!S;c.clickDistance(F?1/0:!vt(Q)||Q<0?0:Q);const ee=W?M_({zoomPanValues:a,noWheelClassName:T,d3Selection:d,d3Zoom:c,panOnScrollMode:z,panOnScrollSpeed:M,zoomOnPinch:P,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:l}):I_({noWheelClassName:T,preventScrolling:N,d3ZoomHandler:g});d.on("wheel.zoom",ee,{passive:!1});const J=P_({zoomPanValues:a,onDraggingChange:u,onPanZoomStart:s});c.on("start",J);const Z=L_({zoomPanValues:a,panOnDrag:L,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:X});c.on("zoom",Z);const K=T_({zoomPanValues:a,panOnDrag:L,panOnScroll:$,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:u});c.on("end",K);const ne=b_({zoomActivationKeyPressed:U,panOnDrag:L,zoomOnScroll:A,panOnScroll:$,zoomOnDoubleClick:O,zoomOnPinch:P,userSelectionActive:S,noPanClassName:R,noWheelClassName:T,lib:B,connectionInProgress:q});c.filter(ne),O?d.on("dblclick.zoom",m):d.on("dblclick.zoom",null)}function p(){c.on("zoom",null)}async function y(T,R,V){const S=Ka(T),$=c==null?void 0:c.constrain()(S,R,V);return $&&await w($),$}async function h(T,R){const V=Ka(T);return await w(V,R),V}function v(T){if(d){const R=Ka(T),V=d.property("__zoom");(V.k!==T.zoom||V.x!==T.x||V.y!==T.y)&&(c==null||c.transform(d,R,null,{sync:!0}))}}function E(){const T=d?Tp(d.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}async function _(T,R){return d?new Promise(V=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).scaleTo(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}async function k(T,R){return d?new Promise(V=>{c==null||c.interpolate((R==null?void 0:R.interpolate)==="linear"?Ao:Ns).scaleBy(Za(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>V(!0)),T)}):!1}function C(T){c==null||c.scaleExtent(T)}function b(T){c==null||c.translateExtent(T)}function j(T){const R=!vt(T)||T<0?0:T;c==null||c.clickDistance(R)}return{update:x,destroy:p,setViewport:h,setViewportConstrained:y,getViewport:E,scaleTo:_,scaleBy:k,setScaleExtent:C,setTranslateExtent:b,syncViewport:v,setClickDistance:j}}var jr;(function(e){e.Line="line",e.Handle="handle"})(jr||(jr={}));function z_({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 Eg(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 _n(e,t){return Math.max(0,t-e)}function Sn(e,t){return Math.max(0,e-t)}function Hs(e,t,n){return Math.max(0,t-e,e-n)}function _g(e,t){return e?!t:t}function O_(e,t,n,r,o,i,s,l){let{affectsX:u,affectsY:a}=t;const{isHorizontal:f,isVertical:c}=t,d=f&&c,{xSnapped:g,ySnapped:m}=n,{minWidth:w,maxWidth:x,minHeight:p,maxHeight:y}=r,{x:h,y:v,width:E,height:_,aspectRatio:k}=e;let C=Math.floor(f?g-e.pointerX:0),b=Math.floor(c?m-e.pointerY:0);const j=E+(u?-C:C),T=_+(a?-b:b),R=-i[0]*E,V=-i[1]*_;let S=Hs(j,w,x),$=Hs(T,p,y);if(s){let M=0,N=0;u&&C<0?M=_n(h+C+R,s[0][0]):!u&&C>0&&(M=Sn(h+j+R,s[1][0])),a&&b<0?N=_n(v+b+V,s[0][1]):!a&&b>0&&(N=Sn(v+T+V,s[1][1])),S=Math.max(S,M),$=Math.max($,N)}if(l){let M=0,N=0;u&&C>0?M=Sn(h+C,l[0][0]):!u&&C<0&&(M=_n(h+j,l[1][0])),a&&b>0?N=Sn(v+b,l[0][1]):!a&&b<0&&(N=_n(v+T,l[1][1])),S=Math.max(S,M),$=Math.max($,N)}if(o){if(f){const M=Hs(j/k,p,y)*k;if(S=Math.max(S,M),s){let N=0;!u&&!a||u&&!a&&d?N=Sn(v+V+j/k,s[1][1])*k:N=_n(v+V+(u?C:-C)/k,s[0][1])*k,S=Math.max(S,N)}if(l){let N=0;!u&&!a||u&&!a&&d?N=_n(v+j/k,l[1][1])*k:N=Sn(v+(u?C:-C)/k,l[0][1])*k,S=Math.max(S,N)}}if(c){const M=Hs(T*k,w,x)/k;if($=Math.max($,M),s){let N=0;!u&&!a||a&&!u&&d?N=Sn(h+T*k+R,s[1][0])/k:N=_n(h+(a?b:-b)*k+R,s[0][0])/k,$=Math.max($,N)}if(l){let N=0;!u&&!a||a&&!u&&d?N=_n(h+T*k,l[1][0])/k:N=Sn(h+(a?b:-b)*k,l[0][0])/k,$=Math.max($,N)}}}b=b+(b<0?$:-$),C=C+(C<0?S:-S),o&&(d?j>T*k?b=(_g(u,a)?-C:C)/k:C=(_g(u,a)?-b:b)*k:f?(b=C/k,a=u):(C=b*k,u=a));const L=u?h+C:h,z=a?v+b:v;return{width:E+(u?-C:C),height:_+(a?-b:b),x:i[0]*C*(u?-1:1)+L,y:i[1]*b*(a?-1:1)+z}}const Sg={width:0,height:0,x:0,y:0},R_={...Sg,pointerX:0,pointerY:0,aspectRatio:1};function A_(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 D_({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=qe(e);let s={controlDirection:Eg("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:f,keepAspectRatio:c,resizeDirection:d,onResizeStart:g,onResize:m,onResizeEnd:w,shouldResize:x}){let p={...Sg},y={...R_};s={boundaries:f,resizeDirection:d,keepAspectRatio:c,controlDirection:Eg(a)};let h,v=null,E=[],_,k,C,b=!1;const j=rp().on("start",T=>{const{nodeLookup:R,transform:V,snapGrid:S,snapToGrid:$,nodeOrigin:L,paneDomNode:z}=n();if(h=R.get(t),!h)return;v=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:M,ySnapped:N}=Ko(T.sourceEvent,{transform:V,snapGrid:S,snapToGrid:$,containerBounds:v});p={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},y={...p,pointerX:M,pointerY:N,aspectRatio:p.width/p.height},_=void 0,k=Wn(h.extent)?h.extent:void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(_=R.get(h.parentId)),_&&h.extent==="parent"&&(k=[[0,0],[_.measured.width,_.measured.height]]),E=[],C=void 0;for(const[P,A]of R)if(A.parentId===t&&(E.push({id:P,position:{...A.position},extent:A.extent}),A.extent==="parent"||A.expandParent)){const O=A_(A,h,A.origin??L);C?C=[[Math.min(O[0][0],C[0][0]),Math.min(O[0][1],C[0][1])],[Math.max(O[1][0],C[1][0]),Math.max(O[1][1],C[1][1])]]:C=O}g==null||g(T,{...p})}).on("drag",T=>{const{transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$}=n(),L=Ko(T.sourceEvent,{transform:R,snapGrid:V,snapToGrid:S,containerBounds:v}),z=[];if(!h)return;const{x:M,y:N,width:P,height:A}=p,O={},U=h.origin??$,{width:B,height:X,x:q,y:Q}=O_(y,s.controlDirection,L,s.boundaries,s.keepAspectRatio,U,k,C),F=B!==P,W=X!==A,ee=q!==M&&F,J=Q!==N&&W;if(!ee&&!J&&!F&&!W)return;if((ee||J||U[0]===1||U[1]===1)&&(O.x=ee?q:p.x,O.y=J?Q:p.y,p.x=O.x,p.y=O.y,E.length>0)){const ie=q-M,le=Q-N;for(const we of E)we.position={x:we.position.x-ie+U[0]*(B-P),y:we.position.y-le+U[1]*(X-A)},z.push(we)}if((F||W)&&(O.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:p.width,O.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:p.height,p.width=O.width,p.height=O.height),_&&h.expandParent){const ie=U[0]*(O.width??0);O.x&&O.x{b&&(w==null||w(T,{...p}),o==null||o({...p}),b=!1)});i.call(j)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var kg={exports:{}},Ng={},Cg={exports:{}},Mg={};/** * @license React * use-sync-external-store-shim.production.js * @@ -53,10 +53,10 @@ 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 Bs=D,Q_=G_;function K_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Z_=typeof Object.is=="function"?Object.is:K_,q_=Q_.useSyncExternalStore,J_=Bs.useRef,eS=Bs.useEffect,tS=Bs.useMemo,nS=Bs.useDebugValue;Ng.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=J_(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=tS(function(){function u(g){if(!a){if(a=!0,c=g,g=r(g),o!==void 0&&s.hasValue){var m=s.value;if(o(m,g))return f=m}return f=g}if(m=f,Z_(c,g))return m;var w=r(g);return o!==void 0&&o(m,w)?(c=g,m):(c=g,f=w)}var a=!1,c,f,d=n===void 0?null:n;return[function(){return u(t())},d===null?void 0:function(){return u(d())}]},[t,n,r,o]);var l=q_(e,i[0],i[1]);return eS(function(){s.hasValue=!0,s.value=l},[l]),nS(l),l},kg.exports=Ng;var rS=kg.exports;const oS=zt(rS),iS={},Ig=e=>{let t;const n=new Set,r=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const g=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(m=>m(t,g))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>a,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(iS?"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},sS=e=>e?Ig(e):Ig,{useDebugValue:lS}=Z0,{useSyncExternalStoreWithSelector:uS}=oS,aS=e=>e;function Pg(e,t=aS,n){const r=uS(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lS(r),r}const Lg=(e,t)=>{const n=sS(e),r=(o,i=t)=>Pg(n,o,i);return Object.assign(r,n),r},cS=(e,t)=>e?Lg(e,t):Lg;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 Us=D.createContext(null),fS=Us.Provider,Tg=yt.error001("react");function re(e,t){const n=D.useContext(Us);if(n===null)throw new Error(Tg);return Pg(n,e,t)}function he(){const e=D.useContext(Us);if(e===null)throw new Error(Tg);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const bg={display:"none"},dS={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$g="react-flow__node-desc",zg="react-flow__edge-desc",hS="react-flow__aria-live",pS=e=>e.ariaLiveMessage,gS=e=>e.ariaLabelConfig;function mS({rfId:e}){const t=re(pS);return I.jsx("div",{id:`${hS}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dS,children:t})}function yS({rfId:e,disableKeyboardA11y:t}){const n=re(gS);return I.jsxs(I.Fragment,{children:[I.jsx("div",{id:`${$g}-${e}`,style:bg,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),I.jsx("div",{id:`${zg}-${e}`,style:bg,children:n["edge.a11yDescription.default"]}),!t&&I.jsx(mS,{rfId:e})]})}const Ws=D.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return I.jsx("div",{className:Ee(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Ws.displayName="Panel";function vS({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:I.jsx(Ws,{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:I.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const wS=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}},Ys=e=>e.id;function xS(e,t){return de(e.selectedNodes.map(Ys),t.selectedNodes.map(Ys))&&de(e.selectedEdges.map(Ys),t.selectedEdges.map(Ys))}function ES({onSelectionChange:e}){const t=he(),{selectedNodes:n,selectedEdges:r}=re(wS,xS);return D.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const _S=e=>!!e.onSelectionChangeHandlers;function SS({onSelectionChange:e}){const t=re(_S);return e||t?I.jsx(ES,{onSelectionChange:e}):null}const Og=[0,0],kS={x:0,y:0,zoom:1},Rg=[...["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"],"rfId"],NS=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}),Ag={translateExtent:Bo,nodeOrigin:Og,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function CS(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:u}=re(NS,de),a=he();D.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{c.current=Ag,l()}),[]);const c=D.useRef(Ag);return D.useEffect(()=>{for(const f of Rg){const d=e[f],g=c.current[f];d!==g&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?o(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?a.setState({ariaLabelConfig:ZE(d)}):f==="fitView"?a.setState({fitViewQueued:d}):f==="fitViewOptions"?a.setState({fitViewOptions:d}):a.setState({[f]:d})))}c.current=e},Rg.map(f=>e[f])),null}function Dg(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function MS(e){var r;const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=Dg(),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=Dg())!=null&&r.matches?"dark":"light"}const jg=typeof document<"u"?document:null;function Zo(e=null,t={target:jg,actInsideInputWithModifier:!0}){const[n,r]=D.useState(!1),o=D.useRef(!1),i=D.useRef(new Set([])),[s,l]=D.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var Bs=D,Q_=G_;function K_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Z_=typeof Object.is=="function"?Object.is:K_,q_=Q_.useSyncExternalStore,J_=Bs.useRef,eS=Bs.useEffect,tS=Bs.useMemo,nS=Bs.useDebugValue;Ng.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=J_(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=tS(function(){function u(g){if(!a){if(a=!0,f=g,g=r(g),o!==void 0&&s.hasValue){var m=s.value;if(o(m,g))return c=m}return c=g}if(m=c,Z_(f,g))return m;var w=r(g);return o!==void 0&&o(m,w)?(f=g,m):(f=g,c=w)}var a=!1,f,c,d=n===void 0?null:n;return[function(){return u(t())},d===null?void 0:function(){return u(d())}]},[t,n,r,o]);var l=q_(e,i[0],i[1]);return eS(function(){s.hasValue=!0,s.value=l},[l]),nS(l),l},kg.exports=Ng;var rS=kg.exports;const oS=zt(rS),iS={},Ig=e=>{let t;const n=new Set,r=(f,c)=>{const d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){const g=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(m=>m(t,g))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>a,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(iS?"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},sS=e=>e?Ig(e):Ig,{useDebugValue:lS}=Z0,{useSyncExternalStoreWithSelector:uS}=oS,aS=e=>e;function Pg(e,t=aS,n){const r=uS(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return lS(r),r}const Lg=(e,t)=>{const n=sS(e),r=(o,i=t)=>Pg(n,o,i);return Object.assign(r,n),r},cS=(e,t)=>e?Lg(e,t):Lg;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 Us=D.createContext(null),fS=Us.Provider,Tg=yt.error001("react");function re(e,t){const n=D.useContext(Us);if(n===null)throw new Error(Tg);return Pg(n,e,t)}function he(){const e=D.useContext(Us);if(e===null)throw new Error(Tg);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const bg={display:"none"},dS={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$g="react-flow__node-desc",zg="react-flow__edge-desc",hS="react-flow__aria-live",pS=e=>e.ariaLiveMessage,gS=e=>e.ariaLabelConfig;function mS({rfId:e}){const t=re(pS);return I.jsx("div",{id:`${hS}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dS,children:t})}function yS({rfId:e,disableKeyboardA11y:t}){const n=re(gS);return I.jsxs(I.Fragment,{children:[I.jsx("div",{id:`${$g}-${e}`,style:bg,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),I.jsx("div",{id:`${zg}-${e}`,style:bg,children:n["edge.a11yDescription.default"]}),!t&&I.jsx(mS,{rfId:e})]})}const Ws=D.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return I.jsx("div",{className:Ee(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Ws.displayName="Panel";function vS({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:I.jsx(Ws,{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:I.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const wS=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}},Ys=e=>e.id;function xS(e,t){return de(e.selectedNodes.map(Ys),t.selectedNodes.map(Ys))&&de(e.selectedEdges.map(Ys),t.selectedEdges.map(Ys))}function ES({onSelectionChange:e}){const t=he(),{selectedNodes:n,selectedEdges:r}=re(wS,xS);return D.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const _S=e=>!!e.onSelectionChangeHandlers;function SS({onSelectionChange:e}){const t=re(_S);return e||t?I.jsx(ES,{onSelectionChange:e}):null}const Og=[0,0],kS={x:0,y:0,zoom:1},Rg=[...["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"],"rfId"],NS=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}),Ag={translateExtent:Bo,nodeOrigin:Og,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function CS(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:u}=re(NS,de),a=he();D.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{f.current=Ag,l()}),[]);const f=D.useRef(Ag);return D.useEffect(()=>{for(const c of Rg){const d=e[c],g=f.current[c];d!==g&&(typeof e[c]>"u"||(c==="nodes"?t(d):c==="edges"?n(d):c==="minZoom"?r(d):c==="maxZoom"?o(d):c==="translateExtent"?i(d):c==="nodeExtent"?s(d):c==="ariaLabelConfig"?a.setState({ariaLabelConfig:ZE(d)}):c==="fitView"?a.setState({fitViewQueued:d}):c==="fitViewOptions"?a.setState({fitViewOptions:d}):a.setState({[c]:d})))}f.current=e},Rg.map(c=>e[c])),null}function Dg(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function MS(e){var r;const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=Dg(),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=Dg())!=null&&r.matches?"dark":"light"}const jg=typeof document<"u"?document:null;function Zo(e=null,t={target:jg,actInsideInputWithModifier:!0}){const[n,r]=D.useState(!1),o=D.useRef(!1),i=D.useRef(new Set([])),[s,l]=D.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.replace("+",` `).replace(` `,` +`).split(` -`)),c=a.reduce((f,d)=>f.concat(...d),[]);return[a,c]}return[[],[]]},[e]);return D.useEffect(()=>{const u=(t==null?void 0:t.target)??jg,a=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const c=g=>{var x,p;if(o.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!o.current||o.current&&!a)&&Kp(g))return!1;const w=Vg(g.code,l);if(i.current.add(g[w]),Fg(s,i.current,!1)){const y=((p=(x=g.composedPath)==null?void 0:x.call(g))==null?void 0:p[0])||g.target,h=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(o.current||!h)&&g.preventDefault(),r(!0)}},f=g=>{const m=Vg(g.code,l);Fg(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(g[m]),g.key==="Meta"&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",c),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{u==null||u.removeEventListener("keydown",c),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function Fg(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Vg(e,t){return t.includes(e)?"code":"key"}const IS=()=>{const e=he();return D.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!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),!0):!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=Da(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}),!0):!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},c=n.snapGrid??o,f=n.snapToGrid??i;return Or(a,r,f,c)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=Rr(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function Hg(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)PS(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 PS(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 LS(e,t){return Hg(e,t)}function TS(e,t){return Hg(e,t)}function Xn(e,t){return{id:e,type:"select",selected:t}}function Vr(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(Xn(i.id,s)))}return r}function Bg({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 Ug(e){return{id:e.id,type:"remove"}}const bS=Wp();function $S(e,t,n={}){return r_(e,t,{...n,onError:n.onError??bS})}const Wg=e=>HE(e),zS=e=>jp(e);function Yg(e){return D.forwardRef(e)}const OS=typeof window<"u"?D.useLayoutEffect:D.useEffect;function Xg(e){const[t,n]=D.useState(BigInt(0)),[r]=D.useState(()=>RS(()=>n(o=>o+BigInt(1))));return OS(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function RS(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Gg=D.createContext(null);function AS({children:e}){const t=he(),n=D.useCallback(l=>{const{nodes:u=[],setNodes:a,hasDefaultNodes:c,onNodesChange:f,nodeLookup:d,fitViewQueued:g,onNodesChangeMiddlewareMap:m}=t.getState();let w=u;for(const p of l)w=typeof p=="function"?p(w):p;let x=Bg({items:w,lookup:d});for(const p of m.values())x=p(x);c&&a(w),x.length>0?f==null||f(x):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:y,setNodes:h}=t.getState();p&&h(y)})},[]),r=Xg(n),o=D.useCallback(l=>{const{edges:u=[],setEdges:a,hasDefaultEdges:c,onEdgesChange:f,edgeLookup:d}=t.getState();let g=u;for(const m of l)g=typeof m=="function"?m(g):m;c?a(g):f&&f(Bg({items:g,lookup:d}))},[]),i=Xg(o),s=D.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return I.jsx(Gg.Provider,{value:s,children:e})}function DS(){const e=D.useContext(Gg);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const jS=e=>!!e.panZoom;function Ja(){const e=IS(),t=he(),n=DS(),r=re(jS),o=D.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),s=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},u=f=>{var p,y;const{nodeLookup:d,nodeOrigin:g}=t.getState(),m=Wg(f)?f:d.get(f.id),w=m.parentId?Xp(m.position,m.measured,m.parentId,d,g):m.position,x={...m,position:w,width:((p=m.measured)==null?void 0:p.width)??m.width,height:((y=m.measured)==null?void 0:y.height)??m.height};return zr(x)},a=(f,d,g={replace:!1})=>{s(m=>m.map(w=>{if(w.id===f){const x=typeof d=="function"?d(w):d;return g.replace&&Wg(x)?x:{...w,...x}}return w}))},c=(f,d,g={replace:!1})=>{l(m=>m.map(w=>{if(w.id===f){const x=typeof d=="function"?d(w):d;return g.replace&&zS(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=i(f))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:s,setEdges:l,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(g=>[...g,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(g=>[...g,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:g}=t.getState(),[m,w,x]=g;return{nodes:f.map(p=>({...p})),edges:d.map(p=>({...p})),viewport:{x:m,y:w,zoom:x}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:g,edges:m,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:p,triggerEdgeChanges:y,onDelete:h,onBeforeDelete:v}=t.getState(),{nodes:E,edges:_}=await XE({nodesToRemove:f,edgesToRemove:d,nodes:g,edges:m,onBeforeDelete:v}),k=_.length>0,C=E.length>0;if(k){const b=_.map(Ug);x==null||x(_),y(b)}if(C){const b=E.map(Ug);w==null||w(E),p(b)}return(C||k)&&(h==null||h({nodes:E,edges:_})),{deletedNodes:E,deletedEdges:_}},getIntersectingNodes:(f,d=!0,g)=>{const m=Up(f),w=m?f:u(f),x=g!==void 0;return w?(g||t.getState().nodes).filter(p=>{const y=t.getState().nodeLookup.get(p.id);if(y&&!m&&(p.id===f.id||!y.internals.positionAbsolute))return!1;const h=zr(x?p:y),v=Xo(h,w);return d&&v>0||v>=h.width*h.height||v>=w.width*w.height}):[]},isNodeIntersecting:(f,d,g=!0)=>{const w=Up(f)?f:u(f);if(!w)return!1;const x=Xo(w,d);return g&&x>0||x>=d.width*d.height||x>=w.width*w.height},updateNode:a,updateNodeData:(f,d,g={replace:!1})=>{a(f,m=>{const w=typeof d=="function"?d(m):d;return g.replace?{...m,data:w}:{...m,data:{...m.data,...w}}},g)},updateEdge:c,updateEdgeData:(f,d,g={replace:!1})=>{c(f,m=>{const w=typeof d=="function"?d(m):d;return g.replace?{...m,data:w}:{...m,data:{...m.data,...w}}},g)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:g}=t.getState();return BE(f,{nodeLookup:d,nodeOrigin:g})},getHandleConnections:({type:f,id:d,nodeId:g})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${g}-${f}${d?`-${d}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:d,nodeId:g})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${g}${f?d?`-${f}-${d}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const d=t.getState().fitViewResolver??KE();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(g=>[...g]),d.promise}}},[]);return D.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const Qg=e=>e.selected,FS=typeof window<"u"?window:void 0;function VS({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=he(),{deleteElements:r}=Ja(),o=Zo(e,{actInsideInputWithModifier:!1}),i=Zo(t,{target:FS});D.useEffect(()=>{if(o){const{edges:s,nodes:l}=n.getState();r({nodes:l.filter(Qg),edges:s.filter(Qg)}),n.setState({nodesSelectionActive:!1})}},[o]),D.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function HS(e){const t=he();D.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",yt.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 Xs={position:"absolute",width:"100%",height:"100%",top:0,left:0},BS=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function US({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Bn.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:a,minZoom:c,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:g=!0,children:m,noWheelClassName:w,noPanClassName:x,onViewportChange:p,isControlledViewport:y,paneClickDistance:h,selectionOnDrag:v}){const E=he(),_=D.useRef(null),{userSelectionActive:k,lib:C,connectionInProgress:b}=re(BS,de),j=Zo(d),T=D.useRef();HS(_);const R=D.useCallback(V=>{p==null||p({x:V[0],y:V[1],zoom:V[2]}),y||E.setState({transform:V})},[p,y]);return D.useEffect(()=>{if(_.current){T.current=$_({domNode:_.current,minZoom:c,maxZoom:f,translateExtent:a,viewport:u,onDraggingChange:L=>E.setState(z=>z.paneDragging===L?z:{paneDragging:L}),onPanZoomStart:(L,z)=>{const{onViewportChangeStart:M,onMoveStart:N}=E.getState();N==null||N(L,z),M==null||M(z)},onPanZoom:(L,z)=>{const{onViewportChange:M,onMove:N}=E.getState();N==null||N(L,z),M==null||M(z)},onPanZoomEnd:(L,z)=>{const{onViewportChangeEnd:M,onMoveEnd:N}=E.getState();N==null||N(L,z),M==null||M(z)}});const{x:V,y:S,zoom:$}=T.current.getViewport();return E.setState({panZoom:T.current,transform:[V,S,$],domNode:_.current.closest(".react-flow")}),()=>{var L;(L=T.current)==null||L.destroy()}}},[]),D.useEffect(()=>{var V;(V=T.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:g,noPanClassName:x,userSelectionActive:k,noWheelClassName:w,lib:C,onTransformChange:R,connectionInProgress:b,selectionOnDrag:v,paneClickDistance:h})},[e,t,n,r,o,i,s,l,j,g,x,k,w,C,R,b,v,h]),I.jsx("div",{className:"react-flow__renderer",ref:_,style:Xs,children:m})}const WS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function YS(){const{userSelectionActive:e,userSelectionRect:t}=re(WS,de);return e&&t?I.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 ec=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},XS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function GS({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Uo.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:f,onPaneMouseEnter:d,onPaneMouseMove:g,onPaneMouseLeave:m,children:w}){const x=D.useRef(0),p=he(),{userSelectionActive:y,elementsSelectable:h,dragging:v,connectionInProgress:E,panBy:_,autoPanSpeed:k}=re(XS,de),C=h&&(e||y),b=D.useRef(null),j=D.useRef(),T=D.useRef(new Set),R=D.useRef(new Set),V=D.useRef(!1),S=D.useRef({x:0,y:0}),$=D.useRef(!1),L=F=>{if(V.current||E){V.current=!1;return}a==null||a(F),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},z=F=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){F.preventDefault();return}c==null||c(F)},M=f?F=>f(F):void 0,N=F=>{V.current&&(F.stopPropagation(),V.current=!1)},P=F=>{var we,st;const{domNode:W,transform:ee}=p.getState();if(j.current=W==null?void 0:W.getBoundingClientRect(),!j.current)return;const J=F.target===b.current;if(!J&&!!F.target.closest(".nokey")||!e||!(s&&J||t)||F.button!==0||!F.isPrimary)return;(st=(we=F.target)==null?void 0:we.setPointerCapture)==null||st.call(we,F.pointerId),V.current=!1;const{x:ne,y:ie}=wt(F.nativeEvent,j.current),le=Or({x:ne,y:ie},ee);p.setState({userSelectionRect:{width:0,height:0,startX:le.x,startY:le.y,x:ne,y:ie}}),J||(F.stopPropagation(),F.preventDefault())};function A(F,W){const{userSelectionRect:ee}=p.getState();if(!ee)return;const{transform:J,nodeLookup:Z,edgeLookup:K,connectionLookup:ne,triggerNodeChanges:ie,triggerEdgeChanges:le,defaultEdgeOptions:we}=p.getState(),st={x:ee.startX,y:ee.startY},{x:bt,y:$t}=Rr(st,J),Zt={startX:st.x,startY:st.y,x:FEt.id)),R.current=new Set;const Zn=(we==null?void 0:we.selectable)??!0;for(const Et of T.current){const qt=ne.get(Et);if(qt)for(const{edgeId:Jt}of qt.values()){const qn=K.get(Jt);qn&&(qn.selectable??Zn)&&R.current.add(Jt)}}if(!Gp(Jo,T.current)){const Et=Vr(Z,T.current,!0);ie(Et)}if(!Gp(Kn,R.current)){const Et=Vr(K,R.current);le(Et)}p.setState({userSelectionRect:Zt,userSelectionActive:!0,nodesSelectionActive:!1})}function O(){if(!o||!j.current)return;const[F,W]=Ra(S.current,j.current,k);_({x:F,y:W}).then(ee=>{if(!V.current||!ee){x.current=requestAnimationFrame(O);return}const{x:J,y:Z}=S.current;A(J,Z),x.current=requestAnimationFrame(O)})}const U=()=>{cancelAnimationFrame(x.current),x.current=0,$.current=!1};D.useEffect(()=>()=>U(),[]);const B=F=>{const{userSelectionRect:W,transform:ee,resetSelectedElements:J}=p.getState();if(!j.current||!W)return;const{x:Z,y:K}=wt(F.nativeEvent,j.current);S.current={x:Z,y:K};const ne=Rr({x:W.startX,y:W.startY},ee);if(!V.current){const ie=t?0:i;if(Math.hypot(Z-ne.x,K-ne.y)<=ie)return;J(),l==null||l(F)}V.current=!0,$.current||(O(),$.current=!0),A(Z,K)},X=F=>{var W,ee;F.button===0&&((ee=(W=F.target)==null?void 0:W.releasePointerCapture)==null||ee.call(W,F.pointerId),!y&&F.target===b.current&&p.getState().userSelectionRect&&(L==null||L(F)),p.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(u==null||u(F),p.setState({nodesSelectionActive:T.current.size>0})),U())},q=F=>{var W,ee;(ee=(W=F.target)==null?void 0:W.releasePointerCapture)==null||ee.call(W,F.pointerId),U()},Q=r===!0||Array.isArray(r)&&r.includes(0);return I.jsxs("div",{className:Ee(["react-flow__pane",{draggable:Q,dragging:v,selection:e}]),onClick:C?void 0:ec(L,b),onContextMenu:ec(z,b),onWheel:ec(M,b),onPointerEnter:C?void 0:d,onPointerMove:C?B:g,onPointerUp:C?X:void 0,onPointerCancel:C?q:void 0,onPointerDownCapture:C?P:void 0,onClickCapture:C?N:void 0,onPointerLeave:m,ref:b,style:Xs,children:[w,I.jsx(YS,{})]})}function tc({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",yt.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):o([e])}function Kg({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const l=he(),[u,a]=D.useState(!1),c=D.useRef();return D.useEffect(()=>{c.current=w_({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{tc({id:f,store:l,nodeRef:e})},onDragStart:()=>{a(!0)},onDragStop:()=>{a(!1)}})},[]),D.useEffect(()=>{if(!(t||!e.current||!c.current))return c.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var f;(f=c.current)==null||f.destroy()}},[n,r,t,i,e,o,s]),u}const QS=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Zg(){const e=he();return D.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:l,updateNodePositions:u,nodeLookup:a,nodeOrigin:c}=e.getState(),f=new Map,d=QS(s),g=o?i[0]:5,m=o?i[1]:5,w=n.direction.x*g*n.factor,x=n.direction.y*m*n.factor;for(const[,p]of a){if(!d(p))continue;let y={x:p.internals.positionAbsolute.x+w,y:p.internals.positionAbsolute.y+x};o&&(y=Go(y,i));const{position:h,positionAbsolute:v}=Fp({nodeId:p.id,nextPosition:y,nodeLookup:a,nodeExtent:r,nodeOrigin:c,onError:l});p.position=h,p.internals.positionAbsolute=v,f.set(p.id,p)}u(f)},[])}const nc=D.createContext(null),KS=nc.Provider;nc.Consumer;const qg=()=>D.useContext(nc),ZS=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),qS=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:l,toHandle:u,isValid:a}=s,c=(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:c,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===br.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:c&&a}};function JS({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:c,onTouchStart:f,...d},g){var $,L;const m=s||null,w=e==="target",x=he(),p=qg(),{connectOnClick:y,noPanClassName:h,rfId:v}=re(ZS,de),{connectingFrom:E,connectingTo:_,clickConnecting:k,isPossibleEndHandle:C,connectionInProcess:b,clickConnectionInProcess:j,valid:T}=re(qS(p,m,e),de);p||(L=($=x.getState()).onError)==null||L.call($,"010",yt.error010());const R=z=>{const{defaultEdgeOptions:M,onConnect:N,hasDefaultEdges:P}=x.getState(),A={...M,...z};if(P){const{edges:O,setEdges:U,onError:B}=x.getState();U($S(A,O,{onError:B}))}N==null||N(A),l==null||l(A)},V=z=>{if(!p)return;const M=Zp(z.nativeEvent);if(o&&(M&&z.button===0||!M)){const N=x.getState();Qa.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:N.autoPanOnConnect,connectionMode:N.connectionMode,connectionRadius:N.connectionRadius,domNode:N.domNode,nodeLookup:N.nodeLookup,lib:N.lib,isTarget:w,handleId:m,nodeId:p,flowId:N.rfId,panBy:N.panBy,cancelConnection:N.cancelConnection,onConnectStart:N.onConnectStart,onConnectEnd:(...P)=>{var A,O;return(O=(A=x.getState()).onConnectEnd)==null?void 0:O.call(A,...P)},updateConnection:N.updateConnection,onConnect:R,isValidConnection:n||((...P)=>{var A,O;return((O=(A=x.getState()).isValidConnection)==null?void 0:O.call(A,...P))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:N.autoPanSpeed,dragThreshold:N.connectionDragThreshold})}M?c==null||c(z):f==null||f(z)},S=z=>{const{onClickConnectStart:M,onClickConnectEnd:N,connectionClickStartHandle:P,connectionMode:A,isValidConnection:O,lib:U,rfId:B,nodeLookup:X,connection:q}=x.getState();if(!p||!P&&!o)return;if(!P){M==null||M(z.nativeEvent,{nodeId:p,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:p,type:e,id:m}});return}const Q=Qp(z.target),F=n||O,{connection:W,isValid:ee}=Qa.isValid(z.nativeEvent,{handle:{nodeId:p,id:m,type:e},connectionMode:A,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:F,flowId:B,doc:Q,lib:U,nodeLookup:X});ee&&W&&R(W);const J=structuredClone(q);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,N==null||N(z,J),x.setState({connectionClickStartHandle:null})};return I.jsx("div",{"data-handleid":m,"data-nodeid":p,"data-handlepos":t,"data-id":`${v}-${p}-${m}-${e}`,className:Ee(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,a,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:k,connectingfrom:E,connectingto:_,valid:T,connectionindicator:r&&(!b||C)&&(b||j?i:o)}]),onMouseDown:V,onTouchStart:V,onClick:y?S:void 0,ref:g,...d,children:u})}const Tt=D.memo(Yg(JS));function ek({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return I.jsxs(I.Fragment,{children:[e==null?void 0:e.label,I.jsx(Tt,{type:"source",position:n,isConnectable:t})]})}function tk({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom}){return I.jsxs(I.Fragment,{children:[I.jsx(Tt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,I.jsx(Tt,{type:"source",position:r,isConnectable:t})]})}function nk(){return null}function rk({data:e,isConnectable:t,targetPosition:n=G.Top}){return I.jsxs(I.Fragment,{children:[I.jsx(Tt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Gs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Jg={input:ek,default:tk,output:rk,group:nk};function ok(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 ik=e=>{const{width:t,height:n,x:r,y:o}=Yo(e.nodeLookup,{filter:i=>!!i.selected});return{width:vt(t)?t:null,height:vt(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 sk({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=he(),{width:o,height:i,transformString:s,userSelectionActive:l}=re(ik,de),u=Zg(),a=D.useRef(null);D.useEffect(()=>{var g;n||(g=a.current)==null||g.focus({preventScroll:!0})},[n]);const c=!l&&o!==null&&i!==null;if(Kg({nodeRef:a,disabled:!c}),!c)return null;const f=e?g=>{const m=r.getState().nodes.filter(w=>w.selected);e(g,m)}:void 0,d=g=>{Object.prototype.hasOwnProperty.call(Gs,g.key)&&(g.preventDefault(),u({direction:Gs[g.key],factor:g.shiftKey?4:1}))};return I.jsx("div",{className:Ee(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:I.jsx("div",{ref:a,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:o,height:i}})})}const em=typeof window<"u"?window:void 0,lk=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tm({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:a,selectionOnDrag:c,selectionMode:f,onSelectionStart:d,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:v,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:k,panOnDrag:C,autoPanOnSelection:b,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:V,preventScrolling:S,onSelectionContextMenu:$,noWheelClassName:L,noPanClassName:z,disableKeyboardA11y:M,onViewportChange:N,isControlledViewport:P}){const{nodesSelectionActive:A,userSelectionActive:O}=re(lk,de),U=Zo(a,{target:em}),B=Zo(w,{target:em}),X=B||C,q=B||v,Q=c&&X!==!0,F=U||O||Q;return VS({deleteKeyCode:u,multiSelectionKeyCode:m}),I.jsx(US,{onPaneContextMenu:i,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:q,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:k,panOnDrag:!U&&X,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:V,zoomActivationKeyCode:x,preventScrolling:S,noWheelClassName:L,noPanClassName:z,onViewportChange:N,isControlledViewport:P,paneClickDistance:l,selectionOnDrag:Q,children:I.jsxs(GS,{onSelectionStart:d,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:X,autoPanOnSelection:b,isSelecting:!!F,selectionMode:f,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:Q,children:[e,A&&I.jsx(sk,{onSelectionContextMenu:$,noPanClassName:z,disableKeyboardA11y:M})]})})}tm.displayName="FlowRenderer";const uk=D.memo(tm),ak=e=>t=>e?Oa(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 ck(e){return re(D.useCallback(ak(e),[e]),de)}const fk=e=>e.updateNodeInternals;function dk(){const e=re(fk),[t]=D.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 D.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function hk({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=he(),i=D.useRef(null),s=D.useRef(null),l=D.useRef(e.sourcePosition),u=D.useRef(e.targetPosition),a=D.useRef(t),c=n&&!!e.internals.handleBounds;return D.useEffect(()=>{i.current&&!e.hidden&&(!c||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[c,e.hidden]),D.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),D.useEffect(()=>{if(i.current){const f=a.current!==t,d=l.current!==e.sourcePosition,g=u.current!==e.targetPosition;(f||d||g)&&(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 pk({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:a,nodesFocusable:c,resizeObserver:f,noDragClassName:d,noPanClassName:g,disableKeyboardA11y:m,rfId:w,nodeTypes:x,nodeClickDistance:p,onError:y}){const{node:h,internals:v,isParent:E}=re(F=>{const W=F.nodeLookup.get(e),ee=F.parentLookup.has(e);return{node:W,internals:W.internals,isParent:ee}},de);let _=h.type||"default",k=(x==null?void 0:x[_])||Jg[_];k===void 0&&(y==null||y("003",yt.error003(_)),_="default",k=(x==null?void 0:x.default)||Jg.default);const C=!!(h.draggable||l&&typeof h.draggable>"u"),b=!!(h.selectable||u&&typeof h.selectable>"u"),j=!!(h.connectable||a&&typeof h.connectable>"u"),T=!!(h.focusable||c&&typeof h.focusable>"u"),R=he(),V=Yp(h),S=hk({node:h,nodeType:_,hasDimensions:V,resizeObserver:f}),$=Kg({nodeRef:S,disabled:h.hidden||!C,noDragClassName:d,handleSelector:h.dragHandle,nodeId:e,isSelectable:b,nodeClickDistance:p}),L=Zg();if(h.hidden)return null;const z=Qt(h),M=ok(h),N=b||C||t||n||r||o,P=n?F=>n(F,{...v.userNode}):void 0,A=r?F=>r(F,{...v.userNode}):void 0,O=o?F=>o(F,{...v.userNode}):void 0,U=i?F=>i(F,{...v.userNode}):void 0,B=s?F=>s(F,{...v.userNode}):void 0,X=F=>{const{selectNodesOnDrag:W,nodeDragThreshold:ee}=R.getState();b&&(!W||!C||ee>0)&&tc({id:e,store:R,nodeRef:S}),t&&t(F,{...v.userNode})},q=F=>{if(!(Kp(F.nativeEvent)||m)){if(zp.includes(F.key)&&b){const W=F.key==="Escape";tc({id:e,store:R,unselect:W,nodeRef:S})}else if(C&&h.selected&&Object.prototype.hasOwnProperty.call(Gs,F.key)){F.preventDefault();const{ariaLabelConfig:W}=R.getState();R.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:F.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),L({direction:Gs[F.key],factor:F.shiftKey?4:1})}}},Q=()=>{var ne;if(m||!((ne=S.current)!=null&&ne.matches(":focus-visible")))return;const{transform:F,width:W,height:ee,autoPanOnNodeFocus:J,setCenter:Z}=R.getState();if(!J)return;Oa(new Map([[e,h]]),{x:0,y:0,width:W,height:ee},F,!0).length>0||Z(h.position.x+z.width/2,h.position.y+z.height/2,{zoom:F[2]})};return I.jsx("div",{className:Ee(["react-flow__node",`react-flow__node-${_}`,{[g]:C},h.className,{selected:h.selected,selectable:b,parent:E,draggable:C,dragging:$}]),ref:S,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:N?"all":"none",visibility:V?"visible":"hidden",...h.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:A,onMouseLeave:O,onContextMenu:U,onClick:X,onDoubleClick:B,onKeyDown:T?q:void 0,tabIndex:T?0:void 0,onFocus:T?Q:void 0,role:h.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${$g}-${w}`,"aria-label":h.ariaLabel,...h.domAttributes,children:I.jsx(KS,{value:e,children:I.jsx(k,{id:e,data:h.data,type:_,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:h.selected??!1,selectable:b,draggable:C,deletable:h.deletable??!0,isConnectable:j,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:$,dragHandle:h.dragHandle,zIndex:v.z,parentId:h.parentId,...z})})})}var gk=D.memo(pk);const mk=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function nm(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=re(mk,de),s=ck(e.onlyRenderVisibleElements),l=dk();return I.jsx("div",{className:"react-flow__nodes",style:Xs,children:s.map(u=>I.jsx(gk,{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))})}nm.displayName="NodeRenderer";const yk=D.memo(nm);function vk(e){return re(D.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 wk=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return I.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},xk=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return I.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},rm={[Rs.Arrow]:wk,[Rs.ArrowClosed]:xk};function Ek(e){const t=he();return D.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(rm,e)?rm[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",yt.error009(e)),null)},[e])}const _k=({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=Ek(t);return u?I.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:I.jsx(u,{color:n,strokeWidth:s})}):null},om=({defaultColor:e,rfId:t})=>{const n=re(i=>i.edges),r=re(i=>i.defaultEdgeOptions),o=D.useMemo(()=>u_(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?I.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:I.jsx("defs",{children:o.map(i=>I.jsx(_k,{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};om.displayName="MarkerDefinitions";var Sk=D.memo(om);function im({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:a,...c}){const[f,d]=D.useState({x:1,y:0,width:0,height:0}),g=Ee(["react-flow__edge-textwrapper",a]),m=D.useRef(null);return D.useEffect(()=>{if(m.current){const w=m.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?I.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:g,visibility:f.width?"visible":"hidden",...c,children:[o&&I.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),I.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),u]}):null}im.displayName="EdgeText";const kk=D.memo(im);function Qs({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:a=20,...c}){return I.jsxs(I.Fragment,{children:[I.jsx("path",{...c,d:e,fill:"none",className:Ee(["react-flow__edge-path",c.className])}),a?I.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:a,className:"react-flow__edge-interaction"}):null,r&&vt(t)&&vt(n)?I.jsx(kk,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function sm({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 lm({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top}){const[s,l]=sm({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,a]=sm({pos:i,x1:r,y1:o,x2:e,y2:t}),[c,f,d,g]=Jp({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}`,c,f,d,g]}function um(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:l,label:u,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:p})=>{const[y,h,v]=lm({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return I.jsx(Qs,{id:E,path:y,labelX:h,labelY:v,label:u,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:p})})}const Nk=um({isInternal:!1}),am=um({isInternal:!0});Nk.displayName="SimpleBezierEdge",am.displayName="SimpleBezierEdgeInternal";function cm(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:d,sourcePosition:g=G.Bottom,targetPosition:m=G.Top,markerEnd:w,markerStart:x,pathOptions:p,interactionWidth:y})=>{const[h,v,E]=Fa({sourceX:n,sourceY:r,sourcePosition:g,targetX:o,targetY:i,targetPosition:m,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset,stepPosition:p==null?void 0:p.stepPosition}),_=e.isInternal?void 0:t;return I.jsx(Qs,{id:_,path:h,labelX:v,labelY:E,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:w,markerStart:x,interactionWidth:y})})}const fm=cm({isInternal:!1}),dm=cm({isInternal:!0});fm.displayName="SmoothStepEdge",dm.displayName="SmoothStepEdgeInternal";function hm(e){return D.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return I.jsx(fm,{...n,id:r,pathOptions:D.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const Ck=hm({isInternal:!1}),pm=hm({isInternal:!0});Ck.displayName="StepEdge",pm.displayName="StepEdgeInternal";function gm(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:g,markerStart:m,interactionWidth:w})=>{const[x,p,y]=rg({sourceX:n,sourceY:r,targetX:o,targetY:i}),h=e.isInternal?void 0:t;return I.jsx(Qs,{id:h,path:x,labelX:p,labelY:y,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:g,markerStart:m,interactionWidth:w})})}const Mk=gm({isInternal:!1}),mm=gm({isInternal:!0});Mk.displayName="StraightEdge",mm.displayName="StraightEdgeInternal";function ym(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=G.Bottom,targetPosition:l=G.Top,label:u,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,pathOptions:p,interactionWidth:y})=>{const[h,v,E]=tg({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l,curvature:p==null?void 0:p.curvature}),_=e.isInternal?void 0:t;return I.jsx(Qs,{id:_,path:h,labelX:v,labelY:E,label:u,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:y})})}const Ik=ym({isInternal:!1}),vm=ym({isInternal:!0});Ik.displayName="BezierEdge",vm.displayName="BezierEdgeInternal";const wm={default:vm,straight:mm,step:pm,smoothstep:dm,simplebezier:am},xm={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Pk=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,Lk=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Em="react-flow__edgeupdater";function _m({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:l}){return I.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:Ee([Em,`${Em}-${l}`]),cx:Pk(t,r,e),cy:Lk(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Tk({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:l,targetPosition:u,onReconnect:a,onReconnectStart:c,onReconnectEnd:f,setReconnecting:d,setUpdateHover:g}){const m=he(),w=(v,E)=>{if(v.button!==0)return;const{autoPanOnConnect:_,domNode:k,connectionMode:C,connectionRadius:b,lib:j,onConnectStart:T,cancelConnection:R,nodeLookup:V,rfId:S,panBy:$,updateConnection:L}=m.getState(),z=E.type==="target",M=(A,O)=>{d(!1),f==null||f(A,n,E.type,O)},N=A=>a==null?void 0:a(n,A),P=(A,O)=>{d(!0),c==null||c(v,n,E.type),T==null||T(A,O)};Qa.onPointerDown(v.nativeEvent,{autoPanOnConnect:_,connectionMode:C,connectionRadius:b,domNode:k,handleId:E.id,nodeId:E.nodeId,nodeLookup:V,isTarget:z,edgeUpdaterType:E.type,lib:j,flowId:S,cancelConnection:R,panBy:$,isValidConnection:(...A)=>{var O,U;return((U=(O=m.getState()).isValidConnection)==null?void 0:U.call(O,...A))??!0},onConnect:N,onConnectStart:P,onConnectEnd:(...A)=>{var O,U;return(U=(O=m.getState()).onConnectEnd)==null?void 0:U.call(O,...A)},onReconnectEnd:M,updateConnection:L,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},x=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),p=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>g(!0),h=()=>g(!1);return I.jsxs(I.Fragment,{children:[(e===!0||e==="source")&&I.jsx(_m,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:y,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&I.jsx(_m,{position:u,centerX:i,centerY:s,radius:t,onMouseDown:p,onMouseEnter:y,onMouseOut:h,type:"target"})]})}function bk({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,reconnectRadius:c,onReconnect:f,onReconnectStart:d,onReconnectEnd:g,rfId:m,edgeTypes:w,noPanClassName:x,onError:p,disableKeyboardA11y:y}){let h=re(Z=>Z.edgeLookup.get(e));const v=re(Z=>Z.defaultEdgeOptions);h=v?{...v,...h}:h;let E=h.type||"default",_=(w==null?void 0:w[E])||wm[E];_===void 0&&(p==null||p("011",yt.error011(E)),E="default",_=(w==null?void 0:w.default)||wm.default);const k=!!(h.focusable||t&&typeof h.focusable>"u"),C=typeof f<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),b=!!(h.selectable||r&&typeof h.selectable>"u"),j=D.useRef(null),[T,R]=D.useState(!1),[V,S]=D.useState(!1),$=he(),{zIndex:L,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O}=re(D.useCallback(Z=>{const K=Z.nodeLookup.get(h.source),ne=Z.nodeLookup.get(h.target);if(!K||!ne)return{zIndex:h.zIndex,...xm};const ie=l_({id:e,sourceNode:K,targetNode:ne,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:Z.connectionMode,onError:p});return{zIndex:JE({selected:h.selected,zIndex:h.zIndex,sourceNode:K,targetNode:ne,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...ie||xm}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),de),U=D.useMemo(()=>h.markerStart?`url('#${Va(h.markerStart,m)}')`:void 0,[h.markerStart,m]),B=D.useMemo(()=>h.markerEnd?`url('#${Va(h.markerEnd,m)}')`:void 0,[h.markerEnd,m]);if(h.hidden||z===null||M===null||N===null||P===null)return null;const X=Z=>{var le;const{addSelectedEdges:K,unselectNodesAndEdges:ne,multiSelectionActive:ie}=$.getState();b&&($.setState({nodesSelectionActive:!1}),h.selected&&ie?(ne({nodes:[],edges:[h]}),(le=j.current)==null||le.blur()):K([e])),o&&o(Z,h)},q=i?Z=>{i(Z,{...h})}:void 0,Q=s?Z=>{s(Z,{...h})}:void 0,F=l?Z=>{l(Z,{...h})}:void 0,W=u?Z=>{u(Z,{...h})}:void 0,ee=a?Z=>{a(Z,{...h})}:void 0,J=Z=>{var K;if(!y&&zp.includes(Z.key)&&b){const{unselectNodesAndEdges:ne,addSelectedEdges:ie}=$.getState();Z.key==="Escape"?((K=j.current)==null||K.blur(),ne({edges:[h]})):ie([e])}};return I.jsx("svg",{style:{zIndex:L},children:I.jsxs("g",{className:Ee(["react-flow__edge",`react-flow__edge-${E}`,h.className,x,{selected:h.selected,animated:h.animated,inactive:!b&&!o,updating:T,selectable:b}]),onClick:X,onDoubleClick:q,onContextMenu:Q,onMouseEnter:F,onMouseMove:W,onMouseLeave:ee,onKeyDown:k?J:void 0,tabIndex:k?0:void 0,role:h.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":k?`${zg}-${m}`:void 0,ref:j,...h.domAttributes,children:[!V&&I.jsx(_,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:b,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:U,markerEnd:B,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),C&&I.jsx(Tk,{edge:h,isReconnectable:C,reconnectRadius:c,onReconnect:f,onReconnectStart:d,onReconnectEnd:g,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O,setUpdateHover:R,setReconnecting:S})]})})}var $k=D.memo(bk);const zk=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Sm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:a,onEdgeClick:c,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:p,elementsSelectable:y,onError:h}=re(zk,de),v=vk(t);return I.jsxs("div",{className:"react-flow__edges",children:[I.jsx(Sk,{defaultColor:e,rfId:n}),v.map(E=>I.jsx($k,{id:E,edgesFocusable:x,edgesReconnectable:p,elementsSelectable:y,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,onClick:c,reconnectRadius:f,onDoubleClick:d,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:h,edgeTypes:r,disableKeyboardA11y:w},E))]})}Sm.displayName="EdgeRenderer";const Ok=D.memo(Sm),Rk=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ak({children:e}){const t=re(Rk);return I.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Dk(e){const t=Ja(),n=D.useRef(!1);D.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const jk=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Fk(e){const t=re(jk),n=he();return D.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Vk(e){return e.connection.inProgress?{...e.connection,to:Or(e.connection.to,e.transform)}:{...e.connection}}function Hk(e){return Vk}function Bk(e){const t=Hk();return re(t,de)}const Uk=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Wk({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:l,inProgress:u}=re(Uk,de);return!(i&&o&&u)?null:I.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:I.jsx("g",{className:Ee(["react-flow__connection",Dp(l)]),children:I.jsx(km,{style:t,type:n,CustomComponent:r,isValid:l})})})}const km=({style:e,type:t=En.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:l,fromPosition:u,to:a,toNode:c,toHandle:f,toPosition:d,pointer:g}=Bk();if(!o)return;if(n)return I.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:d,connectionStatus:Dp(r),toNode:c,toHandle:f,pointer:g});let m="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:a.x,targetY:a.y,targetPosition:d};switch(t){case En.Bezier:[m]=tg(w);break;case En.SimpleBezier:[m]=lm(w);break;case En.Step:[m]=Fa({...w,borderRadius:0});break;case En.SmoothStep:[m]=Fa(w);break;default:[m]=rg(w)}return I.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};km.displayName="ConnectionLine";const Yk={};function Nm(e=Yk){D.useRef(e),he(),D.useEffect(()=>{},[e])}function Xk(){he(),D.useRef(!1),D.useEffect(()=>{},[])}function Cm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:c,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:p,selectionKeyCode:y,selectionOnDrag:h,selectionMode:v,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:k,deleteKeyCode:C,onlyRenderVisibleElements:b,elementsSelectable:j,defaultViewport:T,translateExtent:R,minZoom:V,maxZoom:S,preventScrolling:$,defaultMarkerColor:L,zoomOnScroll:z,zoomOnPinch:M,panOnScroll:N,panOnScrollSpeed:P,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:U,autoPanOnSelection:B,onPaneClick:X,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:F,onPaneScroll:W,onPaneContextMenu:ee,paneClickDistance:J,nodeClickDistance:Z,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:ie,onEdgeMouseLeave:le,reconnectRadius:we,onReconnect:st,onReconnectStart:bt,onReconnectEnd:$t,noDragClassName:Zt,noWheelClassName:Jo,noPanClassName:Kn,disableKeyboardA11y:Zn,nodeExtent:Et,rfId:qt,viewport:Jt,onViewportChange:qn}){return Nm(e),Nm(t),Xk(),Dk(n),Fk(Jt),I.jsx(uk,{onPaneClick:X,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:F,onPaneContextMenu:ee,onPaneScroll:W,paneClickDistance:J,deleteKeyCode:C,selectionKeyCode:y,selectionOnDrag:h,selectionMode:v,onSelectionStart:d,onSelectionEnd:g,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:k,elementsSelectable:j,zoomOnScroll:z,zoomOnPinch:M,zoomOnDoubleClick:O,panOnScroll:N,panOnScrollSpeed:P,panOnScrollMode:A,panOnDrag:U,autoPanOnSelection:B,defaultViewport:T,translateExtent:R,minZoom:V,maxZoom:S,onSelectionContextMenu:f,preventScrolling:$,noDragClassName:Zt,noWheelClassName:Jo,noPanClassName:Kn,disableKeyboardA11y:Zn,onViewportChange:qn,isControlledViewport:!!Jt,children:I.jsxs(Ak,{children:[I.jsx(Ok,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:st,onReconnectStart:bt,onReconnectEnd:$t,onlyRenderVisibleElements:b,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:ie,onEdgeMouseLeave:le,reconnectRadius:we,defaultMarkerColor:L,noPanClassName:Kn,disableKeyboardA11y:Zn,rfId:qt}),I.jsx(Wk,{style:w,type:m,component:x,containerStyle:p}),I.jsx("div",{className:"react-flow__edgelabel-renderer"}),I.jsx(yk,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:c,nodeClickDistance:Z,onlyRenderVisibleElements:b,noPanClassName:Kn,noDragClassName:Zt,disableKeyboardA11y:Zn,nodeExtent:Et,rfId:qt}),I.jsx("div",{className:"react-flow__viewport-portal"})]})})}Cm.displayName="GraphView";const Gk=D.memo(Cm),Qk=Wp(),Mm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u=.5,maxZoom:a=2,nodeOrigin:c,nodeExtent:f,zIndexMode:d="basic"}={})=>{const g=new Map,m=new Map,w=new Map,x=new Map,p=r??t??[],y=n??e??[],h=c??[0,0],v=f??Bo;dg(w,x,p);const{nodesInitialized:E}=Wa(y,g,m,{nodeOrigin:h,nodeExtent:v,zIndexMode:d});let _=[0,0,1];if(s&&o&&i){const k=Yo(g,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:C,y:b,zoom:j}=Da(k,o,i,u,a,(l==null?void 0:l.padding)??.1);_=[C,b,j]}return{rfId:"1",width:o??0,height:i??0,transform:_,nodes:y,nodesInitialized:E,nodeLookup:g,parentLookup:m,edges:p,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:a,translateExtent:Bo,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:br.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,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:{...Rp},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qk,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Op,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Kk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:c,nodeExtent:f,zIndexMode:d})=>cS((g,m)=>{async function w(){const{nodeLookup:x,panZoom:p,fitViewOptions:y,fitViewResolver:h,width:v,height:E,minZoom:_,maxZoom:k}=m();p&&(await YE({nodes:x,width:v,height:E,panZoom:p,minZoom:_,maxZoom:k},y),h==null||h.resolve(!0),g({fitViewResolver:null}))}return{...Mm({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:c,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:x=>{const{nodeLookup:p,parentLookup:y,nodeOrigin:h,elevateNodesOnSelect:v,fitViewQueued:E,zIndexMode:_,nodesSelectionActive:k}=m(),{nodesInitialized:C,hasSelectedNodes:b}=Wa(x,p,y,{nodeOrigin:h,nodeExtent:f,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:_}),j=k&&b;E&&C?(w(),g({nodes:x,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:j})):g({nodes:x,nodesInitialized:C,nodesSelectionActive:j})},setEdges:x=>{const{connectionLookup:p,edgeLookup:y}=m();dg(p,y,x),g({edges:x})},setDefaultNodesAndEdges:(x,p)=>{if(x){const{setNodes:y}=m();y(x),g({hasDefaultNodes:!0})}if(p){const{setEdges:y}=m();y(p),g({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:p,nodeLookup:y,parentLookup:h,domNode:v,nodeOrigin:E,nodeExtent:_,debug:k,fitViewQueued:C,zIndexMode:b}=m(),{changes:j,updatedInternals:T}=g_(x,y,h,v,E,_,b);T&&(f_(y,h,{nodeOrigin:E,nodeExtent:_,zIndexMode:b}),C?(w(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(j==null?void 0:j.length)>0&&(k&&console.log("React Flow: trigger node changes",j),p==null||p(j)))},updateNodePositions:(x,p=!1)=>{const y=[];let h=[];const{nodeLookup:v,triggerNodeChanges:E,connection:_,updateConnection:k,onNodesChangeMiddlewareMap:C}=m();for(const[b,j]of x){const T=v.get(b),R=!!(T!=null&&T.expandParent&&(T!=null&&T.parentId)&&(j!=null&&j.position)),V={id:b,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:p};if(T&&_.inProgress&&_.fromNode.id===T.id){const S=Yn(T,_.fromHandle,G.Left,!0);k({..._,from:S})}R&&T.parentId&&y.push({id:b,parentId:T.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),h.push(V)}if(y.length>0){const{parentLookup:b,nodeOrigin:j}=m(),T=Xa(y,v,b,j);h.push(...T)}for(const b of C.values())h=b(h);E(h)},triggerNodeChanges:x=>{const{onNodesChange:p,setNodes:y,nodes:h,hasDefaultNodes:v,debug:E}=m();if(x!=null&&x.length){if(v){const _=LS(x,h);y(_)}E&&console.log("React Flow: trigger node changes",x),p==null||p(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:p,setEdges:y,edges:h,hasDefaultEdges:v,debug:E}=m();if(x!=null&&x.length){if(v){const _=TS(x,h);y(_)}E&&console.log("React Flow: trigger edge changes",x),p==null||p(x)}},addSelectedNodes:x=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:h,triggerNodeChanges:v,triggerEdgeChanges:E}=m();if(p){const _=x.map(k=>Xn(k,!0));v(_);return}v(Vr(h,new Set([...x]),!0)),E(Vr(y))},addSelectedEdges:x=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:h,triggerNodeChanges:v,triggerEdgeChanges:E}=m();if(p){const _=x.map(k=>Xn(k,!0));E(_);return}E(Vr(y,new Set([...x]))),v(Vr(h,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:p}={})=>{const{edges:y,nodes:h,nodeLookup:v,triggerNodeChanges:E,triggerEdgeChanges:_}=m(),k=x||h,C=p||y,b=[];for(const T of k){if(!T.selected)continue;const R=v.get(T.id);R&&(R.selected=!1),b.push(Xn(T.id,!1))}const j=[];for(const T of C)T.selected&&j.push(Xn(T.id,!1));E(b),_(j)},setMinZoom:x=>{const{panZoom:p,maxZoom:y}=m();p==null||p.setScaleExtent([x,y]),g({minZoom:x})},setMaxZoom:x=>{const{panZoom:p,minZoom:y}=m();p==null||p.setScaleExtent([y,x]),g({maxZoom:x})},setTranslateExtent:x=>{var p;(p=m().panZoom)==null||p.setTranslateExtent(x),g({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:p,triggerNodeChanges:y,triggerEdgeChanges:h,elementsSelectable:v}=m();if(!v)return;const E=p.reduce((k,C)=>C.selected?[...k,Xn(C.id,!1)]:k,[]),_=x.reduce((k,C)=>C.selected?[...k,Xn(C.id,!1)]:k,[]);y(E),h(_)},setNodeExtent:x=>{const{nodes:p,nodeLookup:y,parentLookup:h,nodeOrigin:v,elevateNodesOnSelect:E,nodeExtent:_,zIndexMode:k}=m();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(Wa(p,y,h,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:k}),g({nodeExtent:x}))},panBy:x=>{const{transform:p,width:y,height:h,panZoom:v,translateExtent:E}=m();return m_({delta:x,panZoom:v,transform:p,translateExtent:E,width:y,height:h})},setCenter:async(x,p,y)=>{const{width:h,height:v,maxZoom:E,panZoom:_}=m();if(!_)return!1;const k=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:E;return await _.setViewport({x:h/2-x*k,y:v/2-p*k,zoom:k},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),!0},cancelConnection:()=>{g({connection:{...Rp}})},updateConnection:x=>{g({connection:x})},reset:()=>g({...Mm()})}},Object.is);function Im({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:u,fitView:a,nodeOrigin:c,nodeExtent:f,zIndexMode:d,children:g}){const[m]=D.useState(()=>Kk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,minZoom:s,maxZoom:l,fitViewOptions:u,nodeOrigin:c,nodeExtent:f,zIndexMode:d}));return I.jsx(fS,{value:m,children:I.jsx(AS,{children:g})})}function Zk({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:a,maxZoom:c,nodeOrigin:f,nodeExtent:d,zIndexMode:g}){return D.useContext(Us)?I.jsx(I.Fragment,{children:e}):I.jsx(Im,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:u,initialMinZoom:a,initialMaxZoom:c,nodeOrigin:f,nodeExtent:d,zIndexMode:g,children:e})}const qk={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Jk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:a,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:g,onConnectStart:m,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:k,onNodeDrag:C,onNodeDragStop:b,onNodesDelete:j,onEdgesDelete:T,onDelete:R,onSelectionChange:V,onSelectionDragStart:S,onSelectionDrag:$,onSelectionDragStop:L,onSelectionContextMenu:z,onSelectionStart:M,onSelectionEnd:N,onBeforeDelete:P,connectionMode:A,connectionLineType:O=En.Bezier,connectionLineStyle:U,connectionLineComponent:B,connectionLineContainerStyle:X,deleteKeyCode:q="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:F=!1,selectionMode:W=Uo.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:J=Qo()?"Meta":"Control",zoomActivationKeyCode:Z=Qo()?"Meta":"Control",snapToGrid:K,snapGrid:ne,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:le,nodesDraggable:we,autoPanOnNodeFocus:st,nodesConnectable:bt,nodesFocusable:$t,nodeOrigin:Zt=Og,edgesFocusable:Jo,edgesReconnectable:Kn,elementsSelectable:Zn=!0,defaultViewport:Et=kS,minZoom:qt=.5,maxZoom:Jt=2,translateExtent:qn=Bo,preventScrolling:nI=!0,nodeExtent:yc,defaultMarkerColor:rI="#b1b1b7",zoomOnScroll:oI=!0,zoomOnPinch:iI=!0,panOnScroll:sI=!1,panOnScrollSpeed:lI=.5,panOnScrollMode:uI=Bn.Free,zoomOnDoubleClick:aI=!0,panOnDrag:cI=!0,onPaneClick:fI,onPaneMouseEnter:dI,onPaneMouseMove:hI,onPaneMouseLeave:pI,onPaneScroll:gI,onPaneContextMenu:mI,paneClickDistance:yI=1,nodeClickDistance:vI=0,children:wI,onReconnect:xI,onReconnectStart:EI,onReconnectEnd:_I,onEdgeContextMenu:SI,onEdgeDoubleClick:kI,onEdgeMouseEnter:NI,onEdgeMouseMove:CI,onEdgeMouseLeave:MI,reconnectRadius:II=10,onNodesChange:PI,onEdgesChange:LI,noDragClassName:TI="nodrag",noWheelClassName:bI="nowheel",noPanClassName:P0="nopan",fitView:L0,fitViewOptions:T0,connectOnClick:$I,attributionPosition:zI,proOptions:OI,defaultEdgeOptions:RI,elevateNodesOnSelect:AI=!0,elevateEdgesOnSelect:DI=!1,disableKeyboardA11y:b0=!1,autoPanOnConnect:jI,autoPanOnNodeDrag:FI,autoPanOnSelection:VI=!0,autoPanSpeed:HI,connectionRadius:BI,isValidConnection:UI,onError:WI,style:YI,id:$0,nodeDragThreshold:XI,connectionDragThreshold:GI,viewport:QI,onViewportChange:KI,width:ZI,height:qI,colorMode:JI="light",debug:eP,onScroll:nl,ariaLabelConfig:tP,zIndexMode:z0="basic",...nP},rP){const vc=$0||"1",oP=MS(JI),iP=D.useCallback(O0=>{O0.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nl==null||nl(O0)},[nl]);return I.jsx("div",{"data-testid":"rf__wrapper",...nP,onScroll:iP,style:{...YI,...qk},ref:rP,className:Ee(["react-flow",o,oP]),id:$0,role:"application",children:I.jsxs(Zk,{nodes:e,edges:t,width:ZI,height:qI,fitView:L0,fitViewOptions:T0,minZoom:qt,maxZoom:Jt,nodeOrigin:Zt,nodeExtent:yc,zIndexMode:z0,children:[I.jsx(CS,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:m,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:p,nodesDraggable:we,autoPanOnNodeFocus:st,nodesConnectable:bt,nodesFocusable:$t,edgesFocusable:Jo,edgesReconnectable:Kn,elementsSelectable:Zn,elevateNodesOnSelect:AI,elevateEdgesOnSelect:DI,minZoom:qt,maxZoom:Jt,nodeExtent:yc,onNodesChange:PI,onEdgesChange:LI,snapToGrid:K,snapGrid:ne,connectionMode:A,translateExtent:qn,connectOnClick:$I,defaultEdgeOptions:RI,fitView:L0,fitViewOptions:T0,onNodesDelete:j,onEdgesDelete:T,onDelete:R,onNodeDragStart:k,onNodeDrag:C,onNodeDragStop:b,onSelectionDrag:$,onSelectionDragStart:S,onSelectionDragStop:L,onMove:c,onMoveStart:f,onMoveEnd:d,noPanClassName:P0,nodeOrigin:Zt,rfId:vc,autoPanOnConnect:jI,autoPanOnNodeDrag:FI,autoPanSpeed:HI,onError:WI,connectionRadius:BI,isValidConnection:UI,selectNodesOnDrag:le,nodeDragThreshold:XI,connectionDragThreshold:GI,onBeforeDelete:P,debug:eP,ariaLabelConfig:tP,zIndexMode:z0}),I.jsx(Gk,{onInit:a,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:O,connectionLineStyle:U,connectionLineComponent:B,connectionLineContainerStyle:X,selectionKeyCode:Q,selectionOnDrag:F,selectionMode:W,deleteKeyCode:q,multiSelectionKeyCode:J,panActivationKeyCode:ee,zoomActivationKeyCode:Z,onlyRenderVisibleElements:ie,defaultViewport:Et,translateExtent:qn,minZoom:qt,maxZoom:Jt,preventScrolling:nI,zoomOnScroll:oI,zoomOnPinch:iI,zoomOnDoubleClick:aI,panOnScroll:sI,panOnScrollSpeed:lI,panOnScrollMode:uI,panOnDrag:cI,autoPanOnSelection:VI,onPaneClick:fI,onPaneMouseEnter:dI,onPaneMouseMove:hI,onPaneMouseLeave:pI,onPaneScroll:gI,onPaneContextMenu:mI,paneClickDistance:yI,nodeClickDistance:vI,onSelectionContextMenu:z,onSelectionStart:M,onSelectionEnd:N,onReconnect:xI,onReconnectStart:EI,onReconnectEnd:_I,onEdgeContextMenu:SI,onEdgeDoubleClick:kI,onEdgeMouseEnter:NI,onEdgeMouseMove:CI,onEdgeMouseLeave:MI,reconnectRadius:II,defaultMarkerColor:rI,noDragClassName:TI,noWheelClassName:bI,noPanClassName:P0,rfId:vc,disableKeyboardA11y:b0,nodeExtent:yc,viewport:QI,onViewportChange:KI}),I.jsx(SS,{onSelectionChange:V}),wI,I.jsx(vS,{proOptions:OI,position:zI}),I.jsx(yS,{rfId:vc,disableKeyboardA11y:b0})]})})}var e2=Yg(Jk);function t2({dimensions:e,lineWidth:t,variant:n,className:r}){return I.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ee(["react-flow__background-pattern",n,r])})}function n2({radius:e,className:t}){return I.jsx("circle",{cx:e,cy:e,r:e,className:Ee(["react-flow__background-pattern","dots",t])})}var kn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(kn||(kn={}));const r2={[kn.Dots]:1,[kn.Lines]:1,[kn.Cross]:6},o2=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pm({id:e,variant:t=kn.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:l,style:u,className:a,patternClassName:c}){const f=D.useRef(null),{transform:d,patternId:g}=re(o2,de),m=r||r2[t],w=t===kn.Dots,x=t===kn.Cross,p=Array.isArray(n)?n:[n,n],y=[p[0]*d[2]||1,p[1]*d[2]||1],h=m*d[2],v=Array.isArray(i)?i:[i,i],E=x?[h,h]:y,_=[v[0]*d[2]||1+E[0]/2,v[1]*d[2]||1+E[1]/2],k=`${g}${e||""}`;return I.jsxs("svg",{className:Ee(["react-flow__background",a]),style:{...u,...Xs,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:f,"data-testid":"rf__background",children:[I.jsx("pattern",{id:k,x:d[0]%y[0],y:d[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:w?I.jsx(n2,{radius:h/2,className:c}):I.jsx(t2,{dimensions:E,lineWidth:o,variant:t,className:c})}),I.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Pm.displayName="Background";const i2=D.memo(Pm);function s2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:I.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function l2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:I.jsx("path",{d:"M0 0h32v4.2H0z"})})}function u2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:I.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 a2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 c2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 Ks({children:e,className:t,...n}){return I.jsx("button",{type:"button",className:Ee(["react-flow__controls-button",t]),...n,children:e})}const f2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Lm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:u,className:a,children:c,position:f="bottom-left",orientation:d="vertical","aria-label":g}){const m=he(),{isInteractive:w,minZoomReached:x,maxZoomReached:p,ariaLabelConfig:y}=re(f2,de),{zoomIn:h,zoomOut:v,fitView:E}=Ja(),_=()=>{h(),i==null||i()},k=()=>{v(),s==null||s()},C=()=>{E(o),l==null||l()},b=()=>{m.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},j=d==="horizontal"?"horizontal":"vertical";return I.jsxs(Ws,{className:Ee(["react-flow__controls",j,a]),position:f,style:e,"data-testid":"rf__controls","aria-label":g??y["controls.ariaLabel"],children:[t&&I.jsxs(I.Fragment,{children:[I.jsx(Ks,{onClick:_,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:p,children:I.jsx(s2,{})}),I.jsx(Ks,{onClick:k,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:x,children:I.jsx(l2,{})})]}),n&&I.jsx(Ks,{className:"react-flow__controls-fitview",onClick:C,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:I.jsx(u2,{})}),r&&I.jsx(Ks,{className:"react-flow__controls-interactive",onClick:b,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:w?I.jsx(c2,{}):I.jsx(a2,{})}),c]})}Lm.displayName="Controls";const d2=D.memo(Lm);function h2({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:l,strokeWidth:u,className:a,borderRadius:c,shapeRendering:f,selected:d,onClick:g}){const{background:m,backgroundColor:w}=i||{},x=s||m||w;return I.jsx("rect",{className:Ee(["react-flow__minimap-node",{selected:d},a]),x:t,y:n,rx:c,ry:c,width:r,height:o,style:{fill:x,stroke:l,strokeWidth:u},shapeRendering:f,onClick:g?p=>g(p,e):void 0})}const p2=D.memo(h2),g2=e=>e.nodes.map(t=>t.id),rc=e=>e instanceof Function?e:()=>e;function m2({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=p2,onClick:s}){const l=re(g2,de),u=rc(t),a=rc(e),c=rc(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return I.jsx(I.Fragment,{children:l.map(d=>I.jsx(v2,{id:d,nodeColorFunc:u,nodeStrokeColorFunc:a,nodeClassNameFunc:c,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:f},d))})}function y2({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:l,onClick:u}){const{node:a,x:c,y:f,width:d,height:g}=re(m=>{const w=m.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:p,y}=w.internals.positionAbsolute,{width:h,height:v}=Qt(x);return{node:x,x:p,y,width:h,height:v}},de);return!a||a.hidden||!Yp(a)?null:I.jsx(l,{x:c,y:f,width:d,height:g,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 v2=D.memo(y2);var w2=D.memo(m2);const x2=200,E2=150,_2=e=>!e.hidden,S2=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?Bp(Yo(e.nodeLookup,{filter:_2}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},k2="react-flow__minimap-desc";function Tm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:a,maskStrokeColor:c,maskStrokeWidth:f,position:d="bottom-right",onClick:g,onNodeClick:m,pannable:w=!1,zoomable:x=!1,ariaLabel:p,inversePan:y,zoomStep:h=1,offsetScale:v=5}){const E=he(),_=D.useRef(null),{boundingRect:k,viewBB:C,rfId:b,panZoom:j,translateExtent:T,flowWidth:R,flowHeight:V,ariaLabelConfig:S}=re(S2,de),$=(e==null?void 0:e.width)??x2,L=(e==null?void 0:e.height)??E2,z=k.width/$,M=k.height/L,N=Math.max(z,M),P=N*$,A=N*L,O=v*N,U=k.x-(P-k.width)/2-O,B=k.y-(A-k.height)/2-O,X=P+O*2,q=A+O*2,Q=`${k2}-${b}`,F=D.useRef(0),W=D.useRef();F.current=N,D.useEffect(()=>{if(_.current&&j)return W.current=N_({domNode:_.current,panZoom:j,getTransform:()=>E.getState().transform,getViewScale:()=>F.current}),()=>{var K;(K=W.current)==null||K.destroy()}},[j]),D.useEffect(()=>{var K;(K=W.current)==null||K.update({translateExtent:T,width:R,height:V,inversePan:y,pannable:w,zoomStep:h,zoomable:x})},[w,x,y,h,T,R,V]);const ee=g?K=>{var le;const[ne,ie]=((le=W.current)==null?void 0:le.pointer(K))||[0,0];g(K,{x:ne,y:ie})}:void 0,J=m?D.useCallback((K,ne)=>{const ie=E.getState().nodeLookup.get(ne).internals.userNode;m(K,ie)},[]):void 0,Z=p??S["minimap.ariaLabel"];return I.jsx(Ws,{position:d,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 c=="string"?c:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*N: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:Ee(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:I.jsxs("svg",{width:$,height:L,viewBox:`${U} ${B} ${X} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:_,onClick:ee,children:[Z&&I.jsx("title",{id:Q,children:Z}),I.jsx(w2,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:l}),I.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-O},${B-O}h${X+O*2}v${q+O*2}h${-X-O*2}z - M${C.x},${C.y}h${C.width}v${C.height}h${-C.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Tm.displayName="MiniMap";const N2=D.memo(Tm),C2=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,M2={[jr.Line]:"right",[jr.Handle]:"bottom-right"};function I2({nodeId:e,position:t,variant:n=jr.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:a=Number.MAX_VALUE,maxHeight:c=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:g=!0,shouldResize:m,onResizeStart:w,onResize:x,onResizeEnd:p}){const y=qg(),h=typeof e=="string"?e:y,v=he(),E=D.useRef(null),_=n===jr.Handle,k=re(D.useCallback(C2(_&&g),[_,g]),de),C=D.useRef(null),b=t??M2[n];D.useEffect(()=>{if(!(!E.current||!h))return C.current||(C.current=D_({domNode:E.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:T,transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$,domNode:L}=v.getState();return{nodeLookup:T,transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$,paneDomNode:L}},onChange:(T,R)=>{const{triggerNodeChanges:V,nodeLookup:S,parentLookup:$,nodeOrigin:L}=v.getState(),z=[],M={x:T.x,y:T.y},N=S.get(h);if(N&&N.expandParent&&N.parentId){const P=N.origin??L,A=T.width??N.measured.width??0,O=T.height??N.measured.height??0,U={id:N.id,parentId:N.parentId,rect:{width:A,height:O,...Xp({x:T.x??N.position.x,y:T.y??N.position.y},{width:A,height:O},N.parentId,S,P)}},B=Xa([U],S,$,L);z.push(...B),M.x=T.x?Math.max(P[0]*A,T.x):void 0,M.y=T.y?Math.max(P[1]*O,T.y):void 0}if(M.x!==void 0&&M.y!==void 0){const P={id:h,type:"position",position:{...M}};z.push(P)}if(T.width!==void 0&&T.height!==void 0){const A={id:h,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};z.push(A)}for(const P of R){const A={...P,type:"position"};z.push(A)}V(z)},onEnd:({width:T,height:R})=>{const V={id:h,type:"dimensions",resizing:!1,dimensions:{width:T,height:R}};v.getState().triggerNodeChanges([V])}})),C.current.update({controlPosition:b,boundaries:{minWidth:l,minHeight:u,maxWidth:a,maxHeight:c},keepAspectRatio:f,resizeDirection:d,onResizeStart:w,onResize:x,onResizeEnd:p,shouldResize:m}),()=>{var T;(T=C.current)==null||T.destroy()}},[b,l,u,a,c,f,w,x,p,m]);const j=b.split("-");return I.jsx("div",{className:Ee(["react-flow__resize-control","nodrag",...j,n,r]),ref:E,style:{...o,scale:k,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}D.memo(I2);const P2={model:"var(--model, #2f6feb)",source:"var(--source, #16a34a)",seed:"var(--seed, #b45309)",snapshot:"var(--snapshot, #7c3aed)"},bm="__table_in",$m="__table_out",zm=e=>`${e}__in`,Om=e=>`${e}__out`;function L2(e){return e.is_primary_key?"PK":e.is_foreign_key?"FK":null}function T2({data:e}){const t=e.record,n=e.focused,r=P2[t.resource_type]??"var(--border, #888)";return I.jsxs("div",{className:`dbd-erd${n?" dbd-erd-focus":""}`,title:t.id,children:[I.jsx(Tt,{type:"target",position:G.Left,id:bm,className:"dbd-h-table"}),I.jsx(Tt,{type:"source",position:G.Right,id:$m,className:"dbd-h-table"}),I.jsxs("div",{className:"dbd-erd-head",style:{borderTopColor:r},children:[I.jsx("span",{className:"dbd-erd-name",children:t.label}),I.jsx("span",{className:"dbd-erd-schema",children:t.schema})]}),I.jsx("div",{className:"dbd-erd-cols",children:(t.columns??[]).map(o=>{const i=L2(o);return I.jsxs("div",{className:"dbd-erd-col",children:[I.jsx(Tt,{type:"target",position:G.Left,id:zm(o.name),className:"dbd-h-col"}),i?I.jsx("span",{className:`dbd-erd-badge dbd-${i.toLowerCase()}`,children:i}):I.jsx("span",{className:"dbd-erd-badge dbd-none"}),I.jsx("span",{className:"dbd-erd-colname",children:o.name}),I.jsx("span",{className:"dbd-erd-coltype",children:o.type}),I.jsx(Tt,{type:"source",position:G.Right,id:Om(o.name),className:"dbd-h-col"})]},o.name)})})]})}const b2={width:190,height:40},$2=230,z2=34,O2=22;function R2(e,t){var l;const n=e.nodes??{},r=Object.keys(n).filter(u=>!t||t.has(u)),o=r.map(u=>({id:u,type:"lineage",position:{x:0,y:0},data:{record:n[u]}})),i=(((l=e.lineage)==null?void 0:l.edges)??[]).filter(u=>!t||t.has(u.source)&&t.has(u.target)).map((u,a)=>({id:`l${a}`,source:u.source,target:u.target,type:"smoothstep"})),s=r.map(u=>({id:u,...b2}));return{nodes:o,edges:i,sizes:s}}function A2(e,t){const n=e.erd??{nodes:[],edges:[]};let r=n.nodes,o=n.edges;if(t){const c=new Set([t]);for(const f of n.edges)f.source===t&&c.add(f.target),f.target===t&&c.add(f.source);r=n.nodes.filter(f=>c.has(f.id)),o=n.edges.filter(f=>c.has(f.source)&&c.has(f.target))}const i=r.map(c=>({id:c.id,type:"erdTable",position:{x:0,y:0},data:{record:c,focused:c.id===t}})),s=new Map(r.map(c=>[c.id,new Set((c.columns??[]).map(f=>f.name))])),l=(c,f)=>{var d;return((d=s.get(c))==null?void 0:d.has(f))??!1},u=[];for(const c of o){const f=c.from_columns??[],d=c.to_columns??[],g=Math.max(f.length,d.length,1);for(let m=0;m({id:c.id,width:$2,height:z2+Math.max(1,(c.columns??[]).length)*O2}));return{nodes:i,edges:u,sizes:a}}function D2(e,t,n=2){var l,u;const r=new Set([t]),o=((l=e.lineage)==null?void 0:l.parents)??{},i=((u=e.lineage)==null?void 0:u.children)??{},s=(a,c,f)=>{if(!(f>=n))for(const d of c[a]??[])r.has(d)||(r.add(d),s(d,c,f+1))};return s(t,o,0),s(t,i,0),r}var j2="\0",Gn="\0",Rm="";let F2=class{constructor(t){Se(this,"_isDirected",!0);Se(this,"_isMultigraph",!1);Se(this,"_isCompound",!1);Se(this,"_label");Se(this,"_defaultNodeLabelFn",()=>{});Se(this,"_defaultEdgeLabelFn",()=>{});Se(this,"_nodes",{});Se(this,"_in",{});Se(this,"_preds",{});Se(this,"_out",{});Se(this,"_sucs",{});Se(this,"_edgeObjs",{});Se(this,"_edgeLabels",{});Se(this,"_nodeCount",0);Se(this,"_edgeCount",0);Se(this,"_parent");Se(this,"_children");t&&(this._isDirected=Object.hasOwn(t,"directed")?t.directed:!0,this._isMultigraph=Object.hasOwn(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.hasOwn(t,"compound")?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Gn]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,typeof t!="function"&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(n=>Object.keys(t._in[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(t._out[n]).length===0)}setNodes(t,n){var r=arguments,o=this;return t.forEach(function(i){r.length>1?o.setNode(i,n):o.setNode(i)}),this}setNode(t,n){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Gn,this._children[t]={},this._children[Gn][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var n=this;if(Object.hasOwn(this._nodes,t)){var r=o=>n.removeEdge(n._edgeObjs[o]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(o){n.setParent(o)}),delete this._children[t]),Object.keys(this._in[t]).forEach(r),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Gn;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var n=this._parent[t];if(n!==Gn)return n}}children(t=Gn){if(this._isCompound){var n=this._children[t];if(n)return Object.keys(n)}else{if(t===Gn)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=this._preds[t];if(n)return Object.keys(n)}successors(t){var n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const o=new Set(n);for(var r of this.successors(t))o.add(r);return Array.from(o.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([s,l]){t(s)&&n.setNode(s,l)}),Object.values(this._edgeObjs).forEach(function(s){n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,r.edge(s))});var o={};function i(s){var l=r.parent(s);return l===void 0||n.hasNode(l)?(o[s]=l,l):l in o?o[l]:i(l)}return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,i(s))),n}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,typeof t!="function"&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){var r=this,o=arguments;return t.reduce(function(i,s){return o.length>1?r.setEdge(i,s,n):r.setEdge(i,s),s}),this}setEdge(){var t,n,r,o,i=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,n=s.w,r=s.name,arguments.length===2&&(o=arguments[1],i=!0)):(t=s,n=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var l=qo(this._isDirected,t,n,r);if(Object.hasOwn(this._edgeLabels,l))return i&&(this._edgeLabels[l]=o),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),this._edgeLabels[l]=i?o:this._defaultEdgeLabelFn(t,n,r);var u=V2(this._isDirected,t,n,r);return t=u.v,n=u.w,Object.freeze(u),this._edgeObjs[l]=u,Am(this._preds[n],t),Am(this._sucs[t],n),this._in[n][l]=u,this._out[t][l]=u,this._edgeCount++,this}edge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r);return this._edgeLabels[o]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r);return Object.hasOwn(this._edgeLabels,o)}removeEdge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r),i=this._edgeObjs[o];return i&&(t=i.v,n=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],Dm(this._preds[n],t),Dm(this._sucs[t],n),delete this._in[n][o],delete this._out[t][o],this._edgeCount--),this}inEdges(t,n){var r=this._in[t];if(r){var o=Object.values(r);return n?o.filter(i=>i.v===n):o}}outEdges(t,n){var r=this._out[t];if(r){var o=Object.values(r);return n?o.filter(i=>i.w===n):o}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}};function Am(e,t){e[t]?e[t]++:e[t]=1}function Dm(e,t){--e[t]||delete e[t]}function qo(e,t,n,r){var o=""+t,i=""+n;if(!e&&o>i){var s=o;o=i,i=s}return o+Rm+i+Rm+(r===void 0?j2:r)}function V2(e,t,n,r){var o=""+t,i=""+n;if(!e&&o>i){var s=o;o=i,i=s}var l={v:o,w:i};return r&&(l.name=r),l}function oc(e,t){return qo(e,t.v,t.w,t.name)}var ic=F2,H2="2.2.4",B2={Graph:ic,version:H2},U2=ic,W2={write:Y2,read:Q2};function Y2(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:X2(e),edges:G2(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function X2(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function G2(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Q2(e){var t=new U2(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var K2=Z2;function Z2(e){var t={},n=[],r;function o(i){Object.hasOwn(t,i)||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var jm=class{constructor(){Se(this,"_arr",[]);Se(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,n){var r=this._keyIndices;if(t=String(t),!Object.hasOwn(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:n}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,n){var r=this._keyIndices[t];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)}_heapify(t){var n=this._arr,r=2*t,o=r+1,i=t;r>1,!(n[o].priority1;function eN(e,t,n,r){return tN(e,String(t),n||J2,r||function(o){return e.outEdges(o)})}function tN(e,t,n,r){var o={},i=new q2,s,l,u=function(a){var c=a.v!==s?a.v:a.w,f=o[c],d=n(a),g=l.distance+d;if(d<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+a+" Weight: "+d);g0&&(s=i.removeMin(),l=o[s],l.distance!==Number.POSITIVE_INFINITY);)r(s).forEach(u);return o}var nN=Fm,rN=oN;function oN(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=nN(e,o,t,n),r},{})}var Vm=iN;function iN(e){var t=0,n=[],r={},o=[];function i(s){var l=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(c){Object.hasOwn(r,c)?r[c].onStack&&(l.lowlink=Math.min(l.lowlink,r[c].index)):(i(c),l.lowlink=Math.min(l.lowlink,r[c].lowlink))}),l.lowlink===l.index){var u=[],a;do a=n.pop(),r[a].onStack=!1,u.push(a);while(s!==a);o.push(u)}}return e.nodes().forEach(function(s){Object.hasOwn(r,s)||i(s)}),o}var sN=Vm,lN=uN;function uN(e){return sN(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var aN=fN,cN=()=>1;function fN(e,t,n){return dN(e,t||cN,n||function(r){return e.outEdges(r)})}function dN(e,t,n){var r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0},o.forEach(function(s){i!==s&&(r[i][s]={distance:Number.POSITIVE_INFINITY})}),n(i).forEach(function(s){var l=s.v===i?s.w:s.v,u=t(s);r[i][l]={distance:u,predecessor:i}})}),o.forEach(function(i){var s=r[i];o.forEach(function(l){var u=r[l];o.forEach(function(a){var c=u[i],f=s[a],d=u[a],g=c.distance+f.distance;ge.successors(l):l=>e.neighbors(l),o=n==="post"?mN:yN,i=[],s={};return t.forEach(l=>{if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o(l,r,s,i)}),i}function mN(e,t,n,r){for(var o=[[e,!1]];o.length>0;){var i=o.pop();i[1]?r.push(i[0]):Object.hasOwn(n,i[0])||(n[i[0]]=!0,o.push([i[0],!0]),Ym(t(i[0]),s=>o.push([s,!1])))}}function yN(e,t,n,r){for(var o=[e];o.length>0;){var i=o.pop();Object.hasOwn(n,i)||(n[i]=!0,r.push(i),Ym(t(i),s=>o.push(s)))}}function Ym(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var vN=Wm,wN=xN;function xN(e,t){return vN(e,t,"post")}var EN=Wm,_N=SN;function SN(e,t){return EN(e,t,"pre")}var kN=ic,NN=jm,CN=MN;function MN(e,t){var n=new kN,r={},o=new NN,i;function s(u){var a=u.v===i?u.w:u.v,c=o.priority(a);if(c!==void 0){var f=t(u);f0;){if(i=o.removeMin(),Object.hasOwn(r,i))n.setEdge(i,r[i]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(i).forEach(s)}return n}var IN={components:K2,dijkstra:Fm,dijkstraAll:rN,findCycles:lN,floydWarshall:aN,isAcyclic:hN,postorder:wN,preorder:_N,prim:CN,tarjan:Vm,topsort:Bm},Xm=B2,xt={Graph:Xm.Graph,json:W2,alg:IN,version:Xm.version};let PN=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,n=t._prev;if(n!==t)return Gm(n),n}enqueue(t){let n=this._sentinel;t._prev&&t._next&&Gm(t),t._next=n._next,n._next._prev=t,n._next=t,t._prev=n}toString(){let t=[],n=this._sentinel,r=n._prev;for(;r!==n;)t.push(JSON.stringify(r,LN)),r=r._prev;return"["+t.join(", ")+"]"}};function Gm(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function LN(e,t){if(e!=="_next"&&e!=="_prev")return t}var TN=PN;let bN=xt.Graph,$N=TN;var zN=RN;let ON=()=>1;function RN(e,t){if(e.nodeCount()<=1)return[];let n=DN(e,t||ON);return AN(n.graph,n.buckets,n.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w))}function AN(e,t,n){let r=[],o=t[t.length-1],i=t[0],s;for(;e.nodeCount();){for(;s=i.dequeue();)lc(e,t,n,s);for(;s=o.dequeue();)lc(e,t,n,s);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(s=t[l].dequeue(),s){r=r.concat(lc(e,t,n,s,!0));break}}}return r}function lc(e,t,n,r,o){let i=o?[]:void 0;return e.inEdges(r.v).forEach(s=>{let l=e.edge(s),u=e.node(s.v);o&&i.push({v:s.v,w:s.w}),u.out-=l,uc(t,n,u)}),e.outEdges(r.v).forEach(s=>{let l=e.edge(s),u=s.w,a=e.node(u);a.in-=l,uc(t,n,a)}),e.removeNode(r.v),i}function DN(e,t){let n=new bN,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let u=n.edge(l.v,l.w)||0,a=t(l),c=u+a;n.setEdge(l.v,l.w,c),o=Math.max(o,n.node(l.v).out+=a),r=Math.max(r,n.node(l.w).in+=a)});let i=jN(o+r+3).map(()=>new $N),s=r+1;return n.nodes().forEach(l=>{uc(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function uc(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function jN(e){const t=[];for(let n=0;nt.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function VN(e){let t=new Qm({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function HN(e){let t=e.nodes().map(n=>{let r={};return e.outEdges(n).forEach(o=>{r[o.w]=(r[o.w]||0)+e.edge(o).weight}),r});return ac(e.nodes(),t)}function BN(e){let t=e.nodes().map(n=>{let r={};return e.inEdges(n).forEach(o=>{r[o.v]=(r[o.v]||0)+e.edge(o).weight}),r});return ac(e.nodes(),t)}function UN(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,l=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let u,a;return Math.abs(i)*s>Math.abs(o)*l?(i<0&&(l=-l),u=l*o/i,a=l):(o<0&&(s=-s),u=s,a=s*i/o),{x:n+u,y:r+a}}function WN(e){let t=e0(qm(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o][r.order]=n)}),t}function YN(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Zs(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function XN(e){let t=e.nodes().map(s=>e.node(s).rank),n=Zs(Math.min,t),r=[];e.nodes().forEach(s=>{let l=e.node(s).rank-n;r[l]||(r[l]=[]),r[l].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,l)=>{s===void 0&&l%i!==0?--o:s!==void 0&&o&&s.forEach(u=>e.node(u).rank+=o)})}function GN(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Km(e,"border",o,t)}function QN(e,t=Zm){const n=[];for(let r=0;rZm){const n=QN(t);return e.apply(null,n.map(r=>e.apply(null,r)))}else return e.apply(null,t)}function qm(e){const n=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MIN_VALUE:o});return Zs(Math.max,n)}function KN(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function ZN(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function qN(e,t){return t()}let JN=0;function Jm(e){var t=++JN;return e+(""+t)}function e0(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]),Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function ac(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}let nC=zN,rC=_e.uniqueId;var oC={run:iC,undo:lC};function iC(e){(e.graph().acyclicer==="greedy"?nC(e,n(e)):sC(e)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,rC("rev"))});function n(r){return o=>r.edge(o).weight}}function sC(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(s=>{Object.hasOwn(n,s.w)?t.push(s):o(s.w)}),delete n[i])}return e.nodes().forEach(o),t}function lC(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}let uC=_e;var aC={run:cC,undo:dC};function cC(e){e.graph().dummyChains=[],e.edges().forEach(t=>fC(e,t))}function fC(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,l=e.edge(t),u=l.labelRank;if(i===r+1)return;e.removeEdge(t);let a,c,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}const{applyWithChunking:hC}=_e;var qs={longestPath:pC,slack:gC};function pC(e){var t={};function n(r){var o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-e.edge(l).minlen);var s=hC(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}e.sources().forEach(n)}function gC(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var mC=xt.Graph,Js=qs.slack,t0=yC;function yC(e){var t=new mC({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var o,i;vC(t,e){var i=o.v,s=r===i?o.w:i;!e.hasNode(s)&&!Js(t,o)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function wC(e,t){return t.edges().reduce((r,o)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(i=Js(t,o)),it.node(r).rank+=n)}var EC=t0,n0=qs.slack,_C=qs.longestPath,SC=xt.alg.preorder,kC=xt.alg.postorder,NC=_e.simplify,CC=Qn;Qn.initLowLimValues=fc,Qn.initCutValues=cc,Qn.calcCutValue=r0,Qn.leaveEdge=i0,Qn.enterEdge=s0,Qn.exchangeEdges=l0;function Qn(e){e=NC(e),_C(e);var t=EC(e);fc(t),cc(t,e);for(var n,r;n=i0(t);)r=s0(t,e,n),l0(t,e,n,r)}function cc(e,t){var n=kC(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>MC(e,t,r))}function MC(e,t,n){var r=e.node(n),o=r.parent;e.edge(n,o).cutvalue=r0(e,t,n)}function r0(e,t,n){var r=e.node(n),o=r.parent,i=!0,s=t.edge(n,o),l=0;return s||(i=!1,s=t.edge(o,n)),l=s.weight,t.nodeEdges(n).forEach(u=>{var a=u.v===n,c=a?u.w:u.v;if(c!==o){var f=a===i,d=t.edge(u).weight;if(l+=f?d:-d,PC(e,n,c)){var g=e.edge(n,c).cutvalue;l+=f?-g:g}}}),l}function fc(e,t){arguments.length<2&&(t=e.nodes()[0]),o0(e,{},1,t)}function o0(e,t,n,r,o){var i=n,s=e.node(r);return t[r]=!0,e.neighbors(r).forEach(l=>{Object.hasOwn(t,l)||(n=o0(e,t,n,l,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function i0(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function s0(e,t,n){var r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);var i=e.node(r),s=e.node(o),l=i,u=!1;i.lim>s.lim&&(l=s,u=!0);var a=t.edges().filter(c=>u===u0(e,e.node(c.v),l)&&u!==u0(e,e.node(c.w),l));return a.reduce((c,f)=>n0(t,f)!t.node(o).parent),r=SC(e,n);r=r.slice(1),r.forEach(o=>{var i=e.node(o).parent,s=t.edge(o,i),l=!1;s||(s=t.edge(i,o),l=!0),t.node(o).rank=t.node(i).rank+(l?s.minlen:-s.minlen)})}function PC(e,t,n){return e.hasEdge(t,n)}function u0(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var LC=qs,a0=LC.longestPath,TC=t0,bC=CC,$C=zC;function zC(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":c0(e);break;case"tight-tree":RC(e);break;case"longest-path":OC(e);break;case"none":break;default:c0(e)}}var OC=a0;function RC(e){a0(e),TC(e)}function c0(e){bC(e)}var AC=DC;function DC(e){let t=FC(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=jC(e,t,o.v,o.w),s=i.path,l=i.lca,u=0,a=s[u],c=!0;for(;n!==o.w;){if(r=e.node(n),c){for(;(a=s[u])!==l&&e.node(a).maxRanks||l>t[u].lim));for(a=u,u=r;(u=e.parent(u))!==a;)i.push(u);return{path:o.concat(i.reverse()),lca:a}}function FC(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children().forEach(r),t}let el=_e;var VC={run:HC,cleanup:WC};function HC(e){let t=el.addDummyNode(e,"root",{},"_root"),n=BC(e),r=Object.values(n),o=el.applyWithChunking(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let s=UC(e)+1;e.children().forEach(l=>f0(e,t,i,s,o,n,l)),e.graph().nodeRankFactor=i}function f0(e,t,n,r,o,i,s){let l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=el.addBorderNode(e,"_bt"),a=el.addBorderNode(e,"_bb"),c=e.node(s);e.setParent(u,s),c.borderTop=u,e.setParent(a,s),c.borderBottom=a,l.forEach(f=>{f0(e,t,n,r,o,i,f);let d=e.node(f),g=d.borderTop?d.borderTop:f,m=d.borderBottom?d.borderBottom:f,w=d.borderTop?r:2*r,x=g!==m?1:o-i[s]+1;e.setEdge(u,g,{weight:w,minlen:x,nestingEdge:!0}),e.setEdge(m,a,{weight:w,minlen:x,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:o+i[s]})}function BC(e){var t={};function n(r,o){var i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children().forEach(r=>n(r,1)),t}function UC(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function WC(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}let YC=_e;var XC=GC;function GC(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;ip0(e.node(t))),e.edges().forEach(t=>p0(e.edge(t)))}function p0(e){let t=e.width;e.width=e.height,e.height=t}function qC(e){e.nodes().forEach(t=>dc(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(dc),Object.hasOwn(n,"y")&&dc(n)})}function dc(e){e.y=-e.y}function JC(e){e.nodes().forEach(t=>hc(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(hc),Object.hasOwn(n,"x")&&hc(n)})}function hc(e){let t=e.x;e.x=e.y,e.y=t}let g0=_e;var eM=tM;function tM(e){let t={},n=e.nodes().filter(u=>!e.children(u).length),r=n.map(u=>e.node(u).rank),o=g0.applyWithChunking(Math.max,r),i=g0.range(o+1).map(()=>[]);function s(u){if(t[u])return;t[u]=!0;let a=e.node(u);i[a.rank].push(u),e.successors(u).forEach(s)}return n.sort((u,a)=>e.node(u).rank-e.node(a).rank).forEach(s),i}let nM=_e.zipObject;var rM=oM;function oM(e,t){let n=0;for(let r=1;rc)),o=t.flatMap(a=>e.outEdges(a).map(c=>({pos:r[c.w],weight:e.edge(c).weight})).sort((c,f)=>c.pos-f.pos)),i=1;for(;i{let c=a.pos+i;l[c]+=a.weight;let f=0;for(;c>0;)c%2&&(f+=l[c+1]),c=c-1>>1,l[c]+=a.weight;u+=a.weight*f}),u}var sM=lM;function lM(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(r.length){let o=r.reduce((i,s)=>{let l=e.edge(s),u=e.node(s.v);return{sum:i.sum+l.weight*u.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:n}})}let uM=_e;var aM=cM;function cM(e,t){let n={};e.forEach((o,i)=>{let s=n[o.v]={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight)}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(n[o.w]))});let r=Object.values(n).filter(o=>!o.indegree);return fM(r)}function fM(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&dM(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>uM.pick(o,["vs","i","barycenter","weight"]))}function dM(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}let hM=_e;var pM=gM;function gM(e,t){let n=hM.partition(e,c=>Object.hasOwn(c,"barycenter")),r=n.lhs,o=n.rhs.sort((c,f)=>f.i-c.i),i=[],s=0,l=0,u=0;r.sort(mM(!!t)),u=m0(i,o,u),r.forEach(c=>{u+=c.vs.length,i.push(c.vs),s+=c.barycenter*c.weight,l+=c.weight,u=m0(i,o,u)});let a={vs:i.flat(!0)};return l&&(a.barycenter=s/l,a.weight=l),a}function m0(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function mM(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}let yM=sM,vM=aM,wM=pM;var xM=y0;function y0(e,t,n,r){let o=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,u={};s&&(o=o.filter(d=>d!==s&&d!==l));let a=yM(e,o);a.forEach(d=>{if(e.children(d.v).length){let g=y0(e,d.v,n,r);u[d.v]=g,Object.hasOwn(g,"barycenter")&&_M(d,g)}});let c=vM(a,n);EM(c,u);let f=wM(c,r);if(s&&(f.vs=[s,f.vs,l].flat(!0),e.predecessors(s).length)){let d=e.node(e.predecessors(s)[0]),g=e.node(e.predecessors(l)[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+d.order+g.order)/(f.weight+2),f.weight+=2}return f}function EM(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function _M(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}let SM=xt.Graph,kM=_e;var NM=CM;function CM(e,t,n,r){r||(r=e.nodes());let o=MM(e),i=new SM({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let l=e.node(s),u=e.parent(s);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(i.setNode(s),i.setParent(s,u||o),e[n](s).forEach(a=>{let c=a.v===s?a.w:a.v,f=i.edge(c,s),d=f!==void 0?f.weight:0;i.setEdge(c,s,{weight:e.edge(a).weight+d})}),Object.hasOwn(l,"minRank")&&i.setNode(s,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),i}function MM(e){for(var t;e.hasNode(t=kM.uniqueId("_root")););return t}var IM=PM;function PM(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),l,u;for(;s;){if(l=e.parent(s),l?(u=r[l],r[l]=s):(u=o,o=s),u&&u!==s){t.setEdge(u,s);return}s=l}})}let LM=eM,TM=rM,bM=xM,$M=NM,zM=IM,OM=xt.Graph,tl=_e;var RM=v0;function v0(e,t){if(t&&typeof t.customOrder=="function"){t.customOrder(e,v0);return}let n=tl.maxRank(e),r=w0(e,tl.range(1,n+1),"inEdges"),o=w0(e,tl.range(n-1,-1,-1),"outEdges"),i=LM(e);if(x0(e,i),t&&t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,l;for(let u=0,a=0;a<4;++u,++a){AM(u%2?r:o,u%4>=2),i=tl.buildLayerMatrix(e);let c=TM(e,i);c{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(const i of e.nodes()){const s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let l=s.minRank;l<=s.maxRank;l++)l!==s.rank&&o(l,i)}return t.map(function(i){return $M(e,i,n,r.get(i)||[])})}function AM(e,t){let n=new OM;e.forEach(function(r){let o=r.graph().root,i=bM(r,o,n,t);i.vs.forEach((s,l)=>r.node(s).order=l),zM(r,n,i.vs)})}function x0(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}let DM=xt.Graph,Kt=_e;var jM={positionX:KM};function FM(e,t){let n={};function r(o,i){let s=0,l=0,u=o.length,a=i[i.length-1];return i.forEach((c,f)=>{let d=HM(e,c),g=d?e.node(d).order:u;(d||c===a)&&(i.slice(l,f+1).forEach(m=>{e.predecessors(m).forEach(w=>{let x=e.node(w),p=x.order;(p{c=i[f],e.node(c).dummy&&e.predecessors(c).forEach(d=>{let g=e.node(d);g.dummy&&(g.ordera)&&E0(n,d,c)})})}function o(i,s){let l=-1,u,a=0;return s.forEach((c,f)=>{if(e.node(c).dummy==="border"){let d=e.predecessors(c);d.length&&(u=e.node(d[0]).order,r(s,a,f,l,u),a=f,l=u)}r(s,a,s.length,u,i.length)}),s}return t.length&&t.reduce(o),n}function HM(e,t){if(e.node(t).dummy)return e.predecessors(t).find(n=>e.node(n).dummy)}function E0(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function BM(e,t,n){if(t>n){let r=t;t=n,n=r}return!!e[t]&&Object.hasOwn(e[t],n)}function UM(e,t,n,r){let o={},i={},s={};return t.forEach(l=>{l.forEach((u,a)=>{o[u]=u,i[u]=u,s[u]=a})}),t.forEach(l=>{let u=-1;l.forEach(a=>{let c=r(a);if(c.length){c=c.sort((d,g)=>s[d]-s[g]);let f=(c.length-1)/2;for(let d=Math.floor(f),g=Math.ceil(f);d<=g;++d){let m=c[d];i[a]===a&&uMath.max(d,i[g.v]+s.edge(g)),0)}function c(f){let d=s.outEdges(f).reduce((m,w)=>Math.min(m,i[w.w]-s.edge(w)),Number.POSITIVE_INFINITY),g=e.node(f);d!==Number.POSITIVE_INFINITY&&g.borderType!==l&&(i[f]=Math.max(i[f],d))}return u(a,s.predecessors.bind(s)),u(c,s.successors.bind(s)),Object.keys(r).forEach(f=>i[f]=i[n[f]]),i}function YM(e,t,n,r){let o=new DM,i=e.graph(),s=ZM(i.nodesep,i.edgesep,r);return t.forEach(l=>{let u;l.forEach(a=>{let c=n[a];if(o.setNode(c),u){var f=n[u],d=o.edge(f,c);o.setEdge(f,c,Math.max(s(e,a,u),d||0))}u=a})}),o}function XM(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,u])=>{let a=qM(e,l)/2;o=Math.max(u+a,o),i=Math.min(u-a,i)});const s=o-i;return s{["l","r"].forEach(s=>{let l=i+s,u=e[l];if(u===t)return;let a=Object.values(u),c=r-Kt.applyWithChunking(Math.min,a);s!=="l"&&(c=o-Kt.applyWithChunking(Math.max,a)),c&&(e[l]=Kt.mapValues(u,f=>f+c))})})}function QM(e,t){return Kt.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let o=Object.values(e).map(i=>i[r]).sort((i,s)=>i-s);return(o[1]+o[2])/2}})}function KM(e){let t=Kt.buildLayerMatrix(e),n=Object.assign(FM(e,t),VM(e,t)),r={},o;["u","d"].forEach(s=>{o=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(o=o.map(f=>Object.values(f).reverse()));let u=(s==="u"?e.predecessors:e.successors).bind(e),a=UM(e,o,n,u),c=WM(e,o,a.root,a.align,l==="r");l==="r"&&(c=Kt.mapValues(c,f=>-f)),r[s+l]=c})});let i=XM(e,r);return GM(r,i),QM(r,e.graph().align)}function ZM(e,t,n){return(r,o,i)=>{let s=r.node(o),l=r.node(i),u=0,a;if(u+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2;break}if(a&&(u+=n?a:-a),a=0,u+=(s.dummy?t:e)/2,u+=(l.dummy?t:e)/2,u+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2;break}return a&&(u+=n?a:-a),a=0,u}}function qM(e,t){return e.node(t).width}let _0=_e,JM=jM.positionX;var e3=t3;function t3(e){e=_0.asNonCompoundGraph(e),n3(e),Object.entries(JM(e)).forEach(([t,n])=>e.node(t).x=n)}function n3(e){let t=_0.buildLayerMatrix(e),n=e.graph().ranksep,r=0;t.forEach(o=>{const i=o.reduce((s,l)=>{const u=e.node(l).height;return s>u?s:u},0);o.forEach(s=>e.node(s).y=r+i/2),r+=i+n})}let S0=oC,k0=aC,r3=$C,o3=_e.normalizeRanks,i3=AC,s3=_e.removeEmptyRanks,N0=VC,l3=XC,C0=QC,u3=RM,a3=e3,it=_e,c3=xt.Graph;var f3=d3;function d3(e,t){let n=t&&t.debugTiming?it.time:it.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>_3(e));n(" runLayout",()=>h3(r,n,t)),n(" updateInputGraph",()=>p3(e,r))})}function h3(e,t,n){t(" makeSpaceForEdgeLabels",()=>S3(e)),t(" removeSelfEdges",()=>b3(e)),t(" acyclic",()=>S0.run(e)),t(" nestingGraph.run",()=>N0.run(e)),t(" rank",()=>r3(it.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>k3(e)),t(" removeEmptyRanks",()=>s3(e)),t(" nestingGraph.cleanup",()=>N0.cleanup(e)),t(" normalizeRanks",()=>o3(e)),t(" assignRankMinMax",()=>N3(e)),t(" removeEdgeLabelProxies",()=>C3(e)),t(" normalize.run",()=>k0.run(e)),t(" parentDummyChains",()=>i3(e)),t(" addBorderSegments",()=>l3(e)),t(" order",()=>u3(e,n)),t(" insertSelfEdges",()=>$3(e)),t(" adjustCoordinateSystem",()=>C0.adjust(e)),t(" position",()=>a3(e)),t(" positionSelfEdges",()=>z3(e)),t(" removeBorderNodes",()=>T3(e)),t(" normalize.undo",()=>k0.undo(e)),t(" fixupEdgeLabelCoords",()=>P3(e)),t(" undoCoordinateSystem",()=>C0.undo(e)),t(" translateGraph",()=>M3(e)),t(" assignNodeIntersects",()=>I3(e)),t(" reversePoints",()=>L3(e)),t(" acyclic.undo",()=>S0.undo(e))}function p3(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let g3=["nodesep","edgesep","ranksep","marginx","marginy"],m3={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},y3=["acyclicer","ranker","rankdir","align"],v3=["width","height","rank"],M0={width:0,height:0},w3=["minlen","weight","width","height","labeloffset"],x3={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},E3=["labelpos"];function _3(e){let t=new c3({multigraph:!0,compound:!0}),n=gc(e.graph());return t.setGraph(Object.assign({},m3,pc(n,g3),it.pick(n,y3))),e.nodes().forEach(r=>{let o=gc(e.node(r));const i=pc(o,v3);Object.keys(M0).forEach(s=>{i[s]===void 0&&(i[s]=M0[s])}),t.setNode(r,i),t.setParent(r,e.parent(r))}),e.edges().forEach(r=>{let o=gc(e.edge(r));t.setEdge(r,Object.assign({},x3,pc(o,w3),it.pick(o,E3)))}),t}function S3(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function k3(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};it.addDummyNode(e,"edge-proxy",i,"_ep")}})}function N3(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function C3(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy==="edge-proxy"&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function M3(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,l=i.marginy||0;function u(a){let c=a.x,f=a.y,d=a.width,g=a.height;t=Math.min(t,c-d/2),n=Math.max(n,c+d/2),r=Math.min(r,f-g/2),o=Math.max(o,f+g/2)}e.nodes().forEach(a=>u(e.node(a))),e.edges().forEach(a=>{let c=e.edge(a);Object.hasOwn(c,"x")&&u(c)}),t-=s,r-=l,e.nodes().forEach(a=>{let c=e.node(a);c.x-=t,c.y-=r}),e.edges().forEach(a=>{let c=e.edge(a);c.points.forEach(f=>{f.x-=t,f.y-=r}),Object.hasOwn(c,"x")&&(c.x-=t),Object.hasOwn(c,"y")&&(c.y-=r)}),i.width=n-t+s,i.height=o-r+l}function I3(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(it.intersectRect(r,i)),n.points.push(it.intersectRect(o,s))})}function P3(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function L3(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function T3(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function b3(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $3(e){var t=it.buildLayerMatrix(e);t.forEach(n=>{var r=0;n.forEach((o,i)=>{var s=e.node(o);s.order=i+r,(s.selfEdges||[]).forEach(l=>{it.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:s.rank,order:i+ ++r,e:l.e,label:l.label},"_se")}),delete s.selfEdges})})}function z3(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy==="selfedge"){var r=e.node(n.e.v),o=r.x+r.width/2,i=r.y,s=n.x-o,l=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:o+2*s/3,y:i-l},{x:o+5*s/6,y:i-l},{x:o+s,y:i},{x:o+5*s/6,y:i+l},{x:o+2*s/3,y:i+l}],n.label.x=n.x,n.label.y=n.y}})}function pc(e,t){return it.mapValues(it.pick(e,t),Number)}function gc(e){var t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}let O3=_e,R3=xt.Graph;var A3={debugOrdering:D3};function D3(e){let t=O3.buildLayerMatrix(e),n=new R3({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,l)=>(n.setEdge(s,l,{style:"invis"}),l))}),n}var j3="1.1.8",F3={graphlib:xt,layout:f3,debug:A3,util:{time:_e.time,notime:_e.notime},version:j3};const I0=zt(F3),V3="LR",H3=60,B3=140;function U3(e,t){const n=new I0.graphlib.Graph;n.setGraph({rankdir:V3,nodesep:H3,ranksep:B3,marginx:24,marginy:24}),n.setDefaultEdgeLabel(()=>({}));for(const o of e)n.setNode(o.id,{width:o.width,height:o.height});for(const o of t)n.hasNode(o.source)&&n.hasNode(o.target)&&n.setEdge(o.source,o.target);I0.layout(n);const r=new Map;for(const o of e){const i=n.node(o.id);i&&r.set(o.id,{x:i.x-o.width/2,y:i.y-o.height/2})}return r}function W3(e,t){return e.map(n=>({...n,position:t.get(n.id)??{x:0,y:0}}))}function Y3(e){return e.map(t=>({source:t.source,target:t.target}))}const X3={model:"var(--model, #2f6feb)",source:"var(--source, #16a34a)",seed:"var(--seed, #b45309)",snapshot:"var(--snapshot, #7c3aed)"};function G3({data:e}){const t=e.record,n=e.dimmed,r=X3[t.resource_type]??"var(--border, #888)";return I.jsxs("div",{className:`dbd-node${n?" dbd-dim":""}`,title:t.id,children:[I.jsx(Tt,{type:"target",position:G.Left}),I.jsx("span",{className:"dbd-node-bar",style:{background:r}}),I.jsx("span",{className:"dbd-node-label",children:t.label}),I.jsx(Tt,{type:"source",position:G.Right})]})}const Q3={lineage:G3,erdTable:T2},K3=400;function Z3(e){const t=new Set;for(const n of Object.keys(e.nodes??{}))t.add(e.nodes[n].schema);return Array.from(t).sort()}function q3(e,t,n){const r=[];return e&&r.push("focus="+encodeURIComponent(e)),t&&r.push("rtype="+encodeURIComponent(t)),n&&r.push("schema="+encodeURIComponent(n)),r.length?"#/dag?"+r.join("&"):"#/dag"}function J3({mode:e,focus:t,data:n,onOpenNode:r,initialRtype:o="",initialSchema:i=""}){var M,N;const s=e==="dag",[l,u]=D.useState(!1),a=e==="erd",c=s||a&&l,f=!c,d=t&&((M=n.nodes)!=null&&M[t])?n.nodes[t].label:t??"",[g,m]=D.useState(d),[w,x]=D.useState(o),[p,y]=D.useState(i),[h,v]=D.useState(null),E=D.useMemo(()=>{if(!s)return t??null;const P=g.trim().toLowerCase();if(!P)return null;const A=Object.keys(n.nodes??{});return A.find(O=>O.toLowerCase()===P)??A.find(O=>n.nodes[O].label.toLowerCase()===P)??A.find(O=>n.nodes[O].label.toLowerCase().startsWith(P))??null},[s,g,t,n]);D.useEffect(()=>{if(!s)return;const P=q3(E,w,p);history.replaceState(null,"",P)},[s,E,w,p]);const _=D.useMemo(()=>{if(!s)return null;if(E)return D2(n,E);const P=Object.keys(n.nodes??{}).filter(A=>{const O=n.nodes[A];return!(w&&O.resource_type!==w||p&&O.schema!==p)});return P.length>K3?new Set:new Set(P)},[s,E,n,w,p]),k=!!(w||p),C=s&&!E&&_!==null&&_.size===0,b=C&&k,j=C&&!k,{nodes:T,edges:R}=D.useMemo(()=>{if(C)return{nodes:[],edges:[]};const P=s?R2(n,_??void 0):A2(n,e==="erd-node"?t:null),A=U3(P.sizes,Y3(P.edges));let O=W3(P.nodes,A),U=P.edges;if(s)O=O.map(B=>({...B,data:{...B.data,dimmed:!1,focused:B.id===E}})),U=P.edges.map(B=>({...B,animated:!!E,style:E?{stroke:"var(--accent, #2f6feb)",strokeWidth:2}:void 0}));else if(h){const B=new Set([h.source,h.target]);O=O.map(X=>({...X,data:{...X.data,dimmed:!B.has(X.id)}})),U=P.edges.map(X=>{const q=X.source===h.source&&X.target===h.target;return{...X,animated:q,style:q?{stroke:"var(--accent, #2f6feb)",strokeWidth:2.5}:{opacity:.1}}})}return{nodes:O,edges:U}},[s,e,t,E,n,_,C,h]),V=e==="erd-node"&&R.length===0,S=((N=n.metadata)==null?void 0:N.erd_algo)??"test_relationship",$=(P,A)=>{r&&r(A.id)},L=(P,A)=>{v(O=>O&&O.source===A.source&&O.target===A.target?null:{source:A.source,target:A.target})},z=()=>v(null);return I.jsxs("div",{className:"dbd-graph",children:[s&&I.jsxs("div",{className:"dbd-toolbar",children:[I.jsx("input",{placeholder:"Focus a node…",value:g,onChange:P=>m(P.target.value)}),I.jsxs("select",{value:w,onChange:P=>x(P.target.value),children:[I.jsx("option",{value:"",children:"All types"}),I.jsx("option",{value:"model",children:"Models"}),I.jsx("option",{value:"source",children:"Sources"}),I.jsx("option",{value:"seed",children:"Seeds"}),I.jsx("option",{value:"snapshot",children:"Snapshots"})]}),I.jsxs("select",{value:p,onChange:P=>y(P.target.value),children:[I.jsx("option",{value:"",children:"All schemas"}),Z3(n).map(P=>I.jsx("option",{value:P,children:P},P))]})]}),a&&I.jsx("div",{className:"dbd-erd-bar",children:I.jsx("button",{type:"button",className:`dbd-lock-btn${l?" on":""}`,onClick:()=>u(P=>!P),title:l?"Lock pan & zoom":"Unlock pan & zoom",children:l?"🔓 Pan & zoom on":"🔒 Locked — click to pan & zoom"})}),I.jsx("div",{className:"dbd-canvas",children:b?I.jsx("div",{className:"dbd-graph-empty",children:I.jsx("p",{children:"No nodes match the selected filter. Clear or change the type/schema filter above, or focus a node to explore its neighborhood."})}):j?I.jsx("div",{className:"dbd-graph-empty",children:I.jsx("p",{children:"This project has too many models to draw the full lineage at once. Focus a node above (or filter by type/schema) to explore its neighborhood."})}):V?I.jsx("div",{className:"dbd-graph-empty",children:I.jsxs("p",{children:["No ERD relationships detected for this entity using the"," ",I.jsx("code",{children:S})," algorithm. dbterd infers foreign keys from your project; see"," ",I.jsx("a",{href:"https://dbterd.datnguye.me/latest/nav/guide/choose-algo.html",target:"_blank",rel:"noopener",children:"choosing a dbterd algorithm"})," ","to configure detection."]})}):I.jsx(Im,{children:I.jsxs(e2,{nodes:T,edges:R,nodeTypes:Q3,onNodeClick:$,onEdgeClick:L,onPaneClick:z,fitView:!0,minZoom:.1,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,...f?{panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,fitViewOptions:{padding:.15}}:{},children:[I.jsx(i2,{}),c&&I.jsx(d2,{showInteractive:!1}),c&&I.jsx(N2,{pannable:!0,zoomable:!0})]})})})]})}const mc=new WeakMap;function eI(e){const t=window.dbdocsData;if(!t)return;const n=e.dataset.mode||"dag",r=e.dataset.focus||null,o=e.dataset.rtype||"",i=e.dataset.schema||"",s=u=>{location.hash=`#/node/${encodeURIComponent(u)}`},l=jh(e);mc.set(e,l),l.render(I.jsx(D.StrictMode,{children:I.jsx(J3,{mode:n,focus:r,data:t,onOpenNode:s,initialRtype:o,initialSchema:i})}))}function tI(e){const t=mc.get(e);t&&(t.unmount(),mc.delete(e))}window.dbdocsGraph={mount:eI,unmount:tI}})(); +`)),f=a.reduce((c,d)=>c.concat(...d),[]);return[a,f]}return[[],[]]},[e]);return D.useEffect(()=>{const u=(t==null?void 0:t.target)??jg,a=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=g=>{var x,p;if(o.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!o.current||o.current&&!a)&&Kp(g))return!1;const w=Vg(g.code,l);if(i.current.add(g[w]),Fg(s,i.current,!1)){const y=((p=(x=g.composedPath)==null?void 0:x.call(g))==null?void 0:p[0])||g.target,h=(y==null?void 0:y.nodeName)==="BUTTON"||(y==null?void 0:y.nodeName)==="A";t.preventDefault!==!1&&(o.current||!h)&&g.preventDefault(),r(!0)}},c=g=>{const m=Vg(g.code,l);Fg(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(g[m]),g.key==="Meta"&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",f),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{u==null||u.removeEventListener("keydown",f),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function Fg(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Vg(e,t){return t.includes(e)?"code":"key"}const IS=()=>{const e=he();return D.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!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),!0):!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=Da(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}),!0):!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},f=n.snapGrid??o,c=n.snapToGrid??i;return Or(a,r,c,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=Rr(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function Hg(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)PS(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 PS(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 LS(e,t){return Hg(e,t)}function TS(e,t){return Hg(e,t)}function Xn(e,t){return{id:e,type:"select",selected:t}}function Vr(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(Xn(i.id,s)))}return r}function Bg({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 Ug(e){return{id:e.id,type:"remove"}}const bS=Wp();function $S(e,t,n={}){return r_(e,t,{...n,onError:n.onError??bS})}const Wg=e=>HE(e),zS=e=>jp(e);function Yg(e){return D.forwardRef(e)}const OS=typeof window<"u"?D.useLayoutEffect:D.useEffect;function Xg(e){const[t,n]=D.useState(BigInt(0)),[r]=D.useState(()=>RS(()=>n(o=>o+BigInt(1))));return OS(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function RS(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Gg=D.createContext(null);function AS({children:e}){const t=he(),n=D.useCallback(l=>{const{nodes:u=[],setNodes:a,hasDefaultNodes:f,onNodesChange:c,nodeLookup:d,fitViewQueued:g,onNodesChangeMiddlewareMap:m}=t.getState();let w=u;for(const p of l)w=typeof p=="function"?p(w):p;let x=Bg({items:w,lookup:d});for(const p of m.values())x=p(x);f&&a(w),x.length>0?c==null||c(x):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:y,setNodes:h}=t.getState();p&&h(y)})},[]),r=Xg(n),o=D.useCallback(l=>{const{edges:u=[],setEdges:a,hasDefaultEdges:f,onEdgesChange:c,edgeLookup:d}=t.getState();let g=u;for(const m of l)g=typeof m=="function"?m(g):m;f?a(g):c&&c(Bg({items:g,lookup:d}))},[]),i=Xg(o),s=D.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return I.jsx(Gg.Provider,{value:s,children:e})}function DS(){const e=D.useContext(Gg);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const jS=e=>!!e.panZoom;function Ja(){const e=IS(),t=he(),n=DS(),r=re(jS),o=D.useMemo(()=>{const i=c=>t.getState().nodeLookup.get(c),s=c=>{n.nodeQueue.push(c)},l=c=>{n.edgeQueue.push(c)},u=c=>{var p,y;const{nodeLookup:d,nodeOrigin:g}=t.getState(),m=Wg(c)?c:d.get(c.id),w=m.parentId?Xp(m.position,m.measured,m.parentId,d,g):m.position,x={...m,position:w,width:((p=m.measured)==null?void 0:p.width)??m.width,height:((y=m.measured)==null?void 0:y.height)??m.height};return zr(x)},a=(c,d,g={replace:!1})=>{s(m=>m.map(w=>{if(w.id===c){const x=typeof d=="function"?d(w):d;return g.replace&&Wg(x)?x:{...w,...x}}return w}))},f=(c,d,g={replace:!1})=>{l(m=>m.map(w=>{if(w.id===c){const x=typeof d=="function"?d(w):d;return g.replace&&zS(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var d;return(d=i(c))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(d=>({...d}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:s,setEdges:l,addNodes:c=>{const d=Array.isArray(c)?c:[c];n.nodeQueue.push(g=>[...g,...d])},addEdges:c=>{const d=Array.isArray(c)?c:[c];n.edgeQueue.push(g=>[...g,...d])},toObject:()=>{const{nodes:c=[],edges:d=[],transform:g}=t.getState(),[m,w,x]=g;return{nodes:c.map(p=>({...p})),edges:d.map(p=>({...p})),viewport:{x:m,y:w,zoom:x}}},deleteElements:async({nodes:c=[],edges:d=[]})=>{const{nodes:g,edges:m,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:p,triggerEdgeChanges:y,onDelete:h,onBeforeDelete:v}=t.getState(),{nodes:E,edges:_}=await XE({nodesToRemove:c,edgesToRemove:d,nodes:g,edges:m,onBeforeDelete:v}),k=_.length>0,C=E.length>0;if(k){const b=_.map(Ug);x==null||x(_),y(b)}if(C){const b=E.map(Ug);w==null||w(E),p(b)}return(C||k)&&(h==null||h({nodes:E,edges:_})),{deletedNodes:E,deletedEdges:_}},getIntersectingNodes:(c,d=!0,g)=>{const m=Up(c),w=m?c:u(c),x=g!==void 0;return w?(g||t.getState().nodes).filter(p=>{const y=t.getState().nodeLookup.get(p.id);if(y&&!m&&(p.id===c.id||!y.internals.positionAbsolute))return!1;const h=zr(x?p:y),v=Xo(h,w);return d&&v>0||v>=h.width*h.height||v>=w.width*w.height}):[]},isNodeIntersecting:(c,d,g=!0)=>{const w=Up(c)?c:u(c);if(!w)return!1;const x=Xo(w,d);return g&&x>0||x>=d.width*d.height||x>=w.width*w.height},updateNode:a,updateNodeData:(c,d,g={replace:!1})=>{a(c,m=>{const w=typeof d=="function"?d(m):d;return g.replace?{...m,data:w}:{...m,data:{...m.data,...w}}},g)},updateEdge:f,updateEdgeData:(c,d,g={replace:!1})=>{f(c,m=>{const w=typeof d=="function"?d(m):d;return g.replace?{...m,data:w}:{...m,data:{...m.data,...w}}},g)},getNodesBounds:c=>{const{nodeLookup:d,nodeOrigin:g}=t.getState();return BE(c,{nodeLookup:d,nodeOrigin:g})},getHandleConnections:({type:c,id:d,nodeId:g})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${g}-${c}${d?`-${d}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:c,handleId:d,nodeId:g})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${g}${c?d?`-${c}-${d}`:`-${c}`:""}`))==null?void 0:m.values())??[])},fitView:async c=>{const d=t.getState().fitViewResolver??KE();return t.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:d}),n.nodeQueue.push(g=>[...g]),d.promise}}},[]);return D.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const Qg=e=>e.selected,FS=typeof window<"u"?window:void 0;function VS({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=he(),{deleteElements:r}=Ja(),o=Zo(e,{actInsideInputWithModifier:!1}),i=Zo(t,{target:FS});D.useEffect(()=>{if(o){const{edges:s,nodes:l}=n.getState();r({nodes:l.filter(Qg),edges:s.filter(Qg)}),n.setState({nodesSelectionActive:!1})}},[o]),D.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function HS(e){const t=he();D.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",yt.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 Xs={position:"absolute",width:"100%",height:"100%",top:0,left:0},BS=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function US({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Bn.Free,zoomOnDoubleClick:s=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:a,minZoom:f,maxZoom:c,zoomActivationKeyCode:d,preventScrolling:g=!0,children:m,noWheelClassName:w,noPanClassName:x,onViewportChange:p,isControlledViewport:y,paneClickDistance:h,selectionOnDrag:v}){const E=he(),_=D.useRef(null),{userSelectionActive:k,lib:C,connectionInProgress:b}=re(BS,de),j=Zo(d),T=D.useRef();HS(_);const R=D.useCallback(V=>{p==null||p({x:V[0],y:V[1],zoom:V[2]}),y||E.setState({transform:V})},[p,y]);return D.useEffect(()=>{if(_.current){T.current=$_({domNode:_.current,minZoom:f,maxZoom:c,translateExtent:a,viewport:u,onDraggingChange:L=>E.setState(z=>z.paneDragging===L?z:{paneDragging:L}),onPanZoomStart:(L,z)=>{const{onViewportChangeStart:M,onMoveStart:N}=E.getState();N==null||N(L,z),M==null||M(z)},onPanZoom:(L,z)=>{const{onViewportChange:M,onMove:N}=E.getState();N==null||N(L,z),M==null||M(z)},onPanZoomEnd:(L,z)=>{const{onViewportChangeEnd:M,onMoveEnd:N}=E.getState();N==null||N(L,z),M==null||M(z)}});const{x:V,y:S,zoom:$}=T.current.getViewport();return E.setState({panZoom:T.current,transform:[V,S,$],domNode:_.current.closest(".react-flow")}),()=>{var L;(L=T.current)==null||L.destroy()}}},[]),D.useEffect(()=>{var V;(V=T.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:l,zoomActivationKeyPressed:j,preventScrolling:g,noPanClassName:x,userSelectionActive:k,noWheelClassName:w,lib:C,onTransformChange:R,connectionInProgress:b,selectionOnDrag:v,paneClickDistance:h})},[e,t,n,r,o,i,s,l,j,g,x,k,w,C,R,b,v,h]),I.jsx("div",{className:"react-flow__renderer",ref:_,style:Xs,children:m})}const WS=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function YS(){const{userSelectionActive:e,userSelectionRect:t}=re(WS,de);return e&&t?I.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 ec=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},XS=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function GS({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Uo.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:a,onPaneContextMenu:f,onPaneScroll:c,onPaneMouseEnter:d,onPaneMouseMove:g,onPaneMouseLeave:m,children:w}){const x=D.useRef(0),p=he(),{userSelectionActive:y,elementsSelectable:h,dragging:v,connectionInProgress:E,panBy:_,autoPanSpeed:k}=re(XS,de),C=h&&(e||y),b=D.useRef(null),j=D.useRef(),T=D.useRef(new Set),R=D.useRef(new Set),V=D.useRef(!1),S=D.useRef({x:0,y:0}),$=D.useRef(!1),L=F=>{if(V.current||E){V.current=!1;return}a==null||a(F),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},z=F=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){F.preventDefault();return}f==null||f(F)},M=c?F=>c(F):void 0,N=F=>{V.current&&(F.stopPropagation(),V.current=!1)},P=F=>{var we,st;const{domNode:W,transform:ee}=p.getState();if(j.current=W==null?void 0:W.getBoundingClientRect(),!j.current)return;const J=F.target===b.current;if(!J&&!!F.target.closest(".nokey")||!e||!(s&&J||t)||F.button!==0||!F.isPrimary)return;(st=(we=F.target)==null?void 0:we.setPointerCapture)==null||st.call(we,F.pointerId),V.current=!1;const{x:ne,y:ie}=wt(F.nativeEvent,j.current),le=Or({x:ne,y:ie},ee);p.setState({userSelectionRect:{width:0,height:0,startX:le.x,startY:le.y,x:ne,y:ie}}),J||(F.stopPropagation(),F.preventDefault())};function A(F,W){const{userSelectionRect:ee}=p.getState();if(!ee)return;const{transform:J,nodeLookup:Z,edgeLookup:K,connectionLookup:ne,triggerNodeChanges:ie,triggerEdgeChanges:le,defaultEdgeOptions:we}=p.getState(),st={x:ee.startX,y:ee.startY},{x:bt,y:$t}=Rr(st,J),Zt={startX:st.x,startY:st.y,x:FEt.id)),R.current=new Set;const Zn=(we==null?void 0:we.selectable)??!0;for(const Et of T.current){const qt=ne.get(Et);if(qt)for(const{edgeId:Jt}of qt.values()){const qn=K.get(Jt);qn&&(qn.selectable??Zn)&&R.current.add(Jt)}}if(!Gp(Jo,T.current)){const Et=Vr(Z,T.current,!0);ie(Et)}if(!Gp(Kn,R.current)){const Et=Vr(K,R.current);le(Et)}p.setState({userSelectionRect:Zt,userSelectionActive:!0,nodesSelectionActive:!1})}function O(){if(!o||!j.current)return;const[F,W]=Ra(S.current,j.current,k);_({x:F,y:W}).then(ee=>{if(!V.current||!ee){x.current=requestAnimationFrame(O);return}const{x:J,y:Z}=S.current;A(J,Z),x.current=requestAnimationFrame(O)})}const U=()=>{cancelAnimationFrame(x.current),x.current=0,$.current=!1};D.useEffect(()=>()=>U(),[]);const B=F=>{const{userSelectionRect:W,transform:ee,resetSelectedElements:J}=p.getState();if(!j.current||!W)return;const{x:Z,y:K}=wt(F.nativeEvent,j.current);S.current={x:Z,y:K};const ne=Rr({x:W.startX,y:W.startY},ee);if(!V.current){const ie=t?0:i;if(Math.hypot(Z-ne.x,K-ne.y)<=ie)return;J(),l==null||l(F)}V.current=!0,$.current||(O(),$.current=!0),A(Z,K)},X=F=>{var W,ee;F.button===0&&((ee=(W=F.target)==null?void 0:W.releasePointerCapture)==null||ee.call(W,F.pointerId),!y&&F.target===b.current&&p.getState().userSelectionRect&&(L==null||L(F)),p.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(u==null||u(F),p.setState({nodesSelectionActive:T.current.size>0})),U())},q=F=>{var W,ee;(ee=(W=F.target)==null?void 0:W.releasePointerCapture)==null||ee.call(W,F.pointerId),U()},Q=r===!0||Array.isArray(r)&&r.includes(0);return I.jsxs("div",{className:Ee(["react-flow__pane",{draggable:Q,dragging:v,selection:e}]),onClick:C?void 0:ec(L,b),onContextMenu:ec(z,b),onWheel:ec(M,b),onPointerEnter:C?void 0:d,onPointerMove:C?B:g,onPointerUp:C?X:void 0,onPointerCancel:C?q:void 0,onPointerDownCapture:C?P:void 0,onClickCapture:C?N:void 0,onPointerLeave:m,ref:b,style:Xs,children:[w,I.jsx(YS,{})]})}function tc({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",yt.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):o([e])}function Kg({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const l=he(),[u,a]=D.useState(!1),f=D.useRef();return D.useEffect(()=>{f.current=w_({getStoreItems:()=>l.getState(),onNodeMouseDown:c=>{tc({id:c,store:l,nodeRef:e})},onDragStart:()=>{a(!0)},onDragStop:()=>{a(!1)}})},[]),D.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var c;(c=f.current)==null||c.destroy()}},[n,r,t,i,e,o,s]),u}const QS=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Zg(){const e=he();return D.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:l,updateNodePositions:u,nodeLookup:a,nodeOrigin:f}=e.getState(),c=new Map,d=QS(s),g=o?i[0]:5,m=o?i[1]:5,w=n.direction.x*g*n.factor,x=n.direction.y*m*n.factor;for(const[,p]of a){if(!d(p))continue;let y={x:p.internals.positionAbsolute.x+w,y:p.internals.positionAbsolute.y+x};o&&(y=Go(y,i));const{position:h,positionAbsolute:v}=Fp({nodeId:p.id,nextPosition:y,nodeLookup:a,nodeExtent:r,nodeOrigin:f,onError:l});p.position=h,p.internals.positionAbsolute=v,c.set(p.id,p)}u(c)},[])}const nc=D.createContext(null),KS=nc.Provider;nc.Consumer;const qg=()=>D.useContext(nc),ZS=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),qS=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:l,toHandle:u,isValid:a}=s,f=(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:f,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===br.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:f&&a}};function JS({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:f,onTouchStart:c,...d},g){var $,L;const m=s||null,w=e==="target",x=he(),p=qg(),{connectOnClick:y,noPanClassName:h,rfId:v}=re(ZS,de),{connectingFrom:E,connectingTo:_,clickConnecting:k,isPossibleEndHandle:C,connectionInProcess:b,clickConnectionInProcess:j,valid:T}=re(qS(p,m,e),de);p||(L=($=x.getState()).onError)==null||L.call($,"010",yt.error010());const R=z=>{const{defaultEdgeOptions:M,onConnect:N,hasDefaultEdges:P}=x.getState(),A={...M,...z};if(P){const{edges:O,setEdges:U,onError:B}=x.getState();U($S(A,O,{onError:B}))}N==null||N(A),l==null||l(A)},V=z=>{if(!p)return;const M=Zp(z.nativeEvent);if(o&&(M&&z.button===0||!M)){const N=x.getState();Qa.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:N.autoPanOnConnect,connectionMode:N.connectionMode,connectionRadius:N.connectionRadius,domNode:N.domNode,nodeLookup:N.nodeLookup,lib:N.lib,isTarget:w,handleId:m,nodeId:p,flowId:N.rfId,panBy:N.panBy,cancelConnection:N.cancelConnection,onConnectStart:N.onConnectStart,onConnectEnd:(...P)=>{var A,O;return(O=(A=x.getState()).onConnectEnd)==null?void 0:O.call(A,...P)},updateConnection:N.updateConnection,onConnect:R,isValidConnection:n||((...P)=>{var A,O;return((O=(A=x.getState()).isValidConnection)==null?void 0:O.call(A,...P))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:N.autoPanSpeed,dragThreshold:N.connectionDragThreshold})}M?f==null||f(z):c==null||c(z)},S=z=>{const{onClickConnectStart:M,onClickConnectEnd:N,connectionClickStartHandle:P,connectionMode:A,isValidConnection:O,lib:U,rfId:B,nodeLookup:X,connection:q}=x.getState();if(!p||!P&&!o)return;if(!P){M==null||M(z.nativeEvent,{nodeId:p,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:p,type:e,id:m}});return}const Q=Qp(z.target),F=n||O,{connection:W,isValid:ee}=Qa.isValid(z.nativeEvent,{handle:{nodeId:p,id:m,type:e},connectionMode:A,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:F,flowId:B,doc:Q,lib:U,nodeLookup:X});ee&&W&&R(W);const J=structuredClone(q);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,N==null||N(z,J),x.setState({connectionClickStartHandle:null})};return I.jsx("div",{"data-handleid":m,"data-nodeid":p,"data-handlepos":t,"data-id":`${v}-${p}-${m}-${e}`,className:Ee(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,a,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:k,connectingfrom:E,connectingto:_,valid:T,connectionindicator:r&&(!b||C)&&(b||j?i:o)}]),onMouseDown:V,onTouchStart:V,onClick:y?S:void 0,ref:g,...d,children:u})}const Tt=D.memo(Yg(JS));function ek({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return I.jsxs(I.Fragment,{children:[e==null?void 0:e.label,I.jsx(Tt,{type:"source",position:n,isConnectable:t})]})}function tk({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:r=G.Bottom}){return I.jsxs(I.Fragment,{children:[I.jsx(Tt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,I.jsx(Tt,{type:"source",position:r,isConnectable:t})]})}function nk(){return null}function rk({data:e,isConnectable:t,targetPosition:n=G.Top}){return I.jsxs(I.Fragment,{children:[I.jsx(Tt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Gs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Jg={input:ek,default:tk,output:rk,group:nk};function ok(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 ik=e=>{const{width:t,height:n,x:r,y:o}=Yo(e.nodeLookup,{filter:i=>!!i.selected});return{width:vt(t)?t:null,height:vt(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 sk({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=he(),{width:o,height:i,transformString:s,userSelectionActive:l}=re(ik,de),u=Zg(),a=D.useRef(null);D.useEffect(()=>{var g;n||(g=a.current)==null||g.focus({preventScroll:!0})},[n]);const f=!l&&o!==null&&i!==null;if(Kg({nodeRef:a,disabled:!f}),!f)return null;const c=e?g=>{const m=r.getState().nodes.filter(w=>w.selected);e(g,m)}:void 0,d=g=>{Object.prototype.hasOwnProperty.call(Gs,g.key)&&(g.preventDefault(),u({direction:Gs[g.key],factor:g.shiftKey?4:1}))};return I.jsx("div",{className:Ee(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:I.jsx("div",{ref:a,className:"react-flow__nodesselection-rect",onContextMenu:c,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:o,height:i}})})}const em=typeof window<"u"?window:void 0,lk=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function tm({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:a,selectionOnDrag:f,selectionMode:c,onSelectionStart:d,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:v,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:k,panOnDrag:C,autoPanOnSelection:b,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:V,preventScrolling:S,onSelectionContextMenu:$,noWheelClassName:L,noPanClassName:z,disableKeyboardA11y:M,onViewportChange:N,isControlledViewport:P}){const{nodesSelectionActive:A,userSelectionActive:O}=re(lk,de),U=Zo(a,{target:em}),B=Zo(w,{target:em}),X=B||C,q=B||v,Q=f&&X!==!0,F=U||O||Q;return VS({deleteKeyCode:u,multiSelectionKeyCode:m}),I.jsx(US,{onPaneContextMenu:i,elementsSelectable:p,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:q,panOnScrollSpeed:E,panOnScrollMode:_,zoomOnDoubleClick:k,panOnDrag:!U&&X,defaultViewport:j,translateExtent:T,minZoom:R,maxZoom:V,zoomActivationKeyCode:x,preventScrolling:S,noWheelClassName:L,noPanClassName:z,onViewportChange:N,isControlledViewport:P,paneClickDistance:l,selectionOnDrag:Q,children:I.jsxs(GS,{onSelectionStart:d,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:X,autoPanOnSelection:b,isSelecting:!!F,selectionMode:c,selectionKeyPressed:U,paneClickDistance:l,selectionOnDrag:Q,children:[e,A&&I.jsx(sk,{onSelectionContextMenu:$,noPanClassName:z,disableKeyboardA11y:M})]})})}tm.displayName="FlowRenderer";const uk=D.memo(tm),ak=e=>t=>e?Oa(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 ck(e){return re(D.useCallback(ak(e),[e]),de)}const fk=e=>e.updateNodeInternals;function dk(){const e=re(fk),[t]=D.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 D.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function hk({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=he(),i=D.useRef(null),s=D.useRef(null),l=D.useRef(e.sourcePosition),u=D.useRef(e.targetPosition),a=D.useRef(t),f=n&&!!e.internals.handleBounds;return D.useEffect(()=>{i.current&&!e.hidden&&(!f||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[f,e.hidden]),D.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),D.useEffect(()=>{if(i.current){const c=a.current!==t,d=l.current!==e.sourcePosition,g=u.current!==e.targetPosition;(c||d||g)&&(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 pk({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:a,nodesFocusable:f,resizeObserver:c,noDragClassName:d,noPanClassName:g,disableKeyboardA11y:m,rfId:w,nodeTypes:x,nodeClickDistance:p,onError:y}){const{node:h,internals:v,isParent:E}=re(F=>{const W=F.nodeLookup.get(e),ee=F.parentLookup.has(e);return{node:W,internals:W.internals,isParent:ee}},de);let _=h.type||"default",k=(x==null?void 0:x[_])||Jg[_];k===void 0&&(y==null||y("003",yt.error003(_)),_="default",k=(x==null?void 0:x.default)||Jg.default);const C=!!(h.draggable||l&&typeof h.draggable>"u"),b=!!(h.selectable||u&&typeof h.selectable>"u"),j=!!(h.connectable||a&&typeof h.connectable>"u"),T=!!(h.focusable||f&&typeof h.focusable>"u"),R=he(),V=Yp(h),S=hk({node:h,nodeType:_,hasDimensions:V,resizeObserver:c}),$=Kg({nodeRef:S,disabled:h.hidden||!C,noDragClassName:d,handleSelector:h.dragHandle,nodeId:e,isSelectable:b,nodeClickDistance:p}),L=Zg();if(h.hidden)return null;const z=Qt(h),M=ok(h),N=b||C||t||n||r||o,P=n?F=>n(F,{...v.userNode}):void 0,A=r?F=>r(F,{...v.userNode}):void 0,O=o?F=>o(F,{...v.userNode}):void 0,U=i?F=>i(F,{...v.userNode}):void 0,B=s?F=>s(F,{...v.userNode}):void 0,X=F=>{const{selectNodesOnDrag:W,nodeDragThreshold:ee}=R.getState();b&&(!W||!C||ee>0)&&tc({id:e,store:R,nodeRef:S}),t&&t(F,{...v.userNode})},q=F=>{if(!(Kp(F.nativeEvent)||m)){if(zp.includes(F.key)&&b){const W=F.key==="Escape";tc({id:e,store:R,unselect:W,nodeRef:S})}else if(C&&h.selected&&Object.prototype.hasOwnProperty.call(Gs,F.key)){F.preventDefault();const{ariaLabelConfig:W}=R.getState();R.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:F.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),L({direction:Gs[F.key],factor:F.shiftKey?4:1})}}},Q=()=>{var ne;if(m||!((ne=S.current)!=null&&ne.matches(":focus-visible")))return;const{transform:F,width:W,height:ee,autoPanOnNodeFocus:J,setCenter:Z}=R.getState();if(!J)return;Oa(new Map([[e,h]]),{x:0,y:0,width:W,height:ee},F,!0).length>0||Z(h.position.x+z.width/2,h.position.y+z.height/2,{zoom:F[2]})};return I.jsx("div",{className:Ee(["react-flow__node",`react-flow__node-${_}`,{[g]:C},h.className,{selected:h.selected,selectable:b,parent:E,draggable:C,dragging:$}]),ref:S,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:N?"all":"none",visibility:V?"visible":"hidden",...h.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:A,onMouseLeave:O,onContextMenu:U,onClick:X,onDoubleClick:B,onKeyDown:T?q:void 0,tabIndex:T?0:void 0,onFocus:T?Q:void 0,role:h.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${$g}-${w}`,"aria-label":h.ariaLabel,...h.domAttributes,children:I.jsx(KS,{value:e,children:I.jsx(k,{id:e,data:h.data,type:_,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:h.selected??!1,selectable:b,draggable:C,deletable:h.deletable??!0,isConnectable:j,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:$,dragHandle:h.dragHandle,zIndex:v.z,parentId:h.parentId,...z})})})}var gk=D.memo(pk);const mk=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function nm(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=re(mk,de),s=ck(e.onlyRenderVisibleElements),l=dk();return I.jsx("div",{className:"react-flow__nodes",style:Xs,children:s.map(u=>I.jsx(gk,{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))})}nm.displayName="NodeRenderer";const yk=D.memo(nm);function vk(e){return re(D.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 wk=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return I.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},xk=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return I.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},rm={[Rs.Arrow]:wk,[Rs.ArrowClosed]:xk};function Ek(e){const t=he();return D.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(rm,e)?rm[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",yt.error009(e)),null)},[e])}const _k=({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=Ek(t);return u?I.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:I.jsx(u,{color:n,strokeWidth:s})}):null},om=({defaultColor:e,rfId:t})=>{const n=re(i=>i.edges),r=re(i=>i.defaultEdgeOptions),o=D.useMemo(()=>u_(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?I.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:I.jsx("defs",{children:o.map(i=>I.jsx(_k,{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};om.displayName="MarkerDefinitions";var Sk=D.memo(om);function im({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:a,...f}){const[c,d]=D.useState({x:1,y:0,width:0,height:0}),g=Ee(["react-flow__edge-textwrapper",a]),m=D.useRef(null);return D.useEffect(()=>{if(m.current){const w=m.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?I.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:g,visibility:c.width?"visible":"hidden",...f,children:[o&&I.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}),I.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:m,style:r,children:n}),u]}):null}im.displayName="EdgeText";const kk=D.memo(im);function Qs({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:a=20,...f}){return I.jsxs(I.Fragment,{children:[I.jsx("path",{...f,d:e,fill:"none",className:Ee(["react-flow__edge-path",f.className])}),a?I.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:a,className:"react-flow__edge-interaction"}):null,r&&vt(t)&&vt(n)?I.jsx(kk,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function sm({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 lm({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top}){const[s,l]=sm({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,a]=sm({pos:i,x1:r,y1:o,x2:e,y2:t}),[f,c,d,g]=Jp({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}`,f,c,d,g]}function um(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:l,label:u,labelStyle:a,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:p})=>{const[y,h,v]=lm({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l}),E=e.isInternal?void 0:t;return I.jsx(Qs,{id:E,path:y,labelX:h,labelY:v,label:u,labelStyle:a,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:p})})}const Nk=um({isInternal:!1}),am=um({isInternal:!0});Nk.displayName="SimpleBezierEdge",am.displayName="SimpleBezierEdgeInternal";function cm(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:f,labelBgBorderRadius:c,style:d,sourcePosition:g=G.Bottom,targetPosition:m=G.Top,markerEnd:w,markerStart:x,pathOptions:p,interactionWidth:y})=>{const[h,v,E]=Fa({sourceX:n,sourceY:r,sourcePosition:g,targetX:o,targetY:i,targetPosition:m,borderRadius:p==null?void 0:p.borderRadius,offset:p==null?void 0:p.offset,stepPosition:p==null?void 0:p.stepPosition}),_=e.isInternal?void 0:t;return I.jsx(Qs,{id:_,path:h,labelX:v,labelY:E,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:w,markerStart:x,interactionWidth:y})})}const fm=cm({isInternal:!1}),dm=cm({isInternal:!0});fm.displayName="SmoothStepEdge",dm.displayName="SmoothStepEdgeInternal";function hm(e){return D.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return I.jsx(fm,{...n,id:r,pathOptions:D.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const Ck=hm({isInternal:!1}),pm=hm({isInternal:!0});Ck.displayName="StepEdge",pm.displayName="StepEdgeInternal";function gm(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:g,markerStart:m,interactionWidth:w})=>{const[x,p,y]=rg({sourceX:n,sourceY:r,targetX:o,targetY:i}),h=e.isInternal?void 0:t;return I.jsx(Qs,{id:h,path:x,labelX:p,labelY:y,label:s,labelStyle:l,labelShowBg:u,labelBgStyle:a,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:g,markerStart:m,interactionWidth:w})})}const Mk=gm({isInternal:!1}),mm=gm({isInternal:!0});Mk.displayName="StraightEdge",mm.displayName="StraightEdgeInternal";function ym(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=G.Bottom,targetPosition:l=G.Top,label:u,labelStyle:a,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,pathOptions:p,interactionWidth:y})=>{const[h,v,E]=tg({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:l,curvature:p==null?void 0:p.curvature}),_=e.isInternal?void 0:t;return I.jsx(Qs,{id:_,path:h,labelX:v,labelY:E,label:u,labelStyle:a,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:x,interactionWidth:y})})}const Ik=ym({isInternal:!1}),vm=ym({isInternal:!0});Ik.displayName="BezierEdge",vm.displayName="BezierEdgeInternal";const wm={default:vm,straight:mm,step:pm,smoothstep:dm,simplebezier:am},xm={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Pk=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,Lk=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Em="react-flow__edgeupdater";function _m({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:l}){return I.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:Ee([Em,`${Em}-${l}`]),cx:Pk(t,r,e),cy:Lk(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Tk({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:l,targetPosition:u,onReconnect:a,onReconnectStart:f,onReconnectEnd:c,setReconnecting:d,setUpdateHover:g}){const m=he(),w=(v,E)=>{if(v.button!==0)return;const{autoPanOnConnect:_,domNode:k,connectionMode:C,connectionRadius:b,lib:j,onConnectStart:T,cancelConnection:R,nodeLookup:V,rfId:S,panBy:$,updateConnection:L}=m.getState(),z=E.type==="target",M=(A,O)=>{d(!1),c==null||c(A,n,E.type,O)},N=A=>a==null?void 0:a(n,A),P=(A,O)=>{d(!0),f==null||f(v,n,E.type),T==null||T(A,O)};Qa.onPointerDown(v.nativeEvent,{autoPanOnConnect:_,connectionMode:C,connectionRadius:b,domNode:k,handleId:E.id,nodeId:E.nodeId,nodeLookup:V,isTarget:z,edgeUpdaterType:E.type,lib:j,flowId:S,cancelConnection:R,panBy:$,isValidConnection:(...A)=>{var O,U;return((U=(O=m.getState()).isValidConnection)==null?void 0:U.call(O,...A))??!0},onConnect:N,onConnectStart:P,onConnectEnd:(...A)=>{var O,U;return(U=(O=m.getState()).onConnectEnd)==null?void 0:U.call(O,...A)},onReconnectEnd:M,updateConnection:L,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},x=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),p=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),y=()=>g(!0),h=()=>g(!1);return I.jsxs(I.Fragment,{children:[(e===!0||e==="source")&&I.jsx(_m,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:y,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&I.jsx(_m,{position:u,centerX:i,centerY:s,radius:t,onMouseDown:p,onMouseEnter:y,onMouseOut:h,type:"target"})]})}function bk({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,reconnectRadius:f,onReconnect:c,onReconnectStart:d,onReconnectEnd:g,rfId:m,edgeTypes:w,noPanClassName:x,onError:p,disableKeyboardA11y:y}){let h=re(Z=>Z.edgeLookup.get(e));const v=re(Z=>Z.defaultEdgeOptions);h=v?{...v,...h}:h;let E=h.type||"default",_=(w==null?void 0:w[E])||wm[E];_===void 0&&(p==null||p("011",yt.error011(E)),E="default",_=(w==null?void 0:w.default)||wm.default);const k=!!(h.focusable||t&&typeof h.focusable>"u"),C=typeof c<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),b=!!(h.selectable||r&&typeof h.selectable>"u"),j=D.useRef(null),[T,R]=D.useState(!1),[V,S]=D.useState(!1),$=he(),{zIndex:L,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O}=re(D.useCallback(Z=>{const K=Z.nodeLookup.get(h.source),ne=Z.nodeLookup.get(h.target);if(!K||!ne)return{zIndex:h.zIndex,...xm};const ie=l_({id:e,sourceNode:K,targetNode:ne,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:Z.connectionMode,onError:p});return{zIndex:JE({selected:h.selected,zIndex:h.zIndex,sourceNode:K,targetNode:ne,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...ie||xm}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),de),U=D.useMemo(()=>h.markerStart?`url('#${Va(h.markerStart,m)}')`:void 0,[h.markerStart,m]),B=D.useMemo(()=>h.markerEnd?`url('#${Va(h.markerEnd,m)}')`:void 0,[h.markerEnd,m]);if(h.hidden||z===null||M===null||N===null||P===null)return null;const X=Z=>{var le;const{addSelectedEdges:K,unselectNodesAndEdges:ne,multiSelectionActive:ie}=$.getState();b&&($.setState({nodesSelectionActive:!1}),h.selected&&ie?(ne({nodes:[],edges:[h]}),(le=j.current)==null||le.blur()):K([e])),o&&o(Z,h)},q=i?Z=>{i(Z,{...h})}:void 0,Q=s?Z=>{s(Z,{...h})}:void 0,F=l?Z=>{l(Z,{...h})}:void 0,W=u?Z=>{u(Z,{...h})}:void 0,ee=a?Z=>{a(Z,{...h})}:void 0,J=Z=>{var K;if(!y&&zp.includes(Z.key)&&b){const{unselectNodesAndEdges:ne,addSelectedEdges:ie}=$.getState();Z.key==="Escape"?((K=j.current)==null||K.blur(),ne({edges:[h]})):ie([e])}};return I.jsx("svg",{style:{zIndex:L},children:I.jsxs("g",{className:Ee(["react-flow__edge",`react-flow__edge-${E}`,h.className,x,{selected:h.selected,animated:h.animated,inactive:!b&&!o,updating:T,selectable:b}]),onClick:X,onDoubleClick:q,onContextMenu:Q,onMouseEnter:F,onMouseMove:W,onMouseLeave:ee,onKeyDown:k?J:void 0,tabIndex:k?0:void 0,role:h.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":k?`${zg}-${m}`:void 0,ref:j,...h.domAttributes,children:[!V&&I.jsx(_,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:b,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:U,markerEnd:B,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),C&&I.jsx(Tk,{edge:h,isReconnectable:C,reconnectRadius:f,onReconnect:c,onReconnectStart:d,onReconnectEnd:g,sourceX:z,sourceY:M,targetX:N,targetY:P,sourcePosition:A,targetPosition:O,setUpdateHover:R,setReconnecting:S})]})})}var $k=D.memo(bk);const zk=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Sm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:a,onEdgeClick:f,reconnectRadius:c,onEdgeDoubleClick:d,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:p,elementsSelectable:y,onError:h}=re(zk,de),v=vk(t);return I.jsxs("div",{className:"react-flow__edges",children:[I.jsx(Sk,{defaultColor:e,rfId:n}),v.map(E=>I.jsx($k,{id:E,edgesFocusable:x,edgesReconnectable:p,elementsSelectable:y,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:a,onClick:f,reconnectRadius:c,onDoubleClick:d,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:h,edgeTypes:r,disableKeyboardA11y:w},E))]})}Sm.displayName="EdgeRenderer";const Ok=D.memo(Sm),Rk=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ak({children:e}){const t=re(Rk);return I.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Dk(e){const t=Ja(),n=D.useRef(!1);D.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const jk=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Fk(e){const t=re(jk),n=he();return D.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Vk(e){return e.connection.inProgress?{...e.connection,to:Or(e.connection.to,e.transform)}:{...e.connection}}function Hk(e){return Vk}function Bk(e){const t=Hk();return re(t,de)}const Uk=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Wk({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:l,inProgress:u}=re(Uk,de);return!(i&&o&&u)?null:I.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:I.jsx("g",{className:Ee(["react-flow__connection",Dp(l)]),children:I.jsx(km,{style:t,type:n,CustomComponent:r,isValid:l})})})}const km=({style:e,type:t=En.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:l,fromPosition:u,to:a,toNode:f,toHandle:c,toPosition:d,pointer:g}=Bk();if(!o)return;if(n)return I.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:d,connectionStatus:Dp(r),toNode:f,toHandle:c,pointer:g});let m="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:a.x,targetY:a.y,targetPosition:d};switch(t){case En.Bezier:[m]=tg(w);break;case En.SimpleBezier:[m]=lm(w);break;case En.Step:[m]=Fa({...w,borderRadius:0});break;case En.SmoothStep:[m]=Fa(w);break;default:[m]=rg(w)}return I.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};km.displayName="ConnectionLine";const Yk={};function Nm(e=Yk){D.useRef(e),he(),D.useEffect(()=>{},[e])}function Xk(){he(),D.useRef(!1),D.useEffect(()=>{},[])}function Cm({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:f,onSelectionContextMenu:c,onSelectionStart:d,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:p,selectionKeyCode:y,selectionOnDrag:h,selectionMode:v,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:k,deleteKeyCode:C,onlyRenderVisibleElements:b,elementsSelectable:j,defaultViewport:T,translateExtent:R,minZoom:V,maxZoom:S,preventScrolling:$,defaultMarkerColor:L,zoomOnScroll:z,zoomOnPinch:M,panOnScroll:N,panOnScrollSpeed:P,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:U,autoPanOnSelection:B,onPaneClick:X,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:F,onPaneScroll:W,onPaneContextMenu:ee,paneClickDistance:J,nodeClickDistance:Z,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:ie,onEdgeMouseLeave:le,reconnectRadius:we,onReconnect:st,onReconnectStart:bt,onReconnectEnd:$t,noDragClassName:Zt,noWheelClassName:Jo,noPanClassName:Kn,disableKeyboardA11y:Zn,nodeExtent:Et,rfId:qt,viewport:Jt,onViewportChange:qn}){return Nm(e),Nm(t),Xk(),Dk(n),Fk(Jt),I.jsx(uk,{onPaneClick:X,onPaneMouseEnter:q,onPaneMouseMove:Q,onPaneMouseLeave:F,onPaneContextMenu:ee,onPaneScroll:W,paneClickDistance:J,deleteKeyCode:C,selectionKeyCode:y,selectionOnDrag:h,selectionMode:v,onSelectionStart:d,onSelectionEnd:g,multiSelectionKeyCode:E,panActivationKeyCode:_,zoomActivationKeyCode:k,elementsSelectable:j,zoomOnScroll:z,zoomOnPinch:M,zoomOnDoubleClick:O,panOnScroll:N,panOnScrollSpeed:P,panOnScrollMode:A,panOnDrag:U,autoPanOnSelection:B,defaultViewport:T,translateExtent:R,minZoom:V,maxZoom:S,onSelectionContextMenu:c,preventScrolling:$,noDragClassName:Zt,noWheelClassName:Jo,noPanClassName:Kn,disableKeyboardA11y:Zn,onViewportChange:qn,isControlledViewport:!!Jt,children:I.jsxs(Ak,{children:[I.jsx(Ok,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:st,onReconnectStart:bt,onReconnectEnd:$t,onlyRenderVisibleElements:b,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:ie,onEdgeMouseLeave:le,reconnectRadius:we,defaultMarkerColor:L,noPanClassName:Kn,disableKeyboardA11y:Zn,rfId:qt}),I.jsx(Wk,{style:w,type:m,component:x,containerStyle:p}),I.jsx("div",{className:"react-flow__edgelabel-renderer"}),I.jsx(yk,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:a,onNodeContextMenu:f,nodeClickDistance:Z,onlyRenderVisibleElements:b,noPanClassName:Kn,noDragClassName:Zt,disableKeyboardA11y:Zn,nodeExtent:Et,rfId:qt}),I.jsx("div",{className:"react-flow__viewport-portal"})]})})}Cm.displayName="GraphView";const Gk=D.memo(Cm),Qk=Wp(),Mm=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u=.5,maxZoom:a=2,nodeOrigin:f,nodeExtent:c,zIndexMode:d="basic"}={})=>{const g=new Map,m=new Map,w=new Map,x=new Map,p=r??t??[],y=n??e??[],h=f??[0,0],v=c??Bo;dg(w,x,p);const{nodesInitialized:E}=Wa(y,g,m,{nodeOrigin:h,nodeExtent:v,zIndexMode:d});let _=[0,0,1];if(s&&o&&i){const k=Yo(g,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:C,y:b,zoom:j}=Da(k,o,i,u,a,(l==null?void 0:l.padding)??.1);_=[C,b,j]}return{rfId:"1",width:o??0,height:i??0,transform:_,nodes:y,nodesInitialized:E,nodeLookup:g,parentLookup:m,edges:p,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:a,translateExtent:Bo,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:br.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,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:{...Rp},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qk,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Op,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Kk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:f,nodeExtent:c,zIndexMode:d})=>cS((g,m)=>{async function w(){const{nodeLookup:x,panZoom:p,fitViewOptions:y,fitViewResolver:h,width:v,height:E,minZoom:_,maxZoom:k}=m();p&&(await YE({nodes:x,width:v,height:E,panZoom:p,minZoom:_,maxZoom:k},y),h==null||h.resolve(!0),g({fitViewResolver:null}))}return{...Mm({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:l,minZoom:u,maxZoom:a,nodeOrigin:f,nodeExtent:c,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:x=>{const{nodeLookup:p,parentLookup:y,nodeOrigin:h,elevateNodesOnSelect:v,fitViewQueued:E,zIndexMode:_,nodesSelectionActive:k}=m(),{nodesInitialized:C,hasSelectedNodes:b}=Wa(x,p,y,{nodeOrigin:h,nodeExtent:c,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:_}),j=k&&b;E&&C?(w(),g({nodes:x,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:j})):g({nodes:x,nodesInitialized:C,nodesSelectionActive:j})},setEdges:x=>{const{connectionLookup:p,edgeLookup:y}=m();dg(p,y,x),g({edges:x})},setDefaultNodesAndEdges:(x,p)=>{if(x){const{setNodes:y}=m();y(x),g({hasDefaultNodes:!0})}if(p){const{setEdges:y}=m();y(p),g({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:p,nodeLookup:y,parentLookup:h,domNode:v,nodeOrigin:E,nodeExtent:_,debug:k,fitViewQueued:C,zIndexMode:b}=m(),{changes:j,updatedInternals:T}=g_(x,y,h,v,E,_,b);T&&(f_(y,h,{nodeOrigin:E,nodeExtent:_,zIndexMode:b}),C?(w(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(j==null?void 0:j.length)>0&&(k&&console.log("React Flow: trigger node changes",j),p==null||p(j)))},updateNodePositions:(x,p=!1)=>{const y=[];let h=[];const{nodeLookup:v,triggerNodeChanges:E,connection:_,updateConnection:k,onNodesChangeMiddlewareMap:C}=m();for(const[b,j]of x){const T=v.get(b),R=!!(T!=null&&T.expandParent&&(T!=null&&T.parentId)&&(j!=null&&j.position)),V={id:b,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:p};if(T&&_.inProgress&&_.fromNode.id===T.id){const S=Yn(T,_.fromHandle,G.Left,!0);k({..._,from:S})}R&&T.parentId&&y.push({id:b,parentId:T.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),h.push(V)}if(y.length>0){const{parentLookup:b,nodeOrigin:j}=m(),T=Xa(y,v,b,j);h.push(...T)}for(const b of C.values())h=b(h);E(h)},triggerNodeChanges:x=>{const{onNodesChange:p,setNodes:y,nodes:h,hasDefaultNodes:v,debug:E}=m();if(x!=null&&x.length){if(v){const _=LS(x,h);y(_)}E&&console.log("React Flow: trigger node changes",x),p==null||p(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:p,setEdges:y,edges:h,hasDefaultEdges:v,debug:E}=m();if(x!=null&&x.length){if(v){const _=TS(x,h);y(_)}E&&console.log("React Flow: trigger edge changes",x),p==null||p(x)}},addSelectedNodes:x=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:h,triggerNodeChanges:v,triggerEdgeChanges:E}=m();if(p){const _=x.map(k=>Xn(k,!0));v(_);return}v(Vr(h,new Set([...x]),!0)),E(Vr(y))},addSelectedEdges:x=>{const{multiSelectionActive:p,edgeLookup:y,nodeLookup:h,triggerNodeChanges:v,triggerEdgeChanges:E}=m();if(p){const _=x.map(k=>Xn(k,!0));E(_);return}E(Vr(y,new Set([...x]))),v(Vr(h,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:p}={})=>{const{edges:y,nodes:h,nodeLookup:v,triggerNodeChanges:E,triggerEdgeChanges:_}=m(),k=x||h,C=p||y,b=[];for(const T of k){if(!T.selected)continue;const R=v.get(T.id);R&&(R.selected=!1),b.push(Xn(T.id,!1))}const j=[];for(const T of C)T.selected&&j.push(Xn(T.id,!1));E(b),_(j)},setMinZoom:x=>{const{panZoom:p,maxZoom:y}=m();p==null||p.setScaleExtent([x,y]),g({minZoom:x})},setMaxZoom:x=>{const{panZoom:p,minZoom:y}=m();p==null||p.setScaleExtent([y,x]),g({maxZoom:x})},setTranslateExtent:x=>{var p;(p=m().panZoom)==null||p.setTranslateExtent(x),g({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:p,triggerNodeChanges:y,triggerEdgeChanges:h,elementsSelectable:v}=m();if(!v)return;const E=p.reduce((k,C)=>C.selected?[...k,Xn(C.id,!1)]:k,[]),_=x.reduce((k,C)=>C.selected?[...k,Xn(C.id,!1)]:k,[]);y(E),h(_)},setNodeExtent:x=>{const{nodes:p,nodeLookup:y,parentLookup:h,nodeOrigin:v,elevateNodesOnSelect:E,nodeExtent:_,zIndexMode:k}=m();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(Wa(p,y,h,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:k}),g({nodeExtent:x}))},panBy:x=>{const{transform:p,width:y,height:h,panZoom:v,translateExtent:E}=m();return m_({delta:x,panZoom:v,transform:p,translateExtent:E,width:y,height:h})},setCenter:async(x,p,y)=>{const{width:h,height:v,maxZoom:E,panZoom:_}=m();if(!_)return!1;const k=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:E;return await _.setViewport({x:h/2-x*k,y:v/2-p*k,zoom:k},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),!0},cancelConnection:()=>{g({connection:{...Rp}})},updateConnection:x=>{g({connection:x})},reset:()=>g({...Mm()})}},Object.is);function Im({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:u,fitView:a,nodeOrigin:f,nodeExtent:c,zIndexMode:d,children:g}){const[m]=D.useState(()=>Kk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,minZoom:s,maxZoom:l,fitViewOptions:u,nodeOrigin:f,nodeExtent:c,zIndexMode:d}));return I.jsx(fS,{value:m,children:I.jsx(AS,{children:g})})}function Zk({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:l,fitViewOptions:u,minZoom:a,maxZoom:f,nodeOrigin:c,nodeExtent:d,zIndexMode:g}){return D.useContext(Us)?I.jsx(I.Fragment,{children:e}):I.jsx(Im,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:u,initialMinZoom:a,initialMaxZoom:f,nodeOrigin:c,nodeExtent:d,zIndexMode:g,children:e})}const qk={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Jk({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:a,onMove:f,onMoveStart:c,onMoveEnd:d,onConnect:g,onConnectStart:m,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,onNodeDragStart:k,onNodeDrag:C,onNodeDragStop:b,onNodesDelete:j,onEdgesDelete:T,onDelete:R,onSelectionChange:V,onSelectionDragStart:S,onSelectionDrag:$,onSelectionDragStop:L,onSelectionContextMenu:z,onSelectionStart:M,onSelectionEnd:N,onBeforeDelete:P,connectionMode:A,connectionLineType:O=En.Bezier,connectionLineStyle:U,connectionLineComponent:B,connectionLineContainerStyle:X,deleteKeyCode:q="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:F=!1,selectionMode:W=Uo.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:J=Qo()?"Meta":"Control",zoomActivationKeyCode:Z=Qo()?"Meta":"Control",snapToGrid:K,snapGrid:ne,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:le,nodesDraggable:we,autoPanOnNodeFocus:st,nodesConnectable:bt,nodesFocusable:$t,nodeOrigin:Zt=Og,edgesFocusable:Jo,edgesReconnectable:Kn,elementsSelectable:Zn=!0,defaultViewport:Et=kS,minZoom:qt=.5,maxZoom:Jt=2,translateExtent:qn=Bo,preventScrolling:nI=!0,nodeExtent:yc,defaultMarkerColor:rI="#b1b1b7",zoomOnScroll:oI=!0,zoomOnPinch:iI=!0,panOnScroll:sI=!1,panOnScrollSpeed:lI=.5,panOnScrollMode:uI=Bn.Free,zoomOnDoubleClick:aI=!0,panOnDrag:cI=!0,onPaneClick:fI,onPaneMouseEnter:dI,onPaneMouseMove:hI,onPaneMouseLeave:pI,onPaneScroll:gI,onPaneContextMenu:mI,paneClickDistance:yI=1,nodeClickDistance:vI=0,children:wI,onReconnect:xI,onReconnectStart:EI,onReconnectEnd:_I,onEdgeContextMenu:SI,onEdgeDoubleClick:kI,onEdgeMouseEnter:NI,onEdgeMouseMove:CI,onEdgeMouseLeave:MI,reconnectRadius:II=10,onNodesChange:PI,onEdgesChange:LI,noDragClassName:TI="nodrag",noWheelClassName:bI="nowheel",noPanClassName:P0="nopan",fitView:L0,fitViewOptions:T0,connectOnClick:$I,attributionPosition:zI,proOptions:OI,defaultEdgeOptions:RI,elevateNodesOnSelect:AI=!0,elevateEdgesOnSelect:DI=!1,disableKeyboardA11y:b0=!1,autoPanOnConnect:jI,autoPanOnNodeDrag:FI,autoPanOnSelection:VI=!0,autoPanSpeed:HI,connectionRadius:BI,isValidConnection:UI,onError:WI,style:YI,id:$0,nodeDragThreshold:XI,connectionDragThreshold:GI,viewport:QI,onViewportChange:KI,width:ZI,height:qI,colorMode:JI="light",debug:eP,onScroll:nl,ariaLabelConfig:tP,zIndexMode:z0="basic",...nP},rP){const vc=$0||"1",oP=MS(JI),iP=D.useCallback(O0=>{O0.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nl==null||nl(O0)},[nl]);return I.jsx("div",{"data-testid":"rf__wrapper",...nP,onScroll:iP,style:{...YI,...qk},ref:rP,className:Ee(["react-flow",o,oP]),id:$0,role:"application",children:I.jsxs(Zk,{nodes:e,edges:t,width:ZI,height:qI,fitView:L0,fitViewOptions:T0,minZoom:qt,maxZoom:Jt,nodeOrigin:Zt,nodeExtent:yc,zIndexMode:z0,children:[I.jsx(CS,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:m,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:p,nodesDraggable:we,autoPanOnNodeFocus:st,nodesConnectable:bt,nodesFocusable:$t,edgesFocusable:Jo,edgesReconnectable:Kn,elementsSelectable:Zn,elevateNodesOnSelect:AI,elevateEdgesOnSelect:DI,minZoom:qt,maxZoom:Jt,nodeExtent:yc,onNodesChange:PI,onEdgesChange:LI,snapToGrid:K,snapGrid:ne,connectionMode:A,translateExtent:qn,connectOnClick:$I,defaultEdgeOptions:RI,fitView:L0,fitViewOptions:T0,onNodesDelete:j,onEdgesDelete:T,onDelete:R,onNodeDragStart:k,onNodeDrag:C,onNodeDragStop:b,onSelectionDrag:$,onSelectionDragStart:S,onSelectionDragStop:L,onMove:f,onMoveStart:c,onMoveEnd:d,noPanClassName:P0,nodeOrigin:Zt,rfId:vc,autoPanOnConnect:jI,autoPanOnNodeDrag:FI,autoPanSpeed:HI,onError:WI,connectionRadius:BI,isValidConnection:UI,selectNodesOnDrag:le,nodeDragThreshold:XI,connectionDragThreshold:GI,onBeforeDelete:P,debug:eP,ariaLabelConfig:tP,zIndexMode:z0}),I.jsx(Gk,{onInit:a,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:v,onNodeContextMenu:E,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:O,connectionLineStyle:U,connectionLineComponent:B,connectionLineContainerStyle:X,selectionKeyCode:Q,selectionOnDrag:F,selectionMode:W,deleteKeyCode:q,multiSelectionKeyCode:J,panActivationKeyCode:ee,zoomActivationKeyCode:Z,onlyRenderVisibleElements:ie,defaultViewport:Et,translateExtent:qn,minZoom:qt,maxZoom:Jt,preventScrolling:nI,zoomOnScroll:oI,zoomOnPinch:iI,zoomOnDoubleClick:aI,panOnScroll:sI,panOnScrollSpeed:lI,panOnScrollMode:uI,panOnDrag:cI,autoPanOnSelection:VI,onPaneClick:fI,onPaneMouseEnter:dI,onPaneMouseMove:hI,onPaneMouseLeave:pI,onPaneScroll:gI,onPaneContextMenu:mI,paneClickDistance:yI,nodeClickDistance:vI,onSelectionContextMenu:z,onSelectionStart:M,onSelectionEnd:N,onReconnect:xI,onReconnectStart:EI,onReconnectEnd:_I,onEdgeContextMenu:SI,onEdgeDoubleClick:kI,onEdgeMouseEnter:NI,onEdgeMouseMove:CI,onEdgeMouseLeave:MI,reconnectRadius:II,defaultMarkerColor:rI,noDragClassName:TI,noWheelClassName:bI,noPanClassName:P0,rfId:vc,disableKeyboardA11y:b0,nodeExtent:yc,viewport:QI,onViewportChange:KI}),I.jsx(SS,{onSelectionChange:V}),wI,I.jsx(vS,{proOptions:OI,position:zI}),I.jsx(yS,{rfId:vc,disableKeyboardA11y:b0})]})})}var e2=Yg(Jk);function t2({dimensions:e,lineWidth:t,variant:n,className:r}){return I.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ee(["react-flow__background-pattern",n,r])})}function n2({radius:e,className:t}){return I.jsx("circle",{cx:e,cy:e,r:e,className:Ee(["react-flow__background-pattern","dots",t])})}var kn;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(kn||(kn={}));const r2={[kn.Dots]:1,[kn.Lines]:1,[kn.Cross]:6},o2=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Pm({id:e,variant:t=kn.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:l,style:u,className:a,patternClassName:f}){const c=D.useRef(null),{transform:d,patternId:g}=re(o2,de),m=r||r2[t],w=t===kn.Dots,x=t===kn.Cross,p=Array.isArray(n)?n:[n,n],y=[p[0]*d[2]||1,p[1]*d[2]||1],h=m*d[2],v=Array.isArray(i)?i:[i,i],E=x?[h,h]:y,_=[v[0]*d[2]||1+E[0]/2,v[1]*d[2]||1+E[1]/2],k=`${g}${e||""}`;return I.jsxs("svg",{className:Ee(["react-flow__background",a]),style:{...u,...Xs,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:c,"data-testid":"rf__background",children:[I.jsx("pattern",{id:k,x:d[0]%y[0],y:d[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:w?I.jsx(n2,{radius:h/2,className:f}):I.jsx(t2,{dimensions:E,lineWidth:o,variant:t,className:f})}),I.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Pm.displayName="Background";const i2=D.memo(Pm);function s2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:I.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function l2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:I.jsx("path",{d:"M0 0h32v4.2H0z"})})}function u2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:I.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 a2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 c2(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 Ks({children:e,className:t,...n}){return I.jsx("button",{type:"button",className:Ee(["react-flow__controls-button",t]),...n,children:e})}const f2=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Lm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:l,onInteractiveChange:u,className:a,children:f,position:c="bottom-left",orientation:d="vertical","aria-label":g}){const m=he(),{isInteractive:w,minZoomReached:x,maxZoomReached:p,ariaLabelConfig:y}=re(f2,de),{zoomIn:h,zoomOut:v,fitView:E}=Ja(),_=()=>{h(),i==null||i()},k=()=>{v(),s==null||s()},C=()=>{E(o),l==null||l()},b=()=>{m.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},j=d==="horizontal"?"horizontal":"vertical";return I.jsxs(Ws,{className:Ee(["react-flow__controls",j,a]),position:c,style:e,"data-testid":"rf__controls","aria-label":g??y["controls.ariaLabel"],children:[t&&I.jsxs(I.Fragment,{children:[I.jsx(Ks,{onClick:_,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:p,children:I.jsx(s2,{})}),I.jsx(Ks,{onClick:k,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:x,children:I.jsx(l2,{})})]}),n&&I.jsx(Ks,{className:"react-flow__controls-fitview",onClick:C,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:I.jsx(u2,{})}),r&&I.jsx(Ks,{className:"react-flow__controls-interactive",onClick:b,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:w?I.jsx(c2,{}):I.jsx(a2,{})}),f]})}Lm.displayName="Controls";const d2=D.memo(Lm);function h2({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:l,strokeWidth:u,className:a,borderRadius:f,shapeRendering:c,selected:d,onClick:g}){const{background:m,backgroundColor:w}=i||{},x=s||m||w;return I.jsx("rect",{className:Ee(["react-flow__minimap-node",{selected:d},a]),x:t,y:n,rx:f,ry:f,width:r,height:o,style:{fill:x,stroke:l,strokeWidth:u},shapeRendering:c,onClick:g?p=>g(p,e):void 0})}const p2=D.memo(h2),g2=e=>e.nodes.map(t=>t.id),rc=e=>e instanceof Function?e:()=>e;function m2({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=p2,onClick:s}){const l=re(g2,de),u=rc(t),a=rc(e),f=rc(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return I.jsx(I.Fragment,{children:l.map(d=>I.jsx(v2,{id:d,nodeColorFunc:u,nodeStrokeColorFunc:a,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:c},d))})}function y2({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:l,onClick:u}){const{node:a,x:f,y:c,width:d,height:g}=re(m=>{const w=m.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:p,y}=w.internals.positionAbsolute,{width:h,height:v}=Qt(x);return{node:x,x:p,y,width:h,height:v}},de);return!a||a.hidden||!Yp(a)?null:I.jsx(l,{x:f,y:c,width:d,height:g,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 v2=D.memo(y2);var w2=D.memo(m2);const x2=200,E2=150,_2=e=>!e.hidden,S2=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?Bp(Yo(e.nodeLookup,{filter:_2}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},k2="react-flow__minimap-desc";function Tm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:a,maskStrokeColor:f,maskStrokeWidth:c,position:d="bottom-right",onClick:g,onNodeClick:m,pannable:w=!1,zoomable:x=!1,ariaLabel:p,inversePan:y,zoomStep:h=1,offsetScale:v=5}){const E=he(),_=D.useRef(null),{boundingRect:k,viewBB:C,rfId:b,panZoom:j,translateExtent:T,flowWidth:R,flowHeight:V,ariaLabelConfig:S}=re(S2,de),$=(e==null?void 0:e.width)??x2,L=(e==null?void 0:e.height)??E2,z=k.width/$,M=k.height/L,N=Math.max(z,M),P=N*$,A=N*L,O=v*N,U=k.x-(P-k.width)/2-O,B=k.y-(A-k.height)/2-O,X=P+O*2,q=A+O*2,Q=`${k2}-${b}`,F=D.useRef(0),W=D.useRef();F.current=N,D.useEffect(()=>{if(_.current&&j)return W.current=N_({domNode:_.current,panZoom:j,getTransform:()=>E.getState().transform,getViewScale:()=>F.current}),()=>{var K;(K=W.current)==null||K.destroy()}},[j]),D.useEffect(()=>{var K;(K=W.current)==null||K.update({translateExtent:T,width:R,height:V,inversePan:y,pannable:w,zoomStep:h,zoomable:x})},[w,x,y,h,T,R,V]);const ee=g?K=>{var le;const[ne,ie]=((le=W.current)==null?void 0:le.pointer(K))||[0,0];g(K,{x:ne,y:ie})}:void 0,J=m?D.useCallback((K,ne)=>{const ie=E.getState().nodeLookup.get(ne).internals.userNode;m(K,ie)},[]):void 0,Z=p??S["minimap.ariaLabel"];return I.jsx(Ws,{position:d,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 f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*N: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:Ee(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:I.jsxs("svg",{width:$,height:L,viewBox:`${U} ${B} ${X} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Q,ref:_,onClick:ee,children:[Z&&I.jsx("title",{id:Q,children:Z}),I.jsx(w2,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:l}),I.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-O},${B-O}h${X+O*2}v${q+O*2}h${-X-O*2}z + M${C.x},${C.y}h${C.width}v${C.height}h${-C.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Tm.displayName="MiniMap";const N2=D.memo(Tm),C2=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,M2={[jr.Line]:"right",[jr.Handle]:"bottom-right"};function I2({nodeId:e,position:t,variant:n=jr.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:a=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:d,autoScale:g=!0,shouldResize:m,onResizeStart:w,onResize:x,onResizeEnd:p}){const y=qg(),h=typeof e=="string"?e:y,v=he(),E=D.useRef(null),_=n===jr.Handle,k=re(D.useCallback(C2(_&&g),[_,g]),de),C=D.useRef(null),b=t??M2[n];D.useEffect(()=>{if(!(!E.current||!h))return C.current||(C.current=D_({domNode:E.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:T,transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$,domNode:L}=v.getState();return{nodeLookup:T,transform:R,snapGrid:V,snapToGrid:S,nodeOrigin:$,paneDomNode:L}},onChange:(T,R)=>{const{triggerNodeChanges:V,nodeLookup:S,parentLookup:$,nodeOrigin:L}=v.getState(),z=[],M={x:T.x,y:T.y},N=S.get(h);if(N&&N.expandParent&&N.parentId){const P=N.origin??L,A=T.width??N.measured.width??0,O=T.height??N.measured.height??0,U={id:N.id,parentId:N.parentId,rect:{width:A,height:O,...Xp({x:T.x??N.position.x,y:T.y??N.position.y},{width:A,height:O},N.parentId,S,P)}},B=Xa([U],S,$,L);z.push(...B),M.x=T.x?Math.max(P[0]*A,T.x):void 0,M.y=T.y?Math.max(P[1]*O,T.y):void 0}if(M.x!==void 0&&M.y!==void 0){const P={id:h,type:"position",position:{...M}};z.push(P)}if(T.width!==void 0&&T.height!==void 0){const A={id:h,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};z.push(A)}for(const P of R){const A={...P,type:"position"};z.push(A)}V(z)},onEnd:({width:T,height:R})=>{const V={id:h,type:"dimensions",resizing:!1,dimensions:{width:T,height:R}};v.getState().triggerNodeChanges([V])}})),C.current.update({controlPosition:b,boundaries:{minWidth:l,minHeight:u,maxWidth:a,maxHeight:f},keepAspectRatio:c,resizeDirection:d,onResizeStart:w,onResize:x,onResizeEnd:p,shouldResize:m}),()=>{var T;(T=C.current)==null||T.destroy()}},[b,l,u,a,f,c,w,x,p,m]);const j=b.split("-");return I.jsx("div",{className:Ee(["react-flow__resize-control","nodrag",...j,n,r]),ref:E,style:{...o,scale:k,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}D.memo(I2);const P2={model:"var(--model, #2f6feb)",source:"var(--source, #16a34a)",seed:"var(--seed, #b45309)",snapshot:"var(--snapshot, #7c3aed)"},bm="__table_in",$m="__table_out",zm=e=>`${e}__in`,Om=e=>`${e}__out`;function L2(e){return e.is_primary_key?"PK":e.is_foreign_key?"FK":null}function T2({data:e}){const t=e.record,n=e.focused,r=P2[t.resource_type]??"var(--border, #888)";return I.jsxs("div",{className:`dbd-erd${n?" dbd-erd-focus":""}`,title:t.id,children:[I.jsx(Tt,{type:"target",position:G.Left,id:bm,className:"dbd-h-table"}),I.jsx(Tt,{type:"source",position:G.Right,id:$m,className:"dbd-h-table"}),I.jsxs("div",{className:"dbd-erd-head",style:{borderTopColor:r},children:[I.jsx("span",{className:"dbd-erd-name",children:t.label}),I.jsx("span",{className:"dbd-erd-schema",children:t.schema})]}),I.jsx("div",{className:"dbd-erd-cols",children:(t.columns??[]).map(o=>{const i=L2(o);return I.jsxs("div",{className:"dbd-erd-col",children:[I.jsx(Tt,{type:"target",position:G.Left,id:zm(o.name),className:"dbd-h-col"}),i?I.jsx("span",{className:`dbd-erd-badge dbd-${i.toLowerCase()}`,children:i}):I.jsx("span",{className:"dbd-erd-badge dbd-none"}),I.jsx("span",{className:"dbd-erd-colname",children:o.name}),I.jsx("span",{className:"dbd-erd-coltype",children:o.type}),I.jsx(Tt,{type:"source",position:G.Right,id:Om(o.name),className:"dbd-h-col"})]},o.name)})})]})}const b2={width:190,height:40},$2=230,z2=34,O2=22;function R2(e,t){var l;const n=e.nodes??{},r=Object.keys(n).filter(u=>!t||t.has(u)),o=r.map(u=>({id:u,type:"lineage",position:{x:0,y:0},data:{record:n[u]}})),i=(((l=e.lineage)==null?void 0:l.edges)??[]).filter(u=>!t||t.has(u.source)&&t.has(u.target)).map((u,a)=>({id:`l${a}`,source:u.source,target:u.target,type:"smoothstep"})),s=r.map(u=>({id:u,...b2}));return{nodes:o,edges:i,sizes:s}}function A2(e,t){const n=e.erd??{nodes:[],edges:[]};let r=n.nodes,o=n.edges;if(t){const c=new Set([t]);for(const d of n.edges)d.source===t&&c.add(d.target),d.target===t&&c.add(d.source);r=n.nodes.filter(d=>c.has(d.id)),o=n.edges.filter(d=>c.has(d.source)&&c.has(d.target))}const i=r.map(c=>({id:c.id,type:"erdTable",position:{x:0,y:0},data:{record:c,focused:c.id===t}})),s=new Map(r.map(c=>[c.id,new Set((c.columns??[]).map(d=>d.name))])),l=(c,d)=>{var g;return((g=s.get(c))==null?void 0:g.has(d))??!1},u=(c,...d)=>d.find(g=>g&&l(c,g)),a=[];for(const c of o){const d=c.from_columns??[],g=c.to_columns??[],m=Math.max(d.length,g.length,1);for(let w=0;w({id:c.id,width:$2,height:z2+Math.max(1,(c.columns??[]).length)*O2}));return{nodes:i,edges:a,sizes:f}}function D2(e,t,n=2){var l,u;const r=new Set([t]),o=((l=e.lineage)==null?void 0:l.parents)??{},i=((u=e.lineage)==null?void 0:u.children)??{},s=(a,f,c)=>{if(!(c>=n))for(const d of f[a]??[])r.has(d)||(r.add(d),s(d,f,c+1))};return s(t,o,0),s(t,i,0),r}var j2="\0",Gn="\0",Rm="";let F2=class{constructor(t){Se(this,"_isDirected",!0);Se(this,"_isMultigraph",!1);Se(this,"_isCompound",!1);Se(this,"_label");Se(this,"_defaultNodeLabelFn",()=>{});Se(this,"_defaultEdgeLabelFn",()=>{});Se(this,"_nodes",{});Se(this,"_in",{});Se(this,"_preds",{});Se(this,"_out",{});Se(this,"_sucs",{});Se(this,"_edgeObjs",{});Se(this,"_edgeLabels",{});Se(this,"_nodeCount",0);Se(this,"_edgeCount",0);Se(this,"_parent");Se(this,"_children");t&&(this._isDirected=Object.hasOwn(t,"directed")?t.directed:!0,this._isMultigraph=Object.hasOwn(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.hasOwn(t,"compound")?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[Gn]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,typeof t!="function"&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(n=>Object.keys(t._in[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(t._out[n]).length===0)}setNodes(t,n){var r=arguments,o=this;return t.forEach(function(i){r.length>1?o.setNode(i,n):o.setNode(i)}),this}setNode(t,n){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Gn,this._children[t]={},this._children[Gn][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var n=this;if(Object.hasOwn(this._nodes,t)){var r=o=>n.removeEdge(n._edgeObjs[o]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(o){n.setParent(o)}),delete this._children[t]),Object.keys(this._in[t]).forEach(r),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=Gn;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var n=this._parent[t];if(n!==Gn)return n}}children(t=Gn){if(this._isCompound){var n=this._children[t];if(n)return Object.keys(n)}else{if(t===Gn)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=this._preds[t];if(n)return Object.keys(n)}successors(t){var n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const o=new Set(n);for(var r of this.successors(t))o.add(r);return Array.from(o.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;Object.entries(this._nodes).forEach(function([s,l]){t(s)&&n.setNode(s,l)}),Object.values(this._edgeObjs).forEach(function(s){n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,r.edge(s))});var o={};function i(s){var l=r.parent(s);return l===void 0||n.hasNode(l)?(o[s]=l,l):l in o?o[l]:i(l)}return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,i(s))),n}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,typeof t!="function"&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){var r=this,o=arguments;return t.reduce(function(i,s){return o.length>1?r.setEdge(i,s,n):r.setEdge(i,s),s}),this}setEdge(){var t,n,r,o,i=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,n=s.w,r=s.name,arguments.length===2&&(o=arguments[1],i=!0)):(t=s,n=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var l=qo(this._isDirected,t,n,r);if(Object.hasOwn(this._edgeLabels,l))return i&&(this._edgeLabels[l]=o),this;if(r!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),this._edgeLabels[l]=i?o:this._defaultEdgeLabelFn(t,n,r);var u=V2(this._isDirected,t,n,r);return t=u.v,n=u.w,Object.freeze(u),this._edgeObjs[l]=u,Am(this._preds[n],t),Am(this._sucs[t],n),this._in[n][l]=u,this._out[t][l]=u,this._edgeCount++,this}edge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r);return this._edgeLabels[o]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r);return Object.hasOwn(this._edgeLabels,o)}removeEdge(t,n,r){var o=arguments.length===1?oc(this._isDirected,arguments[0]):qo(this._isDirected,t,n,r),i=this._edgeObjs[o];return i&&(t=i.v,n=i.w,delete this._edgeLabels[o],delete this._edgeObjs[o],Dm(this._preds[n],t),Dm(this._sucs[t],n),delete this._in[n][o],delete this._out[t][o],this._edgeCount--),this}inEdges(t,n){var r=this._in[t];if(r){var o=Object.values(r);return n?o.filter(i=>i.v===n):o}}outEdges(t,n){var r=this._out[t];if(r){var o=Object.values(r);return n?o.filter(i=>i.w===n):o}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}};function Am(e,t){e[t]?e[t]++:e[t]=1}function Dm(e,t){--e[t]||delete e[t]}function qo(e,t,n,r){var o=""+t,i=""+n;if(!e&&o>i){var s=o;o=i,i=s}return o+Rm+i+Rm+(r===void 0?j2:r)}function V2(e,t,n,r){var o=""+t,i=""+n;if(!e&&o>i){var s=o;o=i,i=s}var l={v:o,w:i};return r&&(l.name=r),l}function oc(e,t){return qo(e,t.v,t.w,t.name)}var ic=F2,H2="2.2.4",B2={Graph:ic,version:H2},U2=ic,W2={write:Y2,read:Q2};function Y2(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:X2(e),edges:G2(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function X2(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function G2(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Q2(e){var t=new U2(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var K2=Z2;function Z2(e){var t={},n=[],r;function o(i){Object.hasOwn(t,i)||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var jm=class{constructor(){Se(this,"_arr",[]);Se(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var n=this._keyIndices[t];if(n!==void 0)return this._arr[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,n){var r=this._keyIndices;if(t=String(t),!Object.hasOwn(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:n}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,n){var r=this._keyIndices[t];if(n>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+n);this._arr[r].priority=n,this._decrease(r)}_heapify(t){var n=this._arr,r=2*t,o=r+1,i=t;r>1,!(n[o].priority1;function eN(e,t,n,r){return tN(e,String(t),n||J2,r||function(o){return e.outEdges(o)})}function tN(e,t,n,r){var o={},i=new q2,s,l,u=function(a){var f=a.v!==s?a.v:a.w,c=o[f],d=n(a),g=l.distance+d;if(d<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+a+" Weight: "+d);g0&&(s=i.removeMin(),l=o[s],l.distance!==Number.POSITIVE_INFINITY);)r(s).forEach(u);return o}var nN=Fm,rN=oN;function oN(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=nN(e,o,t,n),r},{})}var Vm=iN;function iN(e){var t=0,n=[],r={},o=[];function i(s){var l=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(f){Object.hasOwn(r,f)?r[f].onStack&&(l.lowlink=Math.min(l.lowlink,r[f].index)):(i(f),l.lowlink=Math.min(l.lowlink,r[f].lowlink))}),l.lowlink===l.index){var u=[],a;do a=n.pop(),r[a].onStack=!1,u.push(a);while(s!==a);o.push(u)}}return e.nodes().forEach(function(s){Object.hasOwn(r,s)||i(s)}),o}var sN=Vm,lN=uN;function uN(e){return sN(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var aN=fN,cN=()=>1;function fN(e,t,n){return dN(e,t||cN,n||function(r){return e.outEdges(r)})}function dN(e,t,n){var r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0},o.forEach(function(s){i!==s&&(r[i][s]={distance:Number.POSITIVE_INFINITY})}),n(i).forEach(function(s){var l=s.v===i?s.w:s.v,u=t(s);r[i][l]={distance:u,predecessor:i}})}),o.forEach(function(i){var s=r[i];o.forEach(function(l){var u=r[l];o.forEach(function(a){var f=u[i],c=s[a],d=u[a],g=f.distance+c.distance;ge.successors(l):l=>e.neighbors(l),o=n==="post"?mN:yN,i=[],s={};return t.forEach(l=>{if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o(l,r,s,i)}),i}function mN(e,t,n,r){for(var o=[[e,!1]];o.length>0;){var i=o.pop();i[1]?r.push(i[0]):Object.hasOwn(n,i[0])||(n[i[0]]=!0,o.push([i[0],!0]),Ym(t(i[0]),s=>o.push([s,!1])))}}function yN(e,t,n,r){for(var o=[e];o.length>0;){var i=o.pop();Object.hasOwn(n,i)||(n[i]=!0,r.push(i),Ym(t(i),s=>o.push(s)))}}function Ym(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var vN=Wm,wN=xN;function xN(e,t){return vN(e,t,"post")}var EN=Wm,_N=SN;function SN(e,t){return EN(e,t,"pre")}var kN=ic,NN=jm,CN=MN;function MN(e,t){var n=new kN,r={},o=new NN,i;function s(u){var a=u.v===i?u.w:u.v,f=o.priority(a);if(f!==void 0){var c=t(u);c0;){if(i=o.removeMin(),Object.hasOwn(r,i))n.setEdge(i,r[i]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(i).forEach(s)}return n}var IN={components:K2,dijkstra:Fm,dijkstraAll:rN,findCycles:lN,floydWarshall:aN,isAcyclic:hN,postorder:wN,preorder:_N,prim:CN,tarjan:Vm,topsort:Bm},Xm=B2,xt={Graph:Xm.Graph,json:W2,alg:IN,version:Xm.version};let PN=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,n=t._prev;if(n!==t)return Gm(n),n}enqueue(t){let n=this._sentinel;t._prev&&t._next&&Gm(t),t._next=n._next,n._next._prev=t,n._next=t,t._prev=n}toString(){let t=[],n=this._sentinel,r=n._prev;for(;r!==n;)t.push(JSON.stringify(r,LN)),r=r._prev;return"["+t.join(", ")+"]"}};function Gm(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function LN(e,t){if(e!=="_next"&&e!=="_prev")return t}var TN=PN;let bN=xt.Graph,$N=TN;var zN=RN;let ON=()=>1;function RN(e,t){if(e.nodeCount()<=1)return[];let n=DN(e,t||ON);return AN(n.graph,n.buckets,n.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w))}function AN(e,t,n){let r=[],o=t[t.length-1],i=t[0],s;for(;e.nodeCount();){for(;s=i.dequeue();)lc(e,t,n,s);for(;s=o.dequeue();)lc(e,t,n,s);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(s=t[l].dequeue(),s){r=r.concat(lc(e,t,n,s,!0));break}}}return r}function lc(e,t,n,r,o){let i=o?[]:void 0;return e.inEdges(r.v).forEach(s=>{let l=e.edge(s),u=e.node(s.v);o&&i.push({v:s.v,w:s.w}),u.out-=l,uc(t,n,u)}),e.outEdges(r.v).forEach(s=>{let l=e.edge(s),u=s.w,a=e.node(u);a.in-=l,uc(t,n,a)}),e.removeNode(r.v),i}function DN(e,t){let n=new bN,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let u=n.edge(l.v,l.w)||0,a=t(l),f=u+a;n.setEdge(l.v,l.w,f),o=Math.max(o,n.node(l.v).out+=a),r=Math.max(r,n.node(l.w).in+=a)});let i=jN(o+r+3).map(()=>new $N),s=r+1;return n.nodes().forEach(l=>{uc(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function uc(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function jN(e){const t=[];for(let n=0;nt.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function VN(e){let t=new Qm({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function HN(e){let t=e.nodes().map(n=>{let r={};return e.outEdges(n).forEach(o=>{r[o.w]=(r[o.w]||0)+e.edge(o).weight}),r});return ac(e.nodes(),t)}function BN(e){let t=e.nodes().map(n=>{let r={};return e.inEdges(n).forEach(o=>{r[o.v]=(r[o.v]||0)+e.edge(o).weight}),r});return ac(e.nodes(),t)}function UN(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,l=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let u,a;return Math.abs(i)*s>Math.abs(o)*l?(i<0&&(l=-l),u=l*o/i,a=l):(o<0&&(s=-s),u=s,a=s*i/o),{x:n+u,y:r+a}}function WN(e){let t=e0(qm(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o][r.order]=n)}),t}function YN(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Zs(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function XN(e){let t=e.nodes().map(s=>e.node(s).rank),n=Zs(Math.min,t),r=[];e.nodes().forEach(s=>{let l=e.node(s).rank-n;r[l]||(r[l]=[]),r[l].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,l)=>{s===void 0&&l%i!==0?--o:s!==void 0&&o&&s.forEach(u=>e.node(u).rank+=o)})}function GN(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Km(e,"border",o,t)}function QN(e,t=Zm){const n=[];for(let r=0;rZm){const n=QN(t);return e.apply(null,n.map(r=>e.apply(null,r)))}else return e.apply(null,t)}function qm(e){const n=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MIN_VALUE:o});return Zs(Math.max,n)}function KN(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function ZN(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function qN(e,t){return t()}let JN=0;function Jm(e){var t=++JN;return e+(""+t)}function e0(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]),Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function ac(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}let nC=zN,rC=_e.uniqueId;var oC={run:iC,undo:lC};function iC(e){(e.graph().acyclicer==="greedy"?nC(e,n(e)):sC(e)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,rC("rev"))});function n(r){return o=>r.edge(o).weight}}function sC(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(s=>{Object.hasOwn(n,s.w)?t.push(s):o(s.w)}),delete n[i])}return e.nodes().forEach(o),t}function lC(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}let uC=_e;var aC={run:cC,undo:dC};function cC(e){e.graph().dummyChains=[],e.edges().forEach(t=>fC(e,t))}function fC(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,l=e.edge(t),u=l.labelRank;if(i===r+1)return;e.removeEdge(t);let a,f,c;for(c=0,++r;r{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}const{applyWithChunking:hC}=_e;var qs={longestPath:pC,slack:gC};function pC(e){var t={};function n(r){var o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r).map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-e.edge(l).minlen);var s=hC(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}e.sources().forEach(n)}function gC(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var mC=xt.Graph,Js=qs.slack,t0=yC;function yC(e){var t=new mC({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var o,i;vC(t,e){var i=o.v,s=r===i?o.w:i;!e.hasNode(s)&&!Js(t,o)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function wC(e,t){return t.edges().reduce((r,o)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(i=Js(t,o)),it.node(r).rank+=n)}var EC=t0,n0=qs.slack,_C=qs.longestPath,SC=xt.alg.preorder,kC=xt.alg.postorder,NC=_e.simplify,CC=Qn;Qn.initLowLimValues=fc,Qn.initCutValues=cc,Qn.calcCutValue=r0,Qn.leaveEdge=i0,Qn.enterEdge=s0,Qn.exchangeEdges=l0;function Qn(e){e=NC(e),_C(e);var t=EC(e);fc(t),cc(t,e);for(var n,r;n=i0(t);)r=s0(t,e,n),l0(t,e,n,r)}function cc(e,t){var n=kC(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>MC(e,t,r))}function MC(e,t,n){var r=e.node(n),o=r.parent;e.edge(n,o).cutvalue=r0(e,t,n)}function r0(e,t,n){var r=e.node(n),o=r.parent,i=!0,s=t.edge(n,o),l=0;return s||(i=!1,s=t.edge(o,n)),l=s.weight,t.nodeEdges(n).forEach(u=>{var a=u.v===n,f=a?u.w:u.v;if(f!==o){var c=a===i,d=t.edge(u).weight;if(l+=c?d:-d,PC(e,n,f)){var g=e.edge(n,f).cutvalue;l+=c?-g:g}}}),l}function fc(e,t){arguments.length<2&&(t=e.nodes()[0]),o0(e,{},1,t)}function o0(e,t,n,r,o){var i=n,s=e.node(r);return t[r]=!0,e.neighbors(r).forEach(l=>{Object.hasOwn(t,l)||(n=o0(e,t,n,l,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function i0(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function s0(e,t,n){var r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);var i=e.node(r),s=e.node(o),l=i,u=!1;i.lim>s.lim&&(l=s,u=!0);var a=t.edges().filter(f=>u===u0(e,e.node(f.v),l)&&u!==u0(e,e.node(f.w),l));return a.reduce((f,c)=>n0(t,c)!t.node(o).parent),r=SC(e,n);r=r.slice(1),r.forEach(o=>{var i=e.node(o).parent,s=t.edge(o,i),l=!1;s||(s=t.edge(i,o),l=!0),t.node(o).rank=t.node(i).rank+(l?s.minlen:-s.minlen)})}function PC(e,t,n){return e.hasEdge(t,n)}function u0(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var LC=qs,a0=LC.longestPath,TC=t0,bC=CC,$C=zC;function zC(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":c0(e);break;case"tight-tree":RC(e);break;case"longest-path":OC(e);break;case"none":break;default:c0(e)}}var OC=a0;function RC(e){a0(e),TC(e)}function c0(e){bC(e)}var AC=DC;function DC(e){let t=FC(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=jC(e,t,o.v,o.w),s=i.path,l=i.lca,u=0,a=s[u],f=!0;for(;n!==o.w;){if(r=e.node(n),f){for(;(a=s[u])!==l&&e.node(a).maxRanks||l>t[u].lim));for(a=u,u=r;(u=e.parent(u))!==a;)i.push(u);return{path:o.concat(i.reverse()),lca:a}}function FC(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children().forEach(r),t}let el=_e;var VC={run:HC,cleanup:WC};function HC(e){let t=el.addDummyNode(e,"root",{},"_root"),n=BC(e),r=Object.values(n),o=el.applyWithChunking(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let s=UC(e)+1;e.children().forEach(l=>f0(e,t,i,s,o,n,l)),e.graph().nodeRankFactor=i}function f0(e,t,n,r,o,i,s){let l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=el.addBorderNode(e,"_bt"),a=el.addBorderNode(e,"_bb"),f=e.node(s);e.setParent(u,s),f.borderTop=u,e.setParent(a,s),f.borderBottom=a,l.forEach(c=>{f0(e,t,n,r,o,i,c);let d=e.node(c),g=d.borderTop?d.borderTop:c,m=d.borderBottom?d.borderBottom:c,w=d.borderTop?r:2*r,x=g!==m?1:o-i[s]+1;e.setEdge(u,g,{weight:w,minlen:x,nestingEdge:!0}),e.setEdge(m,a,{weight:w,minlen:x,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:o+i[s]})}function BC(e){var t={};function n(r,o){var i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children().forEach(r=>n(r,1)),t}function UC(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function WC(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}let YC=_e;var XC=GC;function GC(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;ip0(e.node(t))),e.edges().forEach(t=>p0(e.edge(t)))}function p0(e){let t=e.width;e.width=e.height,e.height=t}function qC(e){e.nodes().forEach(t=>dc(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(dc),Object.hasOwn(n,"y")&&dc(n)})}function dc(e){e.y=-e.y}function JC(e){e.nodes().forEach(t=>hc(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(hc),Object.hasOwn(n,"x")&&hc(n)})}function hc(e){let t=e.x;e.x=e.y,e.y=t}let g0=_e;var eM=tM;function tM(e){let t={},n=e.nodes().filter(u=>!e.children(u).length),r=n.map(u=>e.node(u).rank),o=g0.applyWithChunking(Math.max,r),i=g0.range(o+1).map(()=>[]);function s(u){if(t[u])return;t[u]=!0;let a=e.node(u);i[a.rank].push(u),e.successors(u).forEach(s)}return n.sort((u,a)=>e.node(u).rank-e.node(a).rank).forEach(s),i}let nM=_e.zipObject;var rM=oM;function oM(e,t){let n=0;for(let r=1;rf)),o=t.flatMap(a=>e.outEdges(a).map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,c)=>f.pos-c.pos)),i=1;for(;i{let f=a.pos+i;l[f]+=a.weight;let c=0;for(;f>0;)f%2&&(c+=l[f+1]),f=f-1>>1,l[f]+=a.weight;u+=a.weight*c}),u}var sM=lM;function lM(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(r.length){let o=r.reduce((i,s)=>{let l=e.edge(s),u=e.node(s.v);return{sum:i.sum+l.weight*u.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:n}})}let uM=_e;var aM=cM;function cM(e,t){let n={};e.forEach((o,i)=>{let s=n[o.v]={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight)}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(n[o.w]))});let r=Object.values(n).filter(o=>!o.indegree);return fM(r)}function fM(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&dM(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>uM.pick(o,["vs","i","barycenter","weight"]))}function dM(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}let hM=_e;var pM=gM;function gM(e,t){let n=hM.partition(e,f=>Object.hasOwn(f,"barycenter")),r=n.lhs,o=n.rhs.sort((f,c)=>c.i-f.i),i=[],s=0,l=0,u=0;r.sort(mM(!!t)),u=m0(i,o,u),r.forEach(f=>{u+=f.vs.length,i.push(f.vs),s+=f.barycenter*f.weight,l+=f.weight,u=m0(i,o,u)});let a={vs:i.flat(!0)};return l&&(a.barycenter=s/l,a.weight=l),a}function m0(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function mM(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}let yM=sM,vM=aM,wM=pM;var xM=y0;function y0(e,t,n,r){let o=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,u={};s&&(o=o.filter(d=>d!==s&&d!==l));let a=yM(e,o);a.forEach(d=>{if(e.children(d.v).length){let g=y0(e,d.v,n,r);u[d.v]=g,Object.hasOwn(g,"barycenter")&&_M(d,g)}});let f=vM(a,n);EM(f,u);let c=wM(f,r);if(s&&(c.vs=[s,c.vs,l].flat(!0),e.predecessors(s).length)){let d=e.node(e.predecessors(s)[0]),g=e.node(e.predecessors(l)[0]);Object.hasOwn(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+d.order+g.order)/(c.weight+2),c.weight+=2}return c}function EM(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function _M(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}let SM=xt.Graph,kM=_e;var NM=CM;function CM(e,t,n,r){r||(r=e.nodes());let o=MM(e),i=new SM({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let l=e.node(s),u=e.parent(s);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(i.setNode(s),i.setParent(s,u||o),e[n](s).forEach(a=>{let f=a.v===s?a.w:a.v,c=i.edge(f,s),d=c!==void 0?c.weight:0;i.setEdge(f,s,{weight:e.edge(a).weight+d})}),Object.hasOwn(l,"minRank")&&i.setNode(s,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),i}function MM(e){for(var t;e.hasNode(t=kM.uniqueId("_root")););return t}var IM=PM;function PM(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),l,u;for(;s;){if(l=e.parent(s),l?(u=r[l],r[l]=s):(u=o,o=s),u&&u!==s){t.setEdge(u,s);return}s=l}})}let LM=eM,TM=rM,bM=xM,$M=NM,zM=IM,OM=xt.Graph,tl=_e;var RM=v0;function v0(e,t){if(t&&typeof t.customOrder=="function"){t.customOrder(e,v0);return}let n=tl.maxRank(e),r=w0(e,tl.range(1,n+1),"inEdges"),o=w0(e,tl.range(n-1,-1,-1),"outEdges"),i=LM(e);if(x0(e,i),t&&t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,l;for(let u=0,a=0;a<4;++u,++a){AM(u%2?r:o,u%4>=2),i=tl.buildLayerMatrix(e);let f=TM(e,i);f{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(const i of e.nodes()){const s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let l=s.minRank;l<=s.maxRank;l++)l!==s.rank&&o(l,i)}return t.map(function(i){return $M(e,i,n,r.get(i)||[])})}function AM(e,t){let n=new OM;e.forEach(function(r){let o=r.graph().root,i=bM(r,o,n,t);i.vs.forEach((s,l)=>r.node(s).order=l),zM(r,n,i.vs)})}function x0(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}let DM=xt.Graph,Kt=_e;var jM={positionX:KM};function FM(e,t){let n={};function r(o,i){let s=0,l=0,u=o.length,a=i[i.length-1];return i.forEach((f,c)=>{let d=HM(e,f),g=d?e.node(d).order:u;(d||f===a)&&(i.slice(l,c+1).forEach(m=>{e.predecessors(m).forEach(w=>{let x=e.node(w),p=x.order;(p{f=i[c],e.node(f).dummy&&e.predecessors(f).forEach(d=>{let g=e.node(d);g.dummy&&(g.ordera)&&E0(n,d,f)})})}function o(i,s){let l=-1,u,a=0;return s.forEach((f,c)=>{if(e.node(f).dummy==="border"){let d=e.predecessors(f);d.length&&(u=e.node(d[0]).order,r(s,a,c,l,u),a=c,l=u)}r(s,a,s.length,u,i.length)}),s}return t.length&&t.reduce(o),n}function HM(e,t){if(e.node(t).dummy)return e.predecessors(t).find(n=>e.node(n).dummy)}function E0(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function BM(e,t,n){if(t>n){let r=t;t=n,n=r}return!!e[t]&&Object.hasOwn(e[t],n)}function UM(e,t,n,r){let o={},i={},s={};return t.forEach(l=>{l.forEach((u,a)=>{o[u]=u,i[u]=u,s[u]=a})}),t.forEach(l=>{let u=-1;l.forEach(a=>{let f=r(a);if(f.length){f=f.sort((d,g)=>s[d]-s[g]);let c=(f.length-1)/2;for(let d=Math.floor(c),g=Math.ceil(c);d<=g;++d){let m=f[d];i[a]===a&&uMath.max(d,i[g.v]+s.edge(g)),0)}function f(c){let d=s.outEdges(c).reduce((m,w)=>Math.min(m,i[w.w]-s.edge(w)),Number.POSITIVE_INFINITY),g=e.node(c);d!==Number.POSITIVE_INFINITY&&g.borderType!==l&&(i[c]=Math.max(i[c],d))}return u(a,s.predecessors.bind(s)),u(f,s.successors.bind(s)),Object.keys(r).forEach(c=>i[c]=i[n[c]]),i}function YM(e,t,n,r){let o=new DM,i=e.graph(),s=ZM(i.nodesep,i.edgesep,r);return t.forEach(l=>{let u;l.forEach(a=>{let f=n[a];if(o.setNode(f),u){var c=n[u],d=o.edge(c,f);o.setEdge(c,f,Math.max(s(e,a,u),d||0))}u=a})}),o}function XM(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,u])=>{let a=qM(e,l)/2;o=Math.max(u+a,o),i=Math.min(u-a,i)});const s=o-i;return s{["l","r"].forEach(s=>{let l=i+s,u=e[l];if(u===t)return;let a=Object.values(u),f=r-Kt.applyWithChunking(Math.min,a);s!=="l"&&(f=o-Kt.applyWithChunking(Math.max,a)),f&&(e[l]=Kt.mapValues(u,c=>c+f))})})}function QM(e,t){return Kt.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let o=Object.values(e).map(i=>i[r]).sort((i,s)=>i-s);return(o[1]+o[2])/2}})}function KM(e){let t=Kt.buildLayerMatrix(e),n=Object.assign(FM(e,t),VM(e,t)),r={},o;["u","d"].forEach(s=>{o=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(o=o.map(c=>Object.values(c).reverse()));let u=(s==="u"?e.predecessors:e.successors).bind(e),a=UM(e,o,n,u),f=WM(e,o,a.root,a.align,l==="r");l==="r"&&(f=Kt.mapValues(f,c=>-c)),r[s+l]=f})});let i=XM(e,r);return GM(r,i),QM(r,e.graph().align)}function ZM(e,t,n){return(r,o,i)=>{let s=r.node(o),l=r.node(i),u=0,a;if(u+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2;break}if(a&&(u+=n?a:-a),a=0,u+=(s.dummy?t:e)/2,u+=(l.dummy?t:e)/2,u+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2;break}return a&&(u+=n?a:-a),a=0,u}}function qM(e,t){return e.node(t).width}let _0=_e,JM=jM.positionX;var e3=t3;function t3(e){e=_0.asNonCompoundGraph(e),n3(e),Object.entries(JM(e)).forEach(([t,n])=>e.node(t).x=n)}function n3(e){let t=_0.buildLayerMatrix(e),n=e.graph().ranksep,r=0;t.forEach(o=>{const i=o.reduce((s,l)=>{const u=e.node(l).height;return s>u?s:u},0);o.forEach(s=>e.node(s).y=r+i/2),r+=i+n})}let S0=oC,k0=aC,r3=$C,o3=_e.normalizeRanks,i3=AC,s3=_e.removeEmptyRanks,N0=VC,l3=XC,C0=QC,u3=RM,a3=e3,it=_e,c3=xt.Graph;var f3=d3;function d3(e,t){let n=t&&t.debugTiming?it.time:it.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>_3(e));n(" runLayout",()=>h3(r,n,t)),n(" updateInputGraph",()=>p3(e,r))})}function h3(e,t,n){t(" makeSpaceForEdgeLabels",()=>S3(e)),t(" removeSelfEdges",()=>b3(e)),t(" acyclic",()=>S0.run(e)),t(" nestingGraph.run",()=>N0.run(e)),t(" rank",()=>r3(it.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>k3(e)),t(" removeEmptyRanks",()=>s3(e)),t(" nestingGraph.cleanup",()=>N0.cleanup(e)),t(" normalizeRanks",()=>o3(e)),t(" assignRankMinMax",()=>N3(e)),t(" removeEdgeLabelProxies",()=>C3(e)),t(" normalize.run",()=>k0.run(e)),t(" parentDummyChains",()=>i3(e)),t(" addBorderSegments",()=>l3(e)),t(" order",()=>u3(e,n)),t(" insertSelfEdges",()=>$3(e)),t(" adjustCoordinateSystem",()=>C0.adjust(e)),t(" position",()=>a3(e)),t(" positionSelfEdges",()=>z3(e)),t(" removeBorderNodes",()=>T3(e)),t(" normalize.undo",()=>k0.undo(e)),t(" fixupEdgeLabelCoords",()=>P3(e)),t(" undoCoordinateSystem",()=>C0.undo(e)),t(" translateGraph",()=>M3(e)),t(" assignNodeIntersects",()=>I3(e)),t(" reversePoints",()=>L3(e)),t(" acyclic.undo",()=>S0.undo(e))}function p3(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}let g3=["nodesep","edgesep","ranksep","marginx","marginy"],m3={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},y3=["acyclicer","ranker","rankdir","align"],v3=["width","height","rank"],M0={width:0,height:0},w3=["minlen","weight","width","height","labeloffset"],x3={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},E3=["labelpos"];function _3(e){let t=new c3({multigraph:!0,compound:!0}),n=gc(e.graph());return t.setGraph(Object.assign({},m3,pc(n,g3),it.pick(n,y3))),e.nodes().forEach(r=>{let o=gc(e.node(r));const i=pc(o,v3);Object.keys(M0).forEach(s=>{i[s]===void 0&&(i[s]=M0[s])}),t.setNode(r,i),t.setParent(r,e.parent(r))}),e.edges().forEach(r=>{let o=gc(e.edge(r));t.setEdge(r,Object.assign({},x3,pc(o,w3),it.pick(o,E3)))}),t}function S3(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function k3(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};it.addDummyNode(e,"edge-proxy",i,"_ep")}})}function N3(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function C3(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy==="edge-proxy"&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function M3(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,l=i.marginy||0;function u(a){let f=a.x,c=a.y,d=a.width,g=a.height;t=Math.min(t,f-d/2),n=Math.max(n,f+d/2),r=Math.min(r,c-g/2),o=Math.max(o,c+g/2)}e.nodes().forEach(a=>u(e.node(a))),e.edges().forEach(a=>{let f=e.edge(a);Object.hasOwn(f,"x")&&u(f)}),t-=s,r-=l,e.nodes().forEach(a=>{let f=e.node(a);f.x-=t,f.y-=r}),e.edges().forEach(a=>{let f=e.edge(a);f.points.forEach(c=>{c.x-=t,c.y-=r}),Object.hasOwn(f,"x")&&(f.x-=t),Object.hasOwn(f,"y")&&(f.y-=r)}),i.width=n-t+s,i.height=o-r+l}function I3(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(it.intersectRect(r,i)),n.points.push(it.intersectRect(o,s))})}function P3(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function L3(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function T3(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function b3(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $3(e){var t=it.buildLayerMatrix(e);t.forEach(n=>{var r=0;n.forEach((o,i)=>{var s=e.node(o);s.order=i+r,(s.selfEdges||[]).forEach(l=>{it.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:s.rank,order:i+ ++r,e:l.e,label:l.label},"_se")}),delete s.selfEdges})})}function z3(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy==="selfedge"){var r=e.node(n.e.v),o=r.x+r.width/2,i=r.y,s=n.x-o,l=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:o+2*s/3,y:i-l},{x:o+5*s/6,y:i-l},{x:o+s,y:i},{x:o+5*s/6,y:i+l},{x:o+2*s/3,y:i+l}],n.label.x=n.x,n.label.y=n.y}})}function pc(e,t){return it.mapValues(it.pick(e,t),Number)}function gc(e){var t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}let O3=_e,R3=xt.Graph;var A3={debugOrdering:D3};function D3(e){let t=O3.buildLayerMatrix(e),n=new R3({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,l)=>(n.setEdge(s,l,{style:"invis"}),l))}),n}var j3="1.1.8",F3={graphlib:xt,layout:f3,debug:A3,util:{time:_e.time,notime:_e.notime},version:j3};const I0=zt(F3),V3="LR",H3=60,B3=140;function U3(e,t){const n=new I0.graphlib.Graph;n.setGraph({rankdir:V3,nodesep:H3,ranksep:B3,marginx:24,marginy:24}),n.setDefaultEdgeLabel(()=>({}));for(const o of e)n.setNode(o.id,{width:o.width,height:o.height});for(const o of t)n.hasNode(o.source)&&n.hasNode(o.target)&&n.setEdge(o.source,o.target);I0.layout(n);const r=new Map;for(const o of e){const i=n.node(o.id);i&&r.set(o.id,{x:i.x-o.width/2,y:i.y-o.height/2})}return r}function W3(e,t){return e.map(n=>({...n,position:t.get(n.id)??{x:0,y:0}}))}function Y3(e){return e.map(t=>({source:t.source,target:t.target}))}const X3={model:"var(--model, #2f6feb)",source:"var(--source, #16a34a)",seed:"var(--seed, #b45309)",snapshot:"var(--snapshot, #7c3aed)"};function G3({data:e}){const t=e.record,n=e.dimmed,r=X3[t.resource_type]??"var(--border, #888)";return I.jsxs("div",{className:`dbd-node${n?" dbd-dim":""}`,title:t.id,children:[I.jsx(Tt,{type:"target",position:G.Left}),I.jsx("span",{className:"dbd-node-bar",style:{background:r}}),I.jsx("span",{className:"dbd-node-label",children:t.label}),I.jsx(Tt,{type:"source",position:G.Right})]})}const Q3={lineage:G3,erdTable:T2},K3=400;function Z3(e){const t=new Set;for(const n of Object.keys(e.nodes??{}))t.add(e.nodes[n].schema);return Array.from(t).sort()}function q3(e,t,n){const r=[];return e&&r.push("focus="+encodeURIComponent(e)),t&&r.push("rtype="+encodeURIComponent(t)),n&&r.push("schema="+encodeURIComponent(n)),r.length?"#/dag?"+r.join("&"):"#/dag"}function J3({mode:e,focus:t,data:n,onOpenNode:r,initialRtype:o="",initialSchema:i=""}){var M,N;const s=e==="dag",[l,u]=D.useState(!1),a=e==="erd",f=s||a&&l,c=!f,d=t&&((M=n.nodes)!=null&&M[t])?n.nodes[t].label:t??"",[g,m]=D.useState(d),[w,x]=D.useState(o),[p,y]=D.useState(i),[h,v]=D.useState(null),E=D.useMemo(()=>{if(!s)return t??null;const P=g.trim().toLowerCase();if(!P)return null;const A=Object.keys(n.nodes??{});return A.find(O=>O.toLowerCase()===P)??A.find(O=>n.nodes[O].label.toLowerCase()===P)??A.find(O=>n.nodes[O].label.toLowerCase().startsWith(P))??null},[s,g,t,n]);D.useEffect(()=>{if(!s)return;const P=q3(E,w,p);history.replaceState(null,"",P)},[s,E,w,p]);const _=D.useMemo(()=>{if(!s)return null;if(E)return D2(n,E);const P=Object.keys(n.nodes??{}).filter(A=>{const O=n.nodes[A];return!(w&&O.resource_type!==w||p&&O.schema!==p)});return P.length>K3?new Set:new Set(P)},[s,E,n,w,p]),k=!!(w||p),C=s&&!E&&_!==null&&_.size===0,b=C&&k,j=C&&!k,{nodes:T,edges:R}=D.useMemo(()=>{if(C)return{nodes:[],edges:[]};const P=s?R2(n,_??void 0):A2(n,e==="erd-node"?t:null),A=U3(P.sizes,Y3(P.edges));let O=W3(P.nodes,A),U=P.edges;if(s)O=O.map(B=>({...B,data:{...B.data,dimmed:!1,focused:B.id===E}})),U=P.edges.map(B=>({...B,animated:!!E,style:E?{stroke:"var(--accent, #2f6feb)",strokeWidth:2}:void 0}));else if(h){const B=new Set([h.source,h.target]);O=O.map(X=>({...X,data:{...X.data,dimmed:!B.has(X.id)}})),U=P.edges.map(X=>{const q=X.source===h.source&&X.target===h.target;return{...X,animated:q,style:q?{stroke:"var(--accent, #2f6feb)",strokeWidth:2.5}:{opacity:.1}}})}return{nodes:O,edges:U}},[s,e,t,E,n,_,C,h]),V=e==="erd-node"&&R.length===0,S=((N=n.metadata)==null?void 0:N.erd_algo)??"test_relationship",$=(P,A)=>{r&&r(A.id)},L=(P,A)=>{v(O=>O&&O.source===A.source&&O.target===A.target?null:{source:A.source,target:A.target})},z=()=>v(null);return I.jsxs("div",{className:"dbd-graph",children:[s&&I.jsxs("div",{className:"dbd-toolbar",children:[I.jsx("input",{placeholder:"Focus a node…",value:g,onChange:P=>m(P.target.value)}),I.jsxs("select",{value:w,onChange:P=>x(P.target.value),children:[I.jsx("option",{value:"",children:"All types"}),I.jsx("option",{value:"model",children:"Models"}),I.jsx("option",{value:"source",children:"Sources"}),I.jsx("option",{value:"seed",children:"Seeds"}),I.jsx("option",{value:"snapshot",children:"Snapshots"})]}),I.jsxs("select",{value:p,onChange:P=>y(P.target.value),children:[I.jsx("option",{value:"",children:"All schemas"}),Z3(n).map(P=>I.jsx("option",{value:P,children:P},P))]})]}),a&&I.jsx("div",{className:"dbd-erd-bar",children:I.jsx("button",{type:"button",className:`dbd-lock-btn${l?" on":""}`,onClick:()=>u(P=>!P),title:l?"Lock pan & zoom":"Unlock pan & zoom",children:l?"🔓 Pan & zoom on":"🔒 Locked — click to pan & zoom"})}),I.jsx("div",{className:"dbd-canvas",children:b?I.jsx("div",{className:"dbd-graph-empty",children:I.jsx("p",{children:"No nodes match the selected filter. Clear or change the type/schema filter above, or focus a node to explore its neighborhood."})}):j?I.jsx("div",{className:"dbd-graph-empty",children:I.jsx("p",{children:"This project has too many models to draw the full lineage at once. Focus a node above (or filter by type/schema) to explore its neighborhood."})}):V?I.jsx("div",{className:"dbd-graph-empty",children:I.jsxs("p",{children:["No ERD relationships detected for this entity using the"," ",I.jsx("code",{children:S})," algorithm. dbterd infers foreign keys from your project; see"," ",I.jsx("a",{href:"https://dbterd.datnguye.me/latest/nav/guide/choose-algo.html",target:"_blank",rel:"noopener",children:"choosing a dbterd algorithm"})," ","to configure detection."]})}):I.jsx(Im,{children:I.jsxs(e2,{nodes:T,edges:R,nodeTypes:Q3,onNodeClick:$,onEdgeClick:L,onPaneClick:z,fitView:!0,minZoom:.1,proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,...c?{panOnDrag:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,fitViewOptions:{padding:.15}}:{},children:[I.jsx(i2,{}),f&&I.jsx(d2,{showInteractive:!1}),f&&I.jsx(N2,{pannable:!0,zoomable:!0})]})})})]})}const mc=new WeakMap;function eI(e){const t=window.dbdocsData;if(!t)return;const n=e.dataset.mode||"dag",r=e.dataset.focus||null,o=e.dataset.rtype||"",i=e.dataset.schema||"",s=u=>{location.hash=`#/node/${encodeURIComponent(u)}`},l=jh(e);mc.set(e,l),l.render(I.jsx(D.StrictMode,{children:I.jsx(J3,{mode:n,focus:r,data:t,onOpenNode:s,initialRtype:o,initialSchema:i})}))}function tI(e){const t=mc.get(e);t&&(t.unmount(),mc.delete(e))}window.dbdocsGraph={mount:eI,unmount:tI}})(); diff --git a/frontend/test/e2e/spa.spec.ts b/frontend/test/e2e/spa.spec.ts index dda471a..382482d 100644 --- a/frontend/test/e2e/spa.spec.ts +++ b/frontend/test/e2e/spa.spec.ts @@ -338,6 +338,28 @@ test.describe("graphs", () => { await expect(empty).toContainText("No ERD relationships detected"); await expect(empty.locator('a[href*="dbterd.datnguye.me"]')).toBeVisible(); }); + + test("the model_contract algo detects FK relationships and renders the ERD", async ({ page }) => { + // The demo is built with `algo: model_contract` (docs/dbdocs-demo.yml), so + // dbterd derives FKs from each model's contract constraints rather than from + // `relationships` tests. orders' contract has location_id → locations and is + // referenced by fct_customer_segment_orders, so its per-node ERD windows to + // orders plus those two directly-related tables. + await page.goto("index.html#/node/model.jaffle_shop.orders"); + // No empty-state placeholder — model_contract detected relationships. + await expect(page.locator(".dbd-graph-empty")).toHaveCount(0); + const tables = page.locator(".dbd-erd"); + await expect(tables.first()).toBeVisible(); + await expect(tables).toHaveCount(3); + // entity_name_format: table → the label is the bare model name. + await expect(page.locator(".dbd-erd-focus .dbd-erd-name")).toHaveText("orders"); + await expect(page.locator(".react-flow__edge")).toHaveCount(2); + // model_contract populates PK/FK badges from the contract: orders carries a + // PK (order_id) and an FK (location_id) — test_relationship would not. + const focus = page.locator(".dbd-erd-focus"); + await expect(focus.locator(".dbd-erd-badge.dbd-pk")).toHaveCount(1); + await expect(focus.locator(".dbd-erd-badge.dbd-fk")).toHaveCount(1); + }); }); test.describe("deep-link URL state (B1 + B2)", () => { diff --git a/pyproject.toml b/pyproject.toml index c393d10..bc653bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ dependencies = [ "artifact-parser[dbt]>=1.0.0", "click>=8.1", - "dbterd>=1.27", + "dbterd>=1.28", "pydantic>=2.13.4", "pyyaml>=6.0", "sqlglot>=25", @@ -59,7 +59,8 @@ dev = [ "pdoc>=14.4.0", ] docs = [ - "mkdocs-material>=9.5", + "mkdocs>=1.6,<2.0", + "mkdocs-material>=9.5,<10", "mkdocs-minify-plugin>=0.8", "mike>=2.1", ] diff --git a/tests/unit/extract/test_erd_json.py b/tests/unit/extract/test_erd_json.py deleted file mode 100644 index 2959ac2..0000000 --- a/tests/unit/extract/test_erd_json.py +++ /dev/null @@ -1,70 +0,0 @@ -import json - -from dbterd.core.models import Column, Ref, Table -from dbterd.core.registry.plugin_registry import PluginRegistry - -from dbdocs.extract import erd_json - - -def _table(): - return Table( - name="customers", - database="db", - schema="analytics", - columns=[ - Column(name="id", data_type="int", is_primary_key=True), - Column(name="name", data_type="text"), - ], - resource_type="model", - node_name="model.shop.customers", - description="The customers.", - label="customers", - ) - - -def test_column_to_dict(): - d = erd_json.column_to_dict(Column(name="id", data_type="int", is_primary_key=True)) - assert d == {"name": "id", "data_type": "int", "description": "", "is_primary_key": True} - - -def test_table_to_dict(): - d = erd_json.table_to_dict(_table()) - assert d["name"] == "customers" - assert d["node_name"] == "model.shop.customers" - assert d["schema"] == "analytics" - assert [c["name"] for c in d["columns"]] == ["id", "name"] - - -def test_relationship_to_dict(): - ref = Ref( - name="fk1", - table_map=("stg_customers", "customers"), - column_map=(["cust_id"], ["id"]), - type="n1", - relationship_label="c_to_s", - ) - d = erd_json.relationship_to_dict(ref) - assert d["table_map"] == ["stg_customers", "customers"] - assert d["column_map"] == [["cust_id"], ["id"]] - assert d["type"] == "n1" - - -def test_adapter_build_erd_emits_structured_json(): - ref = Ref(name="fk1", table_map=("a", "b"), column_map=(["x"], ["y"]), type="n1") - adapter = erd_json.JsonAdapter() - payload = json.loads(adapter.build_erd([_table()], [ref])) - assert payload["tables"][0]["name"] == "customers" - assert payload["relationships"][0]["name"] == "fk1" - - -def test_adapter_format_helpers_and_symbol(): - adapter = erd_json.JsonAdapter() - assert json.loads(adapter.format_table(_table()))["name"] == "customers" - ref = Ref(name="r", table_map=("a", "b"), column_map=(["x"], ["y"])) - assert json.loads(adapter.format_relationship(ref))["name"] == "r" - assert adapter.get_rel_symbol("n1") == "" - - -def test_adapter_is_registered(): - # Importing the module registered the "json" target. - assert PluginRegistry.has_target("json") diff --git a/tests/unit/site/test_builder.py b/tests/unit/site/test_builder.py index 0c472bf..1d340fa 100644 --- a/tests/unit/site/test_builder.py +++ b/tests/unit/site/test_builder.py @@ -9,36 +9,52 @@ class _FakeErd: - """Stands in for DbtErd(target="json"): get_erd() returns the json payload.""" + """Stands in for DbtErd(target="json"): get_erd() returns the official payload.""" def get_erd(self): return json.dumps( { - "tables": [ + "nodes": [ { + "id": "model.shop.customers", "name": "customers", "database": "db", - "schema": "analytics", + "schema_name": "analytics", "resource_type": "model", - "node_name": "model.shop.customers", - "columns": [{"name": "id", "data_type": "int", "is_primary_key": True}], + "columns": [ + { + "name": "id", + "data_type": "int", + "is_primary_key": True, + "is_foreign_key": True, + } + ], }, { + "id": "model.shop.stg_customers", "name": "stg_customers", "database": "db", - "schema": "raw", + "schema_name": "raw", "resource_type": "model", - "node_name": "model.shop.stg_customers", - "columns": [{"name": "cust_id", "data_type": "int"}], + "columns": [ + { + "name": "cust_id", + "data_type": "int", + "is_primary_key": False, + "is_foreign_key": False, + } + ], }, ], - "relationships": [ + "edges": [ { - "name": "fk1", - "type": "n1", - "table_map": ["stg_customers", "customers"], - "column_map": [["cust_id"], ["id"]], - "relationship_label": "c_to_s", + "id": "fk1", + "from_id": "model.shop.customers", + "to_id": "model.shop.stg_customers", + "from_columns": ["id"], + "to_columns": ["cust_id"], + "label": "c_to_s", + "cardinality": "n1", } ], } @@ -208,12 +224,13 @@ def test_build_erd_data_parses_json_to_nodes_edges(): by_id = {n["id"]: n for n in data["nodes"]} customers = by_id["model.shop.customers"] assert customers["label"] == "customers" - # `id` is the PK on customers and the FK target column. + # `id` is both the PK and the FK column on customers. pk = [c for c in customers["columns"] if c["is_primary_key"]] fk = [c for c in customers["columns"] if c["is_foreign_key"]] assert [c["name"] for c in pk] == ["id"] assert [c["name"] for c in fk] == ["id"] edge = data["edges"][0] + # source = to_id (parent/referenced side); target = from_id (FK/child side). assert edge["source"] == "model.shop.stg_customers" assert edge["target"] == "model.shop.customers" @@ -221,11 +238,190 @@ def test_build_erd_data_parses_json_to_nodes_edges(): def test_build_erd_data_empty_relationships(): class _Empty: def get_erd(self): - return json.dumps({"tables": [], "relationships": []}) + return json.dumps({"nodes": [], "edges": []}) assert erd_mod.build_erd_data(_Empty()) == {"nodes": [], "edges": []} +def test_backfill_fk_flags_skips_dangling_edge_and_empty_from_columns(): + """_backfill_fk_flags must not crash on a dangling edge target or empty from_columns.""" + node = {"id": "n1", "columns": [{"name": "col_a", "is_foreign_key": False}]} + # Dangling edge: target "n_missing" not in nodes list. + dangling = {"target": "n_missing", "from_columns": ["col_a"]} + # Edge with no from_columns: target exists but nothing to backfill. + no_cols = {"target": "n1", "from_columns": []} + erd_mod._backfill_fk_flags([node], [dangling, no_cols]) + # Neither edge should have set is_foreign_key on node.col_a. + assert node["columns"][0]["is_foreign_key"] is False + + +def test_build_erd_data_entity_name_format_resolves_edge_ids(): + """Regression: when entity_name_format is set dbterd emits edge from_id/to_id + as the short name (e.g. ``orders``) while node id is the full unique_id + (e.g. ``model.jaffle_shop.orders``). build_erd_data must resolve those back + to the node id so source/target reference a valid node. + + Also covers FK backfill: the orders.location_id column has is_foreign_key=False + in the raw node payload (dbterd model_contract quirk), but appears in the + edge from_columns → build_erd_data sets it to True.""" + + class _NameFormatErd: + def get_erd(self): + return json.dumps( + { + "nodes": [ + { + "id": "model.jaffle_shop.orders", + "name": "orders", + "database": "db", + "schema_name": "main", + "resource_type": "model", + "columns": [ + { + "name": "order_id", + "data_type": "int", + "is_primary_key": True, + "is_foreign_key": False, + }, + { + "name": "location_id", + "data_type": "int", + "is_primary_key": False, + "is_foreign_key": False, + }, + ], + }, + { + "id": "model.jaffle_shop.locations", + "name": "locations", + "database": "db", + "schema_name": "main", + "resource_type": "model", + "columns": [ + { + "name": "id", + "data_type": "int", + "is_primary_key": True, + "is_foreign_key": False, + } + ], + }, + ], + "edges": [ + { + "id": "fk_loc", + "from_id": "orders", + "to_id": "locations", + "from_columns": ["location_id"], + "to_columns": ["id"], + "label": "", + "cardinality": "n1", + } + ], + } + ) + + data = erd_mod.build_erd_data(_NameFormatErd()) + node_ids = {n["id"] for n in data["nodes"]} + assert node_ids == {"model.jaffle_shop.orders", "model.jaffle_shop.locations"} + edge = data["edges"][0] + # source = parent (to_id → locations), target = child (from_id → orders) + assert edge["source"] == "model.jaffle_shop.locations" + assert edge["target"] == "model.jaffle_shop.orders" + # FK backfill: orders.location_id was not_fk in raw payload but is in from_columns. + orders = next(n for n in data["nodes"] if n["id"] == "model.jaffle_shop.orders") + by_name = {c["name"]: c for c in orders["columns"]} + assert by_name["location_id"]["is_foreign_key"] is True + assert by_name["order_id"]["is_foreign_key"] is False # not in any from_columns + # Referenced side (locations.id) is not backfilled as FK. + locations = next(n for n in data["nodes"] if n["id"] == "model.jaffle_shop.locations") + assert locations["columns"][0]["is_foreign_key"] is False + + +def test_build_erd_data_node_without_name_skipped_in_name_map(): + """A node with no ``name`` field is skipped when building the name→id map.""" + + class _NoNameErd: + def get_erd(self): + return json.dumps( + { + "nodes": [ + { + "id": "model.shop.a", + "database": "db", + "schema_name": "s", + "resource_type": "model", + "columns": [], + }, + ], + "edges": [], + } + ) + + data = erd_mod.build_erd_data(_NoNameErd()) + assert len(data["nodes"]) == 1 + assert data["nodes"][0]["label"] == "" + + +def test_build_erd_data_ambiguous_entity_name_left_unresolved(): + """Two nodes sharing the same formatted name produce an ambiguous entry. + + _resolve_edge_id must leave the raw short name intact rather than binding + it to an arbitrary node — fail-honest, not fail-wrong. + """ + + class _AmbiguousErd: + def get_erd(self): + return json.dumps( + { + "nodes": [ + { + "id": "model.pkg_a.orders", + "name": "orders", + "database": "db", + "schema_name": "a", + "resource_type": "model", + "columns": [], + }, + { + "id": "model.pkg_b.orders", + "name": "orders", + "database": "db", + "schema_name": "b", + "resource_type": "model", + "columns": [], + }, + { + "id": "model.pkg_a.customers", + "name": "customers", + "database": "db", + "schema_name": "a", + "resource_type": "model", + "columns": [], + }, + ], + "edges": [ + { + "id": "fk_ambig", + "from_id": "orders", + "to_id": "customers", + "from_columns": [], + "to_columns": [], + "label": "", + "cardinality": "n1", + } + ], + } + ) + + data = erd_mod.build_erd_data(_AmbiguousErd()) + edge = data["edges"][0] + # "customers" is unambiguous → resolves to the full unique_id. + assert edge["source"] == "model.pkg_a.customers" + # "orders" is ambiguous (two nodes share that name) → stays as the raw short name. + assert edge["target"] == "orders" + + def test_build_erd_forwards_options_and_forces_json(monkeypatch): captured = {} monkeypatch.setattr(erd_mod, "DbtErd", lambda **kw: captured.update(kw) or captured) diff --git a/uv.lock b/uv.lock index bf238f8..9ad462f 100644 --- a/uv.lock +++ b/uv.lock @@ -366,6 +366,7 @@ dev = [ ] docs = [ { name = "mike" }, + { name = "mkdocs" }, { name = "mkdocs-material" }, { name = "mkdocs-minify-plugin" }, ] @@ -374,7 +375,7 @@ docs = [ requires-dist = [ { name = "artifact-parser", extras = ["dbt"], specifier = ">=1.0.0" }, { name = "click", specifier = ">=8.1" }, - { name = "dbterd", specifier = ">=1.27" }, + { name = "dbterd", specifier = ">=1.28" }, { name = "pydantic", specifier = ">=2.13.4" }, { name = "pyyaml", specifier = ">=6.0" }, { name = "sqlglot", specifier = ">=25" }, @@ -390,7 +391,8 @@ dev = [ ] docs = [ { name = "mike", specifier = ">=2.1" }, - { name = "mkdocs-material", specifier = ">=9.5" }, + { name = "mkdocs", specifier = ">=1.6,<2.0" }, + { name = "mkdocs-material", specifier = ">=9.5,<10" }, { name = "mkdocs-minify-plugin", specifier = ">=0.8" }, ] @@ -543,7 +545,7 @@ wheels = [ [[package]] name = "dbterd" -version = "1.27.0" +version = "1.28.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "artifact-parser" }, @@ -551,9 +553,9 @@ dependencies = [ { name = "requests" }, { name = "tomli", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/14/fd/768e87ffa0ce76329afc356421fae62361b5a921233928d25eb0f947eaeb/dbterd-1.27.0.tar.gz", hash = "sha256:3b534058b19b2a52de0e97b1f45f345599b407c177cffdcb274f1f6d4a939648", size = 61297, upload-time = "2026-06-13T07:14:46.813Z" } +sdist = { url = "https://files.pythonhosted.org/packages/06/09/210b0fd41a1a76ebd37d7f9dab764aee0c9f9e49ada55dd8710d23065b8c/dbterd-1.28.0.tar.gz", hash = "sha256:038b76206ce17d117f9628a12e18ab84d347ba738f9a211a0cef11539ea45967", size = 64499, upload-time = "2026-06-14T14:21:15.976Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e0/b2/f52d920e65947589f6967b1e8fce2d7e2b96ad71a14ded0c602d7299aa17/dbterd-1.27.0-py3-none-any.whl", hash = "sha256:5a3a5aae3f323eea451b68dc93a0f3d55fc0a2864e5e240df10e4f5007128ddb", size = 79552, upload-time = "2026-06-13T07:14:45.168Z" }, + { url = "https://files.pythonhosted.org/packages/e0/15/0beb8bbb07eac3048ce39a0bd2250ee6948d951d5f718d41bdd0c3fca8b1/dbterd-1.28.0-py3-none-any.whl", hash = "sha256:aa190d8ccf3d2de3107cf41b0c864f57b237bf44e37dcaff185ff1d46229ca18", size = 83797, upload-time = "2026-06-14T14:21:14.54Z" }, ] [[package]] @@ -1350,7 +1352,7 @@ wheels = [ [[package]] name = "pytest" -version = "9.0.3" +version = "9.1.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama", marker = "sys_platform == 'win32'" }, @@ -1361,9 +1363,9 @@ dependencies = [ { name = "pygments" }, { name = "tomli", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/549bd94f1a0a402dc8cf64563a117c0f3765662e2e668477624baeec44d5/pytest-9.0.3.tar.gz", hash = "sha256:b86ada508af81d19edeb213c681b1d48246c1a91d304c6c81a427674c17eb91c", size = 1572165, upload-time = "2026-04-07T17:16:18.027Z" } +sdist = { url = "https://files.pythonhosted.org/packages/84/0e/b5858858d74958632c49b72cb25a3976ff9f632397626715be71c89d3971/pytest-9.1.0.tar.gz", hash = "sha256:41dd9148c08072446394cefd3d79701701335a9f4cae69ba92e39f6c7f5c061c", size = 1634181, upload-time = "2026-06-13T18:52:45.983Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d4/24/a372aaf5c9b7208e7112038812994107bc65a84cd00e0354a88c2c77a617/pytest-9.0.3-py3-none-any.whl", hash = "sha256:2c5efc453d45394fdd706ade797c0a81091eccd1d6e4bccfcd476e2b8e0ab5d9", size = 375249, upload-time = "2026-04-07T17:16:16.13Z" }, + { url = "https://files.pythonhosted.org/packages/8b/5a/ba30a81239b909821b3153e303e7def45178bf353da4f72380e6c5e8793b/pytest-9.1.0-py3-none-any.whl", hash = "sha256:8ebb0e7888bdf2bdfc602ec51f8f62d50200af37356c74e503c79a94f5c81f32", size = 386453, upload-time = "2026-06-13T18:52:44.045Z" }, ] [[package]]